Пример #1
0
        private void Awake()
        {
            _characterController = ApplicationController.Instance.CharacterController;

            // Destroy all subcategory children.
            foreach (Transform child in transform)
            {
                if (child.GetComponent <CharacterSubCategory>() != null)
                {
                    Destroy(child.gameObject);
                }
            }

            var characterList = _characterController.CharacterPrefabs;
            var grouping      = characterList.GroupBy(c => c.Type);

            foreach (DrawableBase.DrawableType type in Enum.GetValues(typeof(DrawableBase.DrawableType)))
            {
                if (type != DrawableBase.DrawableType.None && type != DrawableBase.DrawableType.Wire)
                {
                    var subList = grouping.FirstOrDefault(g => g.Key == type);
                    AddSubCategory(type.ToString(), subList == null ? null : subList.ToList());
                }
            }
        }
Пример #2
0
    private void CheckDestroyedCharacters()
    {
        Queue <CharacterBaseController> defeatedCharacters = new Queue <CharacterBaseController>();

        if (m_PlayerController.currentCharacterStatus == CharacterStatus.defeated)
        {
            m_PlayerController.m_DefeatableBase.Defeated();
        }
        else
        {
            foreach (CharacterBaseController character in enemies)
            {
                if (character.currentCharacterStatus == CharacterStatus.defeated)
                {
                    defeatedCharacters.Enqueue(character);
                }
            }

            while (defeatedCharacters.Count > 0)
            {
                CharacterBaseController character = defeatedCharacters.Dequeue();
                character.m_DefeatableBase.Defeated();
            }
        }
    }
Пример #3
0
    public void DequeueCharacterToAct()
    {
        switch (currentTeamTurn)
        {
        case TeamTurn.player:

            DungeonBaseController.instance.m_PlayerController.Activate();
            SwitchCurrentState(TurnManagerState.idle);
            bool ready = true;
            foreach (CharacterBaseController enemy in DungeonBaseController.instance.enemies)
            {
                if (!(enemy.currentCharacterStatus == CharacterStatus.idle ||
                      enemy.currentCharacterStatus == CharacterStatus.defeated))
                {
                    ready = false;
                }
            }

            if (ready)
            {
                CharacterBaseController playerController = DungeonBaseController.instance.m_PlayerController;

                if (playerController.currentCharacterStatus == CharacterStatus.idle)
                {
                    CharacterBaseController[] allCharacters = new CharacterBaseController[DungeonBaseController.instance.allCharacters.Count];
                    DungeonBaseController.instance.allCharacters.CopyTo(allCharacters);

                    playerController.Activate();
                    SwitchCurrentState(TurnManagerState.idle);
                }
            }

            break;

        case TeamTurn.enemies:

            if (enemiesToAct.Count > 0)
            {
                characterToAct = enemiesToAct.Dequeue();

                if (characterToAct != null)
                {
                    ActivateEnemy();
                }
                else
                {
                    Debug.Log("No character to act?");
                }
            }
            else
            {
                SwitchCurrentState(TurnManagerState.acting);
            }

            break;
        }
    }
Пример #4
0
    private void CheckIfAttacked()
    {
        while (enemiesToAttack.Count > 0)
        {
            CharacterBaseController enemy = enemiesToAttack.Dequeue();

            m_PlayerController.TakeDamage(enemy.attackEffect);
            instance.m_PlayerController.damageSource = enemy.displayName;
        }

        m_AttackablePlayer.CheckIfAttacked();
    }
Пример #5
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (!(collision.gameObject.tag == sourceTag) && !(collision.gameObject.tag == gameObject.tag))
     {
         if (collision.gameObject.tag == enemyTag)
         {
             CharacterBaseController enemyChar = collision.gameObject.GetComponent <CharacterBaseController>();
             if (enemyChar != null)
             {
                 enemyChar.GetDamaged(damage);
             }
         }
         if (collision.gameObject.layer == 10 || collision.gameObject.layer == 8 || collision.gameObject.layer == 11)
         {
             Destroy(gameObject);
         }
     }
 }
 private void Awake()
 {
     m_CharacterController = GetComponent <CharacterBaseController>();
 }
Пример #7
0
 virtual protected void Awake()
 {
     m_CharacterBaseController = GetComponent <CharacterBaseController>();
 }