예제 #1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="target"></param>
    public void Fire(GameObject target)
    {
        Interactable interactable = target.GetComponent <Interactable>();

        if (interactable)
        {
            if (interactable.IsShootableAnytime()) // menu interactables
            {
                interactable.OnInteract();         // shoot but don't decrease ammo
            }
            else if (UmpireControl.isGameStarted)  // game interactables
            {
                if (m_ammunition.CanFire())        // does the player have ammo?
                {
                    interactable.OnInteract();     // shoot
                    m_ammunition.Fire();           // and decrease ammo
                }
            }
            else
            {
                return;
            }
        }
    }