// EXECUTABLE: ---------------------------------------------------------------------------- public override bool InstantExecute(GameObject target, IAction[] actions, int index) { if (this.attribute != null) { Stats componentTarget = this.target.GetGameObject(target).GetComponentInChildren <Stats>(); if (componentTarget == null) { return(true); } string id = this.attribute.attribute.uniqueName; float value = 0.0f; switch (this.valueType) { case ValueType.Value: value = this.amount.GetValue(target); break; case ValueType.Formula: Stats componentOther = this.opponent.GetGameObject(target).GetComponentInChildren <Stats>(); value = this.formula.formula.Calculate(0.0f, componentTarget, componentOther); break; } switch (this.operation) { case Operation.Set: componentTarget.SetAttrValue(id, value); break; case Operation.Add: componentTarget.AddAttrValue(id, value); break; case Operation.Subtract: componentTarget.AddAttrValue(id, -value); break; case Operation.Multiply: componentTarget.MultiplyAttrValue(id, value); break; case Operation.Divide: componentTarget.MultiplyAttrValue(id, (1f / value)); break; } } return(true); }