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 Stats Modifier: No target defined");
                return(true);
            }

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

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

            switch (this.operation)
            {
            case Operation.Add: stats.AddStatModifier(this.statModifier); break;

            case Operation.Remove: stats.RemoveStatModifier(this.statModifier); break;
            }

            return(true);
        }