Пример #1
0
    public override void Use(object o)
    {
        Actor shooter = null;

        try{
            shooter = (Actor)o;
        }
        catch (Exception e) {
            Debug.LogError("The shooter is null");
            return;
        }

        if (shooter == null)
        {
            return;
        }

        if (loadedMagazine)
        {
            if (chamberedProjectile)
            {
                chamberedProjectile.Shoot(transform.up, shooter);
            }
            else
            {
                Chamber(loadedMagazine.Cycle(this));
                if (chamberedProjectile)
                {
                    chamberedProjectile.Shoot(transform.up, shooter);
                    FireEffects();
                }
            }
        }
        else
        {
            Debug.Log("There is no loaded Magazine");
        }
    }