コード例 #1
0
    public void DamageMushroomAtPosition(IntVector2 position, int damage)
    {
        Mushroom mushroom = _mushroomsList.Find(mushRoom => mushRoom.GetCellPosition() == position);

        if (mushroom == null)
        {
            Debug.LogError("Mushroom not found === ");
            return;
        }

        bool isDead = mushroom.Damage(damage);

        if (isDead)
        {
            _mushroomsList.Remove(mushroom);
            _levelManager.ClearCell(position);
            _scoreManager.Score += 10;
        }
    }