Пример #1
0
        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            if (ammo == null)
            {
                return(true);
            }

            CharacterShooter charShooter = this.shooter.GetComponent <CharacterShooter>(target);

            if (!charShooter)
            {
                Debug.LogError("Target Game Object does not have a CharacterShooter component");
                return(true);
            }

            switch (this.operation)
            {
            case Operation.Add:
                charShooter.AddAmmoToStorage(this.ammo.ammoID, this.amount.GetInt(target));
                break;

            case Operation.Set:
                charShooter.SetAmmoToStorage(this.ammo.ammoID, this.amount.GetInt(target));
                break;
            }

            return(true);
        }