当前位置: 首页>>代码示例>>C#>>正文


C# Room.discoverNeighbors方法代码示例

本文整理汇总了C#中Room.discoverNeighbors方法的典型用法代码示例。如果您正苦于以下问题:C# Room.discoverNeighbors方法的具体用法?C# Room.discoverNeighbors怎么用?C# Room.discoverNeighbors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Room的用法示例。


在下文中一共展示了Room.discoverNeighbors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    void Start()
    {
        audio = GetComponent<AudioScript>();

        // initialize start characters here
        currentDayNum = 1;
        nextDeathIn = 5;
        // TODO: replace with Constructor if Journal is no gameobject
        journal = FindObjectOfType<Journal>();
        journal.gameObject.SetActive(false);
        FindObjectOfType<InterfaceController>().HideRoomStats();

        List<string> playerNames = loadPlayerNames();

        selectedRoom = GameObject.Find("Start (2,3)").GetComponent<Room>();
        List<int> usedIndizes = new List<int>();

        for (int i = 0; i < 6; i++)
        {
            int randomInt = UnityEngine.Random.Range(0, playerNames.Count);
            Character testCharacter = Instantiate(character_prefab);
            testCharacter.CharName = playerNames[randomInt];
            playerNames.RemoveAt(randomInt);
            selectedRoom.Characters.Add(testCharacter);
            do
            {
                randomInt = UnityEngine.Random.Range(0, playerHeads.Length);
            } while (usedIndizes.Contains(randomInt));

            usedIndizes.Add(randomInt);
            testCharacter.Portrait = playerHeads[randomInt];
            testCharacter.Face = playerFaces[randomInt];
            characters.Add(testCharacter);
        }

        selectedRoom.drawPeople();

        foreach (Room i in FindObjectsOfType<Room>())
        {
            i.BlackSmog.SetActive(true);
            i.gameObject.SetActive(false);
        }

        selectedRoom.SelectBubble.SetActive(true);
        selectedRoom.discoverNeighbors();

        activeRooms.Add(selectedRoom);

        FindObjectOfType<InterfaceController>().SetRoomMembers(selectedRoom.Characters);
    }
开发者ID:GigaGrunch,项目名称:FeastOfFriends,代码行数:50,代码来源:GameController.cs

示例2: OnMovementToRoomSuccess

    public void OnMovementToRoomSuccess(Room destination)
    {
        if (destination.name.Equals("Finish"))
        {
            EndingController.playerWon = true;
            SceneManager.LoadScene("EndScene");
        }

        roomsToActivate.Add(destination);

        destination.discoverNeighbors();

        if (destination.Reward != null && destination.Reward.Length > 0)
        {
            // TODO: remove [0] with proper selection mechanism if multiple rewards are possible
            Reward reward = destination.Reward[0];
            if (reward.IsActive && reward.getType() == Reward.Type.human)
            {
                List<string> playerNames = loadPlayerNames();
                string playerName;
                Sprite playerHead;
                Sprite playerFace;
                do
                {
                    playerName = playerNames[UnityEngine.Random.Range(0, playerNames.Count)];

                } while (!playerWithNameDoesNotExist(playerName));
                do
                {
                    int randomInt = UnityEngine.Random.Range(0, playerHeads.Length);
                    playerHead = playerHeads[randomInt];
                    playerFace = playerFaces[randomInt];

                } while (!playerWithHeadDoesNotExist(playerHead));
                Character newCharacter = Instantiate(character_prefab);
                audio.playNewGuy();
                newCharacter.CharName = playerName;
                newCharacter.Portrait = playerHead;
                newCharacter.Face = playerFace;
                characters.Add(newCharacter);
                destination.Characters.Add(newCharacter);
                destination.drawPeople();
                reward.IsActive = false;
                journal.addStory(new Story(currentDayNum, "In the corner of the room you find a lost soul. " + playerName + " joins your party of gourmets. He looks quite tasty."));
            }
        }
    }
开发者ID:GigaGrunch,项目名称:FeastOfFriends,代码行数:47,代码来源:GameController.cs


注:本文中的Room.discoverNeighbors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。