public FsmProperty(FsmProperty source) { setProperty = source.setProperty; TargetObject = new FsmObject(source.TargetObject); TargetTypeName = source.TargetTypeName; TargetType = source.TargetType; PropertyName = source.PropertyName; PropertyType = source.PropertyType; BoolParameter = new FsmBool(source.BoolParameter); FloatParameter = new FsmFloat(source.FloatParameter); IntParameter = new FsmInt(source.IntParameter); GameObjectParameter = new FsmGameObject(source.GameObjectParameter); StringParameter = new FsmString(source.StringParameter); Vector2Parameter = new FsmVector2(source.Vector2Parameter); Vector3Parameter = new FsmVector3(source.Vector3Parameter); RectParamater = new FsmRect(source.RectParamater); QuaternionParameter = new FsmQuaternion(source.QuaternionParameter); ObjectParameter = new FsmObject(source.ObjectParameter); MaterialParameter = new FsmMaterial(source.MaterialParameter); TextureParameter = new FsmTexture(source.TextureParameter); ColorParameter = new FsmColor(source.ColorParameter); EnumParameter = new FsmEnum(source.EnumParameter); ArrayParameter = new FsmArray(source.ArrayParameter); }
public void SetVariable(NamedVariable variable) { if (variable == null) { ResetParameters(); return; } switch (variable.VariableType) { case VariableType.Float: FloatParameter = variable as FsmFloat; break; case VariableType.Int: IntParameter = variable as FsmInt; break; case VariableType.Bool: BoolParameter = variable as FsmBool; break; case VariableType.GameObject: GameObjectParameter = variable as FsmGameObject; break; case VariableType.String: StringParameter = variable as FsmString; break; case VariableType.Vector2: Vector2Parameter = variable as FsmVector2; break; case VariableType.Vector3: Vector3Parameter = variable as FsmVector3; break; case VariableType.Color: ColorParameter = variable as FsmColor; break; case VariableType.Rect: RectParamater = variable as FsmRect; break; case VariableType.Material: MaterialParameter = variable as FsmMaterial; break; case VariableType.Texture: TextureParameter = variable as FsmTexture; break; case VariableType.Quaternion: QuaternionParameter = variable as FsmQuaternion; break; case VariableType.Object: ObjectParameter = variable as FsmObject; break; case VariableType.Array: ArrayParameter = variable as FsmArray; break; case VariableType.Enum: EnumParameter = variable as FsmEnum; break; default: throw new ArgumentOutOfRangeException(); case VariableType.Unknown: break; } }
public static bool GetTargetPosition(PositionOptions option, Transform owner, FsmVector3 position, FsmGameObject target, out Vector3 targetPosition) { targetPosition = Vector3.zero; if (owner == null || !IsValidTargetPosition(option, position, target)) { return(false); } targetPosition = GetTargetPosition(option, owner, (target != null && target.Value != null) ? target.Value.transform : null, position.Value); return(true); }
public static bool GetTargetRotation(RotationOptions option, Transform owner, FsmVector3 rotation, FsmGameObject target, out Quaternion targetRotation) { targetRotation = Quaternion.identity; if (owner == null || !CanEditTargetRotation(option, rotation, target)) { return(false); } targetRotation = GetTargetRotation(option, owner, target.Value != null ? target.Value.transform : null, rotation.Value); return(true); }