Esempio n. 1
0
    bool Attack()
    {
        bool        attacked = false;
        List <Tile> tileList = new List <Tile>();

        foreach (KeyValuePair <int, int> pair in m_Inventory.GetAttackPattern(m_MovementDirection))
        {
            tileList.Add(GetTileFromPair(pair, m_CurrentTile));
        }

        foreach (Tile tile in tileList)
        {
            AboveTileObject enemy = tile.Contains <Enemy>();
            if (enemy != null)
            {
                attacked = true;
                SoundManager.instance.PlaySound("sound_effect", "player_hit");
                SoundManager.instance.PlaySound("player", "mele");
                m_PlayerAnimation.AttackAnimation(m_MovementDirection);
                enemy.GetComponent <Enemy>().DestroyEnemy();
            }
        }

        return(attacked);
    }