示例#1
0
    private void CreateTeam()
    {
        for (int i = 0; i < MaxTeamSize; i++)
        {
            var character = CharacterSpawner.SpawnCharacter();

            Team[i] = character;

            PlayerUIController.AssignCharacterToTeamSlot(character, i);
        }
    }
示例#2
0
    // Start is called before the first frame update
    void Start()
    {
        for (int i = 0; i < MaxCandidatesAmount; i++)
        {
            var character = CharacterSpawner.SpawnCharacter();

            CharacterShopAvatarCandidatesSlots[i].AssignCharacter(character);

            CharacterShopAvatarCandidatesSlots[i].OnActionButtonPressed += OnAddToTeam;
        }

        for (int i = 0; i < MaxTeamSize; i++)
        {
            CharacterShopAvatarTeamSlots[i].OnActionButtonPressed += OnRemoveFromTeam;
        }
    }
示例#3
0
    public void GameLoop()
    {
        if (_gameOverLaunched)
        {
            return;
        }
        if (IsGameOver)
        {
            OnGameOver(false);
            return;
        }

        if (m_characters.Count == 0 && !WaveManager.IsRunningWaves)
        {
            if (WaveManager.HasRemainingWaves)
            {
                WaveManager.StartNextWave();
            }
            else
            {
                OnGameOver(true);
            }
        }

        m_spawns.ForEach(spawn =>
        {
            var spawnedChar = CharacterSpawner.SpawnCharacter(spawn.Model, spawn.Position);
            m_characters.Add(spawnedChar);
        });
        m_spawns.Clear();

        for (int i = 0, size = m_traps.Count; i < size; ++i)
        {
            var trap = m_traps[i];
            trap.Act();
        }

        for (int i = m_characters.Count - 1; i >= 0; --i)
        {
            var c = m_characters[i];
            if (c.IsDead)
            {
                Debug.Log("Character Dead " + c);
                c.OnDeath();
                ComputeCharacterDeath(c);
                m_characters.RemoveAt(i);
            }
            else if (c.IsTempVictory && !c.IsVictoryLaunched)
            {
                c.IsVictoryLaunched = true;
                OnCharacterVictory(c);
            }
            else if (c.IsVictory)
            {
                m_characters.RemoveAt(i);
                Destroy(c.gameObject);
            }
            else
            {
                c.MoveLoop();
            }
        }
    }