Ejemplo n.º 1
0
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            GameObject targetGO = this.target.GetGameObject(target);

            if (targetGO == null)
            {
                Debug.LogError("Action Status Effect: No target defined");
                return(true);
            }

            Stats stats = targetGO.GetComponentInChildren <Stats>();

            if (stats == null)
            {
                Debug.LogError("Action Status Effect: Could not get Stats component in target");
                return(true);
            }

            switch (this.operation)
            {
            case Operation.Add: stats.AddStatusEffect(this.statusEffect); break;

            case Operation.Remove: stats.RemoveStatusEffect(this.statusEffect); break;

            case Operation.RemoveAll:
                stats.RemoveStatusEffect(StatusEffect.Type.Positive);
                stats.RemoveStatusEffect(StatusEffect.Type.Negative);
                stats.RemoveStatusEffect(StatusEffect.Type.Other);
                break;

            case Operation.RemovePositives:
                stats.RemoveStatusEffect(StatusEffect.Type.Positive);
                break;

            case Operation.RemoveNegatives:
                stats.RemoveStatusEffect(StatusEffect.Type.Negative);
                break;

            case Operation.RemoveOthers:
                stats.RemoveStatusEffect(StatusEffect.Type.Other);
                break;
            }

            return(true);
        }