Esempio n. 1
0
    protected void PlaceBomb()
    {
        if (ActiveBombCount == MaxBombCount)
        {
            return;
        }

        var bombGameObject = Instantiate(Bomb, transform.position, Quaternion.identity);
        var bomb           = bombGameObject.GetComponent <Bomb>();

        bomb.OwningPlayer = gameObject;
        bomb.Exploded    += BombOnExploded;

        BombPlaced?.Invoke(this, bombGameObject);

        ActiveBombCount += 1;
    }
Esempio n. 2
0
    public static bool PlaceBombAt(int x, int y, Pawn owner)
    {
        // check that no bomb has already been placed here
        foreach (var other in m_bombs)
        {
            if (other.GetMapX() == x && other.GetMapY() == y)
            {
                return(false);
            }
        }

        // create and configure new bomb
        var bomb = m_root.CreateBomb(x, y);

        bomb.SetOwner(owner);
        bomb.SetRange(owner.BombRange);

        m_bombs.Add(bomb);
        BombPlaced?.Invoke(bomb, owner);
        return(true);
    }