public override void Apply(SetOperator setOperator, int value) { switch (setOperator) { case SetOperator.Assign: Value = value; break; case SetOperator.Add: Value += value; break; case SetOperator.Subtract: Value -= value; break; case SetOperator.Multiply: Value *= value; break; case SetOperator.Divide: Value /= value; break; default: Debug.LogError("The " + setOperator.ToString() + " set operator is not valid."); break; } }
public virtual void Apply(SetOperator setOperator, T value) { switch (setOperator) { case SetOperator.Assign: Value = value; break; default: Debug.LogError("The " + setOperator.ToString() + " set operator is not valid."); break; } }
public override void Apply(SetOperator setOperator, AudioSource value) { switch (setOperator) { case SetOperator.Assign: Value = value; break; default: Debug.LogError("The " + setOperator.ToString() + " set operator is not valid."); break; } }
// 支持的操作 // * 赋值 // * 取反 public override void Apply(SetOperator setOperator, bool value) { switch (setOperator) { // 赋值 case SetOperator.Assign: Value = value; break; // 赋值,取反 case SetOperator.Negate: Value = !value; break; default: Debug.LogError("The " + setOperator.ToString() + " set operator is not valid."); break; } }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0}, ", Group); switch (Group) { case Group.Branch: switch (SubGroupBranch) { case GroupBranch.Goto: sb.AppendFormat("{0}, {1}", BranchOptionsGoto.ToString(), PrintOperands()); break; case GroupBranch.Jump: sb.AppendFormat("{0}, {1}", BranchOptionsJump.ToString(), PrintOperands()); break; case GroupBranch.Play: sb.AppendFormat("{0}, {1}", BranchOptionsPlay.ToString(), PrintOperands()); break; default: sb.Append("???, "); break; } break; case Group.Compare: sb.AppendFormat("{0}, {1}", CompareOperator.ToString(), PrintOperands()); break; case Group.Set: switch (SubGroupSet) { case GroupSet.Set: sb.AppendFormat("{0}, {1}", SetOperator.ToString(), PrintOperands()); break; case GroupSet.SetSystem: sb.AppendFormat("{0}, {1}", SetOperator.ToString(), PrintOperands()); break; default: sb.Append("???, "); break; } break; } return(sb.ToString()); }