Пример #1
0
    void UpdateWeapon()
    {
        if (m_input.fire)
        {
            if (KartState.UsingWeapon)
            {
                KartState.UsingWeapon.Activate();
            }
            else if (WeaponPrefab.Count > 0)
            {
                GameObject weaponGo = WeaponPrefab[0];
                WeaponPrefab.RemoveAt(0);
                weaponGo = Instantiate(weaponGo);
                WeaponBehavior wb = weaponGo.GetComponent <WeaponBehavior>();
                wb.Owner = this;
                wb.Initialize(this);

                if (WeaponPrefab.Count == 0)
                {
                    UIPlayerManager.HideWeapon();
                    KartState.IsArmed = false;
                }
                else
                {
                    UIPlayerManager.DecrementWeaponText();
                }
            }
        }
    }