public void Update(object value) { switch ((DataType)this.type) { case DataType.String: this.varStr = new VariableStr((string)value); break; case DataType.Number: this.varNum = new VariableNum((float)value); break; case DataType.Bool: this.varBol = new VariableBol((bool)value); break; case DataType.Color: this.varCol = new VariableCol((Color)value); break; case DataType.Vector2: this.varVc2 = new VariableVc2((Vector2)value); break; case DataType.Vector3: this.varVc3 = new VariableVc3((Vector3)value); break; case DataType.Texture2D: this.varTxt = new VariableTxt((Texture2D)value); break; case DataType.Sprite: this.varSpr = new VariableSpr((Sprite)value); break; case DataType.GameObject: this.varObj = new VariableObj((GameObject)value); break; case DataType.Transform: this.varTrn = new VariableTrn((Transform)value); break; case DataType.Rigidbody: this.varRbd = new VariableRbd((Rigidbody)value); break; } }
public Variable(Variable variable) { this.name = variable.name; this.type = variable.type; this.save = variable.save; this.varStr = variable.varStr; this.varNum = variable.varNum; this.varBol = variable.varBol; this.varCol = variable.varCol; this.varVc2 = variable.varVc2; this.varVc3 = variable.varVc3; this.varTxt = variable.varTxt; this.varSpr = variable.varSpr; this.varObj = variable.varObj; this.varTrn = variable.varTrn; this.varRbd = variable.varRbd; }