示例#1
0
    public bool AttackTile(GameObject tile)
    {
        if (tile == null)
        {
            return(false);
        }
        TileClass tc = tile.GetComponent <TileClass>();

        if (tc != null)
        {
            if (tc.entity != null)
            {
                // Check if the entity on the tile is a character
                CharacterClass cc = tc.entity.GetComponent <CharacterClass>();
                if (cc != null && (tc.entity.tag == "P1" || tc.entity.tag == "P2" || tc.entity.tag == "Character"))
                {
                    cc.Die();
                    return(true);
                }
            }
        }
        return(false);
    }