Пример #1
0
    public bool TryFire()
    {
        if (!HasShot)       // Won't shoot if has "no ammo"
        {
            return(false);
        }

        if (!cannon.Fire())
        {
            return(false);
        }

        return(true);
    }
Пример #2
0
    /// <summary>
    /// Shots or not according to game mechanics constraints
    /// </summary>
    public bool TryFire()
    {
        if (!isMoving)      // Won't shoot if not moving
        {
            return(false);
        }
        if (!HasShot)       // Won't shoot if has "no ammo"
        {
            return(false);
        }

        if (!cannon.Fire())
        {
            return(false);
        }

        hasShot = false;
        return(true);
    }