Exemplo n.º 1
0
        /// <summary>
        /// Registers the AI in the level and finds the other players.
        /// </summary>
    	private void Start() {
            bard = GetComponent<AIBard>();
            control = GetComponent<AIControl>();
            enabledRhythms = LevelManager.instance.EnabledRhythms;
            LevelControllerManager.instance.AddPlayer(control.player, control);
            bard.timingVariance = 0.1f;

            MinionTuneSpawn minion = GetComponent<MinionTuneSpawn>();
            PlayerID selfID;
            if (minion != null) {
                selfID = minion.owner;
            } else {
                selfID = control.player;
            }

            otherPlayers = new List<BaseControl>();
            BaseControl[] otherPlayersArray = FindObjectsOfType<BaseControl>();
            foreach (BaseControl otherPlayer in otherPlayersArray) {
                if (otherPlayer.player != selfID && otherPlayer.GetComponent<MinionTuneSpawn>() == null) {
                    otherPlayers.Add(otherPlayer);
                }
            }

            InitializeAI();
    	}
Exemplo n.º 2
0
        /// <summary>
        /// Registers the other players in the scene.
        /// </summary>
        public void FindOtherPlayers()
        {
            MinionTuneSpawn minion = GetComponent <MinionTuneSpawn>();
            PlayerID        selfID;

            if (minion != null)
            {
                selfID   = minion.owner;
                isMinion = true;
            }
            else
            {
                selfID = control.player;
            }

            otherPlayers = new List <BaseControl>();
            BaseControl[] otherPlayersArray;
            if (Assets.Scripts.Data.RoundHandler.Instance != null)
            {
                otherPlayersArray = Assets.Scripts.Data.RoundHandler.Instance.Control();
            }
            else
            {
                otherPlayersArray = FindObjectsOfType <BaseControl>();
            }
            foreach (BaseControl otherPlayer in otherPlayersArray)
            {
                if (otherPlayer.player != selfID && otherPlayer.GetComponent <MinionTuneSpawn>() == null)
                {
                    otherPlayers.Add(otherPlayer);
                }
            }

            hill = FindObjectOfType <KingofHill>();
        }