示例#1
0
        private void ChangePlayerCustomisationContext(int playerID)
        {
            this.playerID = playerID;

            customisationData = CManager.GetPlayerCustomisation(playerID);
            OnPlayerChange.Invoke(customisationData);
            DragonHelper.SetDragonAsPlayer(customisationData, DemoDragon);

            UpdateUI(playerID);
        }
示例#2
0
        private void Start()
        {
            gManager = SingletonHelper.Find(SingletonEnums.GameManager).GetComponent <GameManager>();
            cManager = SingletonHelper.Find(SingletonEnums.CustomisationManager).GetComponent <CustomisationManager>();

            if (gManager)
            {
                var humanCount = gManager.GameData.HumanCount;
                var aiCount    = gManager.GameData.AICount;

                var playersDragons = Enumerable
                                     .Range(0, humanCount)
                                     .Select(i => {
                    var dragon = CreateDragon(i);
                    DragonHelper.SetDragonAsPlayer(
                        cManager.GetPlayerCustomisation(i),
                        dragon);
                    return(dragon);
                });

                var aiDragons = Enumerable
                                .Range(humanCount, aiCount)
                                .Select(i => CreateDragon(i));

                dragons = playersDragons.Concat(aiDragons).ToArray();
            }
            else   /* Standalone Scene Mode */
            {
                dragons = FindObjectsOfType <DragonController>()
                          .Select(drc => drc.gameObject)
                          .ToArray();

                foreach (var dragon in dragons)
                {
                    alivePlayers.Add(dragon);
                    dragon.GetComponent <DamageController>().onDeath += OnDragonDeath;
                }
            }

            PositionPlayers();
        }