Example #1
0
    public bool TryFire()
    {
        var fire = RevolverLogic.Fire();

        Barret.text = (RevolverLogic.GetCurrentBarrelId() + 1).ToString();
        Result.text = fire ? "BOOM" : "Lucky";
        if (fire)
        {
            FireStateController.BarabanController.GetCurrentPatron().gameObject.SetActive(false);
            SoundController.runtime.PlaySound("FireSpusk");
            var instantiate = Instantiate(fireEffect);
            instantiate.parent           = Fire;
            instantiate.localEulerAngles = new Vector3(0, 0, 0);
            instantiate.localPosition    = new Vector3(0, 0, 0);
            ViewLoaded();

            if (GameEndedAction != null)
            {
                GameEndedAction(RevolverLogic.GetLoadedPatronsWithId().Count == 0);
            }
        }

        if (OnTryFired != null)
        {
            OnTryFired();
        }

        return(fire);
    }