protected override void InitGDE() { FsmVariables vars = PlayMakerGlobals.Instance.Variables; if (isGDEInitialized == null) isGDEInitialized = vars.GetVariable("gde_initialized") as FsmBool; if (isGDEInitialized != null && isGDEInitialized.Value == true) { single_bool = vars.GetVariable("single_bool") as FsmBool; single_custom_bool = vars.GetVariable("single_custom_bool") as FsmBool; single_float = vars.GetVariable("single_float") as FsmFloat; single_custom_float = vars.GetVariable("single_custom_float") as FsmFloat; single_int = vars.GetVariable("single_int") as FsmInt; single_custom_int = vars.GetVariable("single_custom_int") as FsmInt; single_string = vars.GetVariable("single_string") as FsmString; single_custom_string = vars.GetVariable("single_custom_string") as FsmString; single_custom = vars.GetVariable("single_custom") as FsmString; single_vec2 = vars.GetVariable("single_vector2") as FsmVector2; single_custom_vec2 = vars.GetVariable("single_custom_vector2") as FsmVector2; single_vec3 = vars.GetVariable("single_vector3") as FsmVector3; single_custom_vec3 = vars.GetVariable("single_custom_vector3") as FsmVector3; single_color = vars.GetVariable("single_color") as FsmColor; single_custom_color = vars.GetVariable("single_custom_color") as FsmColor; } }
public override void Reset() { this.substanceMaterial = null; this.colorProperty = string.Empty; this.colorValue = Color.white; this.everyFrame = false; }
public override void Reset() { gameObject = null; selectionColor = null; resetOnExit = null; everyFrame = false; }
public override void Reset() { gameObject = null; color = null; everyFrame =false; }
public override void Reset() { color = null; colorString = null; everyFrame = false; }
public override void Reset() { normalColor = null; resetOnExit = false; everyFrame = false; enabled = true; }
public override void Reset() { substanceMaterial = null; colorProperty = ""; colorValue = Color.white; everyFrame = false; }
public override void Reset() { fromObject = new FsmGameObject { UseVariable = true} ; fromPosition = new FsmVector3 { UseVariable = true}; direction = new FsmVector3 { UseVariable = true}; color = Color.white; }
public override void Reset() { colors = new FsmColor[3]; sampleAt = 0; storeColor = null; everyFrame = false; }
public override void Reset (){ base.Reset(); colorVariable = null; fromValue = null; toValue = null; finishInNextStep = false; }
void DrawPath(NavMeshPath path) { if (path.corners.Length < 2) return; switch (path.status) { case NavMeshPathStatus.PathComplete: c = Color.white; break; case NavMeshPathStatus.PathInvalid: c = Color.red; break; case NavMeshPathStatus.PathPartial: c = Color.yellow; break; } Vector3 previousCorner = path.corners[0]; int i = 1; while (i < path.corners.Length) { Vector3 currentCorner = path.corners[i]; Debug.DrawLine(previousCorner, currentCorner, c); previousCorner = currentCorner; i++; } }
public override void Reset() { NGUIGameObject = null; text = null; color = null; duration = 0f; }
public override void Reset() { boolVariable = null; colorVariable = null; falseColor = Color.black; trueColor = Color.white; everyFrame = false; }
public override void Reset() { gameObject = null; shape = ShapeType.Sphere; color = Color.grey; radius = 1f; size = new Vector3(1f, 1f, 1f); }
public override void Reset() { moviePath = ""; fadeColor = Color.black; movieControlMode = FullScreenMovieControlMode.Full; movieScalingMode = FullScreenMovieScalingMode.AspectFit; }
public override void Reset() { texture = null; center = null; radius = 1; color = Color.red; everyFrame = false; }
public override void Reset() { base.Reset(); colorVariable = new FsmColor{UseVariable=true}; toValue = new FsmColor{UseVariable=true}; fromValue = new FsmColor{UseVariable=true}; }
public override void Reset() { color = null; format = "Color([r],[g],[b],[a])"; use32BitColor = true; storeResult = null; everyFrame = false; }
public override void Reset() { this.boolVariable = null; this.colorVariable = null; this.falseColor = Color.black; this.trueColor = Color.white; this.everyFrame = false; }
public override void Reset() { colors = new FsmColor[3]; time = 1.0f; storeColor = null; finishEvent = null; realTime = false; }
public override void Reset() { gameObject = null; materialIndex = 0; namedColor = "_Color"; color = Color.black; everyFrame = false; }
public override void Reset() { gameObject = null; targetObject = null; debug = false; debugLineColor = Color.green; everyFrame = true; }
public override void Reset() { gameObject = null; mainColor = null; gradientColor = null; useGradient = false; commit = true; everyframe = false; }
public override void Reset() { gameObject = null; materialIndex = 0; material = null; namedColor = "_Color"; color = null; fail = null; }
public override void Reset() { color = null; storeRed = null; storeGreen = null; storeBlue = null; storeAlpha = null; everyFrame = false; }
public override void Reset() { this.colorVariable = null; this.red = 0f; this.green = 0f; this.blue = 0f; this.alpha = 1f; this.everyFrame = false; }
public override void Reset() { textVal = null; floatVal = null; intVal = null; c = null; stayDuration = null; }
public override void Reset() { gameObject = null; vector2Target = null; vector3Target = new FsmVector3() {UseVariable=true}; debug = false; debugLineColor = Color.green; everyFrame = true; }
public override void Reset() { gameObject = null; targetObject = null; targetPosition = new FsmVector3 { UseVariable = true}; upVector = new FsmVector3 { UseVariable = true}; keepVertical = true; debug = false; debugLineColor = Color.yellow; everyFrame = true; }
public override void Reset() { gameObject = null; materialIndex = 0; namedColor = "_Color"; color = Color.black; affectAllHierarchy = true; revertOnExit = true; everyFrame = false; }
public override void Reset() { fogColor = Color.white; everyFrame = false; }
public override void Reset() { base.Reset(); tileColor = Color.white; }
public override void Reset() { gameObject = null; lightColor = Color.white; everyFrame = false; }
public override void Reset() { color = Color.white; }
public override void Reset() { base.Reset(); gameObject = null; duration = new FsmFloat { UseVariable = false }; setSpeedBased = new FsmBool { UseVariable = false, Value = false }; pathType = PathType.Linear; pathMode = PathMode.Full3D; resolution = new FsmInt { UseVariable = false, Value = 10 }; gizmoColor = new FsmColor { UseVariable = false }; closePath = new FsmBool { UseVariable = false, Value = false }; lockPosition = AxisConstraint.None; lockRotation = AxisConstraint.None; lookAt = LookAt.nothing; lookAtPosition = new FsmVector3 { UseVariable = false, Value = Vector3.zero }; lookAtTarget = new FsmGameObject { UseVariable = false, Value = null }; lookAhead = new FsmFloat { UseVariable = false, Value = 0 }; forwardDirection = new FsmVector3 { UseVariable = false, Value = Vector3.forward }; up = new FsmVector3 { UseVariable = false, Value = Vector3.up }; startEvent = null; finishEvent = null; finishImmediately = new FsmBool { UseVariable = false, Value = false }; startDelay = new FsmFloat { Value = 0 }; easeType = Ease.Linear; loops = new FsmInt { Value = 0 }; loopType = LoopType.Restart; autoKillOnCompletion = new FsmBool { Value = true }; recyclable = new FsmBool { Value = false }; updateType = UpdateType.Normal; isIndependentUpdate = new FsmBool { Value = false }; debugThis = new FsmBool { Value = false }; }
public override void Reset() { base.Reset(); gameObject = null; startValue_color_1 = new FsmColor { UseVariable = false }; startValue_color_2 = new FsmColor { UseVariable = false }; endValue_color_1 = new FsmColor { UseVariable = false }; endValue_color_2 = new FsmColor { UseVariable = false }; duration = new FsmFloat { UseVariable = false }; setSpeedBased = new FsmBool { UseVariable = false, Value = false }; setRelative = new FsmBool { UseVariable = false, Value = false }; playInReverse = new FsmBool { UseVariable = false, Value = false }; setReverseRelative = new FsmBool { UseVariable = false, Value = false }; startEvent = null; finishEvent = null; finishImmediately = new FsmBool { UseVariable = false, Value = false }; stringAsId = new FsmString { UseVariable = false }; tagAsId = new FsmString { UseVariable = false }; startDelay = new FsmFloat { Value = 0 }; selectedEase = DOTweenActionsEnums.SelectedEase.EaseType; easeType = Ease.Linear; loops = new FsmInt { Value = 0 }; loopType = LoopType.Restart; autoKillOnCompletion = new FsmBool { Value = true }; recyclable = new FsmBool { Value = false }; updateType = UpdateType.Normal; isIndependentUpdate = new FsmBool { Value = false }; debugThis = new FsmBool { Value = false }; }
public override void Reset() { ambientEquatorColor = null; }
public override void Reset() { color = Color.black; }
public override void Reset() { base.Reset(); ColorValue = null; }
public override void Reset() { backgroundColor = Color.white; }
public static object GetFsmObject(this ActionData actionData, int index, int dataVersion) { BinaryReader r = new BinaryReader(new MemoryStream(actionData.byteData.ToArray())); //string actionName = actionData.actionNames[index]; ParamDataType paramDataType = actionData.paramDataType[index]; int paramDataPos = actionData.paramDataPos[index]; int paramByteDataSize = actionData.paramByteDataSize[index]; r.BaseStream.Position = paramDataPos; object ret; switch (paramDataType) { case ParamDataType.Integer: ret = r.ReadInt32(); break; case ParamDataType.FsmInt when dataVersion == 1: ret = new FsmInt() { value = r.ReadInt32() }; break; case ParamDataType.Enum: ret = r.ReadInt32(); //ret = ((Enum)AssemblyHelper.GetPublicFields(typeDef)[index])[ret]; break; case ParamDataType.Boolean: ret = r.ReadBoolean(); break; case ParamDataType.FsmBool when dataVersion == 1: ret = new FsmBool { value = r.ReadBoolean() }; break; case ParamDataType.Float: ret = r.ReadSingle(); break; case ParamDataType.FsmFloat when dataVersion == 1: ret = new FsmFloat { value = r.ReadSingle() }; break; case ParamDataType.String: ret = Encoding.UTF8.GetString(r.ReadBytes(paramByteDataSize)); break; case ParamDataType.FsmEvent when dataVersion == 1: ret = new FsmEvent { name = Encoding.UTF8.GetString(r.ReadBytes(paramByteDataSize)) }; break; case ParamDataType.Vector2: ret = new Vector2 { x = r.ReadSingle(), y = r.ReadSingle() }; break; case ParamDataType.FsmVector2 when dataVersion == 1: ret = new FsmVector2 { value = new Vector2 { x = r.ReadSingle(), y = r.ReadSingle() } }; break; case ParamDataType.Vector3: ret = new Vector3 { x = r.ReadSingle(), y = r.ReadSingle(), z = r.ReadSingle() }; break; case ParamDataType.FsmVector3 when dataVersion == 1: ret = new FsmVector3 { value = new Vector3 { x = r.ReadSingle(), y = r.ReadSingle(), z = r.ReadSingle() } }; break; case ParamDataType.Quaternion: ret = new Quaternion { x = r.ReadSingle(), y = r.ReadSingle(), z = r.ReadSingle(), w = r.ReadSingle() }; break; case ParamDataType.FsmQuaternion when dataVersion == 1: ret = new FsmQuaternion { value = new Quaternion { x = r.ReadSingle(), y = r.ReadSingle(), z = r.ReadSingle(), w = r.ReadSingle() } }; break; case ParamDataType.Color: ret = new UnityColor { r = r.ReadSingle(), g = r.ReadSingle(), b = r.ReadSingle(), a = r.ReadSingle() }; break; case ParamDataType.FsmColor when dataVersion == 1: ret = new FsmColor { value = new UnityColor { r = r.ReadSingle(), g = r.ReadSingle(), b = r.ReadSingle(), a = r.ReadSingle() } }; break; case ParamDataType.Rect: ret = new UnityRect { x = r.ReadSingle(), y = r.ReadSingle(), width = r.ReadSingle(), height = r.ReadSingle() }; break; case ParamDataType.FsmRect when dataVersion == 1: ret = new FsmRect { value = new UnityRect { x = r.ReadSingle(), y = r.ReadSingle(), width = r.ReadSingle(), height = r.ReadSingle() } }; break; ///////////////////////////////////////////////////////// case ParamDataType.FsmEnum when dataVersion > 1: ret = actionData.fsmEnumParams[paramDataPos]; break; case ParamDataType.FsmBool when dataVersion > 1: ret = actionData.fsmBoolParams[paramDataPos]; break; case ParamDataType.FsmInt when dataVersion > 1: ret = actionData.fsmIntParams[paramDataPos]; break; case ParamDataType.FsmFloat when dataVersion > 1: ret = actionData.fsmFloatParams[paramDataPos]; break; case ParamDataType.FsmVector2 when dataVersion > 1: ret = actionData.fsmVector2Params[paramDataPos]; break; case ParamDataType.FsmVector3 when dataVersion > 1: ret = actionData.fsmVector3Params[paramDataPos]; break; case ParamDataType.FsmQuaternion when dataVersion > 1: ret = actionData.fsmQuaternionParams[paramDataPos]; break; case ParamDataType.FsmColor when dataVersion > 1: ret = actionData.fsmColorParams[paramDataPos]; break; case ParamDataType.FsmRect when dataVersion > 1: ret = actionData.fsmRectParams[paramDataPos]; break; ///////////////////////////////////////////////////////// case ParamDataType.FsmGameObject: ret = actionData.fsmGameObjectParams[paramDataPos]; break; case ParamDataType.FsmOwnerDefault: ret = actionData.fsmOwnerDefaultParams[paramDataPos]; break; case ParamDataType.FsmObject: ret = actionData.fsmObjectParams[paramDataPos]; break; case ParamDataType.FsmVar: ret = actionData.fsmVarParams[paramDataPos]; break; case ParamDataType.FsmString: ret = actionData.fsmStringParams[paramDataPos]; break; case ParamDataType.FsmEvent: ret = actionData.stringParams[paramDataPos]; break; case ParamDataType.FsmEventTarget: ret = actionData.fsmEventTargetParams[paramDataPos]; break; case ParamDataType.FsmArray: ret = actionData.fsmArrayParams[paramDataPos]; break; case ParamDataType.ObjectReference: ret = $"ObjRef([{actionData.unityObjectParams[paramDataPos]}])"; break; case ParamDataType.FunctionCall: ret = actionData.functionCallParams[paramDataPos]; break; case ParamDataType.Array: ret = "[Array]"; break; default: ret = $"[{paramDataType.ToString()} not implemented]"; break; } if (dataVersion == 1 && ret is NamedVariable nv) { switch (paramDataType) { case ParamDataType.FsmInt: case ParamDataType.FsmBool: case ParamDataType.FsmFloat: case ParamDataType.FsmVector2: case ParamDataType.FsmVector3: case ParamDataType.FsmQuaternion: case ParamDataType.FsmColor: nv.useVariable = r.ReadBoolean(); int nameLength = paramByteDataSize - ((int)r.BaseStream.Position - paramDataPos); nv.name = Encoding.UTF8.GetString(r.ReadBytes(nameLength)); break; } } return(ret); }
public override void Reset() { colors = new FsmColor[3]; weights = new FsmFloat[] { 1, 1, 1 }; storeColor = null; }
public override void Reset() { includeAlpha = false; storeResult = null; }
public override void Reset() { gameObject = null; color = Color.white; }
public override void Reset() { gameObject = null; color = null; everyFrame = false; }
public static bool ApplyValueToFsmVar(Fsm fromFsm, FsmVar fsmVar, object value) { if (fromFsm == null) { return(false); } if (fsmVar == null) { return(false); } System.Type valueType = value.GetType(); //Debug.Log("valueType "+valueType); System.Type storageType = null; //Debug.Log("fsmVar type "+fsmVar.Type); switch (fsmVar.Type) { case VariableType.Int: storageType = typeof(int); break; case VariableType.Float: storageType = typeof(float); break; case VariableType.Bool: storageType = typeof(bool); break; case VariableType.Color: storageType = typeof(Color); break; case VariableType.GameObject: storageType = typeof(GameObject); break; case VariableType.Quaternion: storageType = typeof(Quaternion); break; case VariableType.Rect: storageType = typeof(Rect); break; case VariableType.String: storageType = typeof(string); break; case VariableType.Texture: storageType = typeof(Texture2D); break; case VariableType.Vector2: storageType = typeof(Vector2); break; case VariableType.Vector3: storageType = typeof(Vector3); break; case VariableType.Object: storageType = typeof(Object); break; case VariableType.Material: storageType = typeof(Material); break; } if (!storageType.Equals(valueType)) { if (valueType.Equals(typeof(ProceduralMaterial))) { // we are still ok. } else { Debug.LogError("The fsmVar value <" + storageType + "> doesn't match the value <" + valueType + ">"); return(false); } } if (valueType == typeof(bool)) { FsmBool _target = fromFsm.Variables.GetFsmBool(fsmVar.variableName); _target.Value = (bool)value; } else if (valueType == typeof(Color)) { FsmColor _target = fromFsm.Variables.GetFsmColor(fsmVar.variableName); _target.Value = (Color)value; } else if (valueType == typeof(int)) { FsmInt _target = fromFsm.Variables.GetFsmInt(fsmVar.variableName); _target.Value = (int)value; } else if (valueType == typeof(float)) { FsmFloat _target = fromFsm.Variables.GetFsmFloat(fsmVar.variableName); _target.Value = (float)value; } else if (valueType == typeof(GameObject)) { FsmGameObject _target = fromFsm.Variables.GetFsmGameObject(fsmVar.variableName); _target.Value = (GameObject)value; } else if (valueType == typeof(Material)) { FsmMaterial _target = fromFsm.Variables.GetFsmMaterial(fsmVar.variableName); _target.Value = (Material)value; } else if (valueType == typeof(ProceduralMaterial)) { FsmMaterial _target = fromFsm.Variables.GetFsmMaterial(fsmVar.variableName); _target.Value = (ProceduralMaterial)value; } else if (valueType == typeof(Object)) { FsmObject _target = fromFsm.Variables.GetFsmObject(fsmVar.variableName); _target.Value = (Object)value; } else if (valueType == typeof(Quaternion)) { FsmQuaternion _target = fromFsm.Variables.GetFsmQuaternion(fsmVar.variableName); _target.Value = (Quaternion)value; } else if (valueType == typeof(Rect)) { FsmRect _target = fromFsm.Variables.GetFsmRect(fsmVar.variableName); _target.Value = (Rect)value; } else if (valueType == typeof(string)) { FsmString _target = fromFsm.Variables.GetFsmString(fsmVar.variableName); _target.Value = (string)value; } else if (valueType == typeof(Texture2D)) { FsmTexture _target = fromFsm.Variables.GetFsmTexture(fsmVar.variableName); _target.Value = (Texture2D)value; } else if (valueType == typeof(Vector2)) { FsmVector2 _target = fromFsm.Variables.GetFsmVector2(fsmVar.variableName); _target.Value = (Vector2)value; } else if (valueType == typeof(Vector3)) { FsmVector3 _target = fromFsm.Variables.GetFsmVector3(fsmVar.variableName); _target.Value = (Vector3)value; } else { Debug.LogWarning("?!?!" + valueType); // don't know, should I put in FsmObject? } return(true); }
public override void Reset() { Color = null; base.Reset(); }
public override void Reset() { colorVariable = null; color = null; everyFrame = false; }
public void ArrayDelete() { if (sortOn & nullOn) { proxy.arrayList.Sort(); } var varTemp = proxy.preFillType.ToString(); atIndex = -1; atIndex_iplus = 0; for (int a = 0; a < c; a++) { atIndex++; atIndex_iplus = atIndex; for (int i = 0; i < c; i++) { IGNORE: if (restartbool) { atIndex_iplus = atIndex; restartbool = false; } atIndex_iplus++; if (atIndex_iplus == c) { break; } bool elementContained = false; object element = null; object element_b = null; try{ element = proxy.arrayList[atIndex]; element_b = proxy.arrayList[atIndex_iplus]; }catch (System.Exception e) { Debug.Log(e.Message); string fullLabel = Fsm.GetFullFsmLabel(this.Fsm); string name = Fsm.ActiveStateName; Debug.Log("Fsm Path= " + fullLabel + " : " + name); Fsm.Event(failureEvent); return; } if (element == null) { break; } if (element_b == null) { goto IGNORE; } switch (varTemp) { case "Int": FsmInt fsmVarI = System.Convert.ToInt32(element); int tempInt = System.Convert.ToInt32(element_b); elementContained = fsmVarI.Value == tempInt; break; case "Float": FsmFloat fsmVarF = (float)element; float tempFloat = (float)(element_b); elementContained = fsmVarF.Value == tempFloat; break; case "Bool": FsmBool fsmVarB = (bool)element; bool tempBool = (bool)(element_b); elementContained = fsmVarB.Value == tempBool; break; case "Color": FsmColor fsmVarC = (Color)element; Color tempColor = (Color)(element_b); elementContained = fsmVarC.Value == tempColor; break; case "Quaternion": FsmQuaternion fsmVarQ = (Quaternion)element; Quaternion tempQuaternion = (Quaternion)(element_b); elementContained = fsmVarQ.Value == tempQuaternion; break; case "Rect": FsmRect fsmVarR = (Rect)element; Rect tempRect = (Rect)(element_b); elementContained = fsmVarR.Value == tempRect; break; case "Vector2": FsmVector2 fsmVarV2 = (Vector2)element; Vector2 tempV2 = (Vector2)(element_b); elementContained = fsmVarV2.Value == tempV2; break; case "Vector3": FsmVector3 fsmVarV3 = (Vector3)element; Vector3 tempV3 = (Vector3)(element_b); elementContained = fsmVarV3.Value == tempV3; break; case "String": FsmString fsmVarString = (string)element; string tempString = (string)(element_b); elementContained = fsmVarString.Value == tempString; break; case "GameObject": FsmGameObject fsmVarGameObject = (GameObject)element; GameObject tempGameObject = (GameObject)(element_b); elementContained = fsmVarGameObject.Value == tempGameObject; break; case "Material": Material fsmVarMaterial = (Material)element; Material tempMaterial = (Material)(element_b); elementContained = fsmVarMaterial == tempMaterial; break; case "Texture": Texture fsmVarTexture = (Texture)element; Texture tempTexture = (Texture)(element_b); elementContained = fsmVarTexture == tempTexture; break; case "AudioClip": var fsmVarUnknown = element; var tempUnknown = element_b; elementContained = fsmVarUnknown == tempUnknown; break; default: Debug.Log("ERROR"); break; } if (elementContained) { if (!nullOn) { proxy.arrayList.RemoveAt(atIndex_iplus); } else { element_b = PlayMakerUtils.GetValueFromFsmVar(this.Fsm, null); proxy.arrayList[atIndex_iplus] = element_b; } i = 0; c = proxy.arrayList.Count; restartbool = true; } } } Finish(); }
public override void Reset() { gameObject = null; backgroundColor = Color.black; everyFrame = false; }
public override void Reset() { ambientEquatorColor = null; everyFrame = false; }
public override void Reset() { color = Color.black; time = 1.0f; finishEvent = null; }
public override void Reset() { base.Reset(); clearColor = Color.white; }
public static bool ApplyValueToFsmVar(Fsm fromFsm, FsmVar fsmVar, object value) { if (fromFsm == null) { return(false); } if (fsmVar == null) { return(false); } if (value == null) { if (fsmVar.Type == VariableType.Bool) { FsmBool _target = fromFsm.Variables.GetFsmBool(fsmVar.variableName); _target.Value = false; } else if (fsmVar.Type == VariableType.Color) { FsmColor _target = fromFsm.Variables.GetFsmColor(fsmVar.variableName); _target.Value = Color.black; } else if (fsmVar.Type == VariableType.Int) { FsmInt _target = fromFsm.Variables.GetFsmInt(fsmVar.variableName); _target.Value = 0; } else if (fsmVar.Type == VariableType.Float) { FsmFloat _target = fromFsm.Variables.GetFsmFloat(fsmVar.variableName); _target.Value = 0f; } else if (fsmVar.Type == VariableType.GameObject) { FsmGameObject _target = fromFsm.Variables.GetFsmGameObject(fsmVar.variableName); _target.Value = null; } else if (fsmVar.Type == VariableType.Material) { FsmMaterial _target = fromFsm.Variables.GetFsmMaterial(fsmVar.variableName); _target.Value = null; } else if (fsmVar.Type == VariableType.Object) { FsmObject _target = fromFsm.Variables.GetFsmObject(fsmVar.variableName); _target.Value = null; } else if (fsmVar.Type == VariableType.Quaternion) { FsmQuaternion _target = fromFsm.Variables.GetFsmQuaternion(fsmVar.variableName); _target.Value = Quaternion.identity; } else if (fsmVar.Type == VariableType.Rect) { FsmRect _target = fromFsm.Variables.GetFsmRect(fsmVar.variableName); _target.Value = new Rect(0, 0, 0, 0); } else if (fsmVar.Type == VariableType.String) { FsmString _target = fromFsm.Variables.GetFsmString(fsmVar.variableName); _target.Value = ""; } else if (fsmVar.Type == VariableType.String) { FsmTexture _target = fromFsm.Variables.GetFsmTexture(fsmVar.variableName); _target.Value = null; } else if (fsmVar.Type == VariableType.Vector2) { FsmVector2 _target = fromFsm.Variables.GetFsmVector2(fsmVar.variableName); _target.Value = Vector2.zero; } else if (fsmVar.Type == VariableType.Vector3) { FsmVector3 _target = fromFsm.Variables.GetFsmVector3(fsmVar.variableName); _target.Value = Vector3.zero; } #if PLAYMAKER_1_8_OR_NEWER else if (fsmVar.Type == VariableType.Enum) { FsmEnum _target = fromFsm.Variables.GetFsmEnum(fsmVar.variableName); _target.ResetValue(); } else if (fsmVar.Type == VariableType.Array) { FsmArray _target = fromFsm.Variables.GetFsmArray(fsmVar.variableName); _target.Reset(); } #endif return(true); } System.Type valueType = value.GetType(); //Debug.Log("valueType "+valueType); System.Type storageType = null; // Debug.Log("fsmVar type "+fsmVar.Type); switch (fsmVar.Type) { case VariableType.Int: storageType = typeof(int); break; case VariableType.Float: storageType = typeof(float); break; case VariableType.Bool: storageType = typeof(bool); break; case VariableType.Color: storageType = typeof(Color); break; case VariableType.GameObject: storageType = typeof(GameObject); break; case VariableType.Quaternion: storageType = typeof(Quaternion); break; case VariableType.Rect: storageType = typeof(Rect); break; case VariableType.String: storageType = typeof(string); break; case VariableType.Texture: storageType = typeof(Texture2D); break; case VariableType.Vector2: storageType = typeof(Vector2); break; case VariableType.Vector3: storageType = typeof(Vector3); break; case VariableType.Object: storageType = typeof(Object); break; case VariableType.Material: storageType = typeof(Material); break; #if PLAYMAKER_1_8_OR_NEWER case VariableType.Enum: storageType = typeof(System.Enum); break; case VariableType.Array: storageType = typeof(System.Array); break; #endif } bool ok = true; if (!storageType.Equals(valueType)) { ok = false; if (storageType.Equals(typeof(Object))) // we are ok { ok = true; } #if PLAYMAKER_1_8_OR_NEWER if (storageType.Equals(typeof(System.Enum))) // we are ok { ok = true; } #endif if (!ok) { #if UNITY_WEBGL || UNITY_2017_1_OR_NEWER || UNITY_2018_1_OR_NEWER // proceduralMaterial not supported #else if (valueType.Equals(typeof(ProceduralMaterial))) // we are ok { ok = true; } #endif if (valueType.Equals(typeof(double))) // we are ok { ok = true; } if (valueType.Equals(typeof(System.Int64))) // we are ok { ok = true; } if (valueType.Equals(typeof(System.Byte))) // we are ok { ok = true; } } } if (!ok) { Debug.LogError("The fsmVar value <" + storageType + "> doesn't match the value <" + valueType + "> on state" + fromFsm.ActiveStateName + " on fsm:" + fromFsm.Name + " on GameObject:" + fromFsm.GameObjectName); return(false); } if (valueType == typeof(bool)) { FsmBool _target = fromFsm.Variables.GetFsmBool(fsmVar.variableName); _target.Value = (bool)value; } else if (valueType == typeof(Color)) { FsmColor _target = fromFsm.Variables.GetFsmColor(fsmVar.variableName); _target.Value = (Color)value; } else if (valueType == typeof(int)) { FsmInt _target = fromFsm.Variables.GetFsmInt(fsmVar.variableName); _target.Value = System.Convert.ToInt32(value); } else if (valueType == typeof(byte)) { FsmInt _target = fromFsm.Variables.GetFsmInt(fsmVar.variableName); _target.Value = System.Convert.ToInt32(value); } else if (valueType == typeof(System.Int64)) { if (fsmVar.Type == VariableType.Int) { FsmInt _target = fromFsm.Variables.GetFsmInt(fsmVar.variableName); _target.Value = System.Convert.ToInt32(value); } else if (fsmVar.Type == VariableType.Float) { FsmFloat _target = fromFsm.Variables.GetFsmFloat(fsmVar.variableName); _target.Value = System.Convert.ToSingle(value); } } else if (valueType == typeof(float)) { FsmFloat _target = fromFsm.Variables.GetFsmFloat(fsmVar.variableName); _target.Value = (float)value; } else if (valueType == typeof(double)) { FsmFloat _target = fromFsm.Variables.GetFsmFloat(fsmVar.variableName); _target.Value = System.Convert.ToSingle(value); } else if (valueType == typeof(GameObject)) { FsmGameObject _target = fromFsm.Variables.GetFsmGameObject(fsmVar.variableName); _target.Value = (GameObject)value; } else if (valueType == typeof(Material)) { FsmMaterial _target = fromFsm.Variables.GetFsmMaterial(fsmVar.variableName); _target.Value = (Material)value; #if UNITY_WEBGL || UNITY_2017_1_OR_NEWER || UNITY_2018_1_OR_NEWER // proceduralMaterial not supported #else } else if (valueType == typeof(ProceduralMaterial)) { FsmMaterial _target = fromFsm.Variables.GetFsmMaterial(fsmVar.variableName); _target.Value = (ProceduralMaterial)value; #endif } else if (valueType == typeof(Object) || storageType == typeof(Object)) { FsmObject _target = fromFsm.Variables.GetFsmObject(fsmVar.variableName); _target.Value = (Object)value; } else if (valueType == typeof(Quaternion)) { FsmQuaternion _target = fromFsm.Variables.GetFsmQuaternion(fsmVar.variableName); _target.Value = (Quaternion)value; } else if (valueType == typeof(Rect)) { FsmRect _target = fromFsm.Variables.GetFsmRect(fsmVar.variableName); _target.Value = (Rect)value; } else if (valueType == typeof(string)) { FsmString _target = fromFsm.Variables.GetFsmString(fsmVar.variableName); _target.Value = (string)value; } else if (valueType == typeof(Texture2D)) { FsmTexture _target = fromFsm.Variables.GetFsmTexture(fsmVar.variableName); _target.Value = (Texture2D)value; } else if (valueType == typeof(Vector2)) { FsmVector2 _target = fromFsm.Variables.GetFsmVector2(fsmVar.variableName); _target.Value = (Vector2)value; } else if (valueType == typeof(Vector3)) { FsmVector3 _target = fromFsm.Variables.GetFsmVector3(fsmVar.variableName); _target.Value = (Vector3)value; #if PLAYMAKER_1_8_OR_NEWER } else if (value is System.Enum) // valueType.BaseType == typeof(System.Enum) { FsmEnum _target = fromFsm.Variables.GetFsmEnum(fsmVar.variableName); _target.Value = (System.Enum)value; #endif } else { Debug.LogWarning("?!?!" + valueType); // don't know, should I put in FsmObject? } return(true); }
public override void Reset() { gameObject = null; fsmName = ""; storeValue = null; }
public override void Reset() { colorVariable = null; HexInput = ""; }
public static bool ApplyValueToFsmVar(Fsm fromFsm, FsmVar fsmVar, object value) { if (fromFsm == null) { return(false); } if (fsmVar == null) { return(false); } if (value == null) { if (fsmVar.Type == VariableType.Bool) { FsmBool fsmBool = fromFsm.Variables.GetFsmBool(fsmVar.variableName); fsmBool.Value = false; } else if (fsmVar.Type == VariableType.Color) { FsmColor fsmColor = fromFsm.Variables.GetFsmColor(fsmVar.variableName); fsmColor.Value = Color.black; } else if (fsmVar.Type == VariableType.Int) { FsmInt fsmInt = fromFsm.Variables.GetFsmInt(fsmVar.variableName); fsmInt.Value = 0; } else if (fsmVar.Type == VariableType.Float) { FsmFloat fsmFloat = fromFsm.Variables.GetFsmFloat(fsmVar.variableName); fsmFloat.Value = 0f; } else if (fsmVar.Type == VariableType.GameObject) { FsmGameObject fsmGameObject = fromFsm.Variables.GetFsmGameObject(fsmVar.variableName); fsmGameObject.Value = null; } else if (fsmVar.Type == VariableType.Material) { FsmMaterial fsmMaterial = fromFsm.Variables.GetFsmMaterial(fsmVar.variableName); fsmMaterial.Value = null; } else if (fsmVar.Type == VariableType.Object) { FsmObject fsmObject = fromFsm.Variables.GetFsmObject(fsmVar.variableName); fsmObject.Value = null; } else if (fsmVar.Type == VariableType.Quaternion) { FsmQuaternion fsmQuaternion = fromFsm.Variables.GetFsmQuaternion(fsmVar.variableName); fsmQuaternion.Value = Quaternion.identity; } else if (fsmVar.Type == VariableType.Rect) { FsmRect fsmRect = fromFsm.Variables.GetFsmRect(fsmVar.variableName); fsmRect.Value = new Rect(0f, 0f, 0f, 0f); } else if (fsmVar.Type == VariableType.String) { FsmString fsmString = fromFsm.Variables.GetFsmString(fsmVar.variableName); fsmString.Value = string.Empty; } else if (fsmVar.Type == VariableType.String) { FsmTexture fsmTexture = fromFsm.Variables.GetFsmTexture(fsmVar.variableName); fsmTexture.Value = null; } else if (fsmVar.Type == VariableType.Vector2) { FsmVector2 fsmVector = fromFsm.Variables.GetFsmVector2(fsmVar.variableName); fsmVector.Value = Vector2.zero; } else if (fsmVar.Type == VariableType.Vector3) { FsmVector3 fsmVector2 = fromFsm.Variables.GetFsmVector3(fsmVar.variableName); fsmVector2.Value = Vector3.zero; } return(true); } Type type = value.GetType(); Type type2 = null; switch (fsmVar.Type) { case VariableType.Float: type2 = typeof(float); break; case VariableType.Int: type2 = typeof(int); break; case VariableType.Bool: type2 = typeof(bool); break; case VariableType.GameObject: type2 = typeof(GameObject); break; case VariableType.String: type2 = typeof(string); break; case VariableType.Vector2: type2 = typeof(Vector2); break; case VariableType.Vector3: type2 = typeof(Vector3); break; case VariableType.Color: type2 = typeof(Color); break; case VariableType.Rect: type2 = typeof(Rect); break; case VariableType.Material: type2 = typeof(Material); break; case VariableType.Texture: type2 = typeof(Texture2D); break; case VariableType.Quaternion: type2 = typeof(Quaternion); break; case VariableType.Object: type2 = typeof(UnityEngine.Object); break; } if (!type2.Equals(type)) { if (!type.Equals(typeof(ProceduralMaterial))) { Debug.LogError(string.Concat(new object[] { "The fsmVar value <", type2, "> doesn't match the value <", type, ">" })); return(false); } } if (type == typeof(bool)) { FsmBool fsmBool2 = fromFsm.Variables.GetFsmBool(fsmVar.variableName); fsmBool2.Value = (bool)value; } else if (type == typeof(Color)) { FsmColor fsmColor2 = fromFsm.Variables.GetFsmColor(fsmVar.variableName); fsmColor2.Value = (Color)value; } else if (type == typeof(int)) { FsmInt fsmInt2 = fromFsm.Variables.GetFsmInt(fsmVar.variableName); fsmInt2.Value = (int)value; } else if (type == typeof(float)) { FsmFloat fsmFloat2 = fromFsm.Variables.GetFsmFloat(fsmVar.variableName); fsmFloat2.Value = (float)value; } else if (type == typeof(GameObject)) { FsmGameObject fsmGameObject2 = fromFsm.Variables.GetFsmGameObject(fsmVar.variableName); fsmGameObject2.Value = (GameObject)value; } else if (type == typeof(Material)) { FsmMaterial fsmMaterial2 = fromFsm.Variables.GetFsmMaterial(fsmVar.variableName); fsmMaterial2.Value = (Material)value; } else if (type == typeof(ProceduralMaterial)) { FsmMaterial fsmMaterial3 = fromFsm.Variables.GetFsmMaterial(fsmVar.variableName); fsmMaterial3.Value = (ProceduralMaterial)value; } else if (type == typeof(UnityEngine.Object)) { FsmObject fsmObject2 = fromFsm.Variables.GetFsmObject(fsmVar.variableName); fsmObject2.Value = (UnityEngine.Object)value; } else if (type == typeof(Quaternion)) { FsmQuaternion fsmQuaternion2 = fromFsm.Variables.GetFsmQuaternion(fsmVar.variableName); fsmQuaternion2.Value = (Quaternion)value; } else if (type == typeof(Rect)) { FsmRect fsmRect2 = fromFsm.Variables.GetFsmRect(fsmVar.variableName); fsmRect2.Value = (Rect)value; } else if (type == typeof(string)) { FsmString fsmString2 = fromFsm.Variables.GetFsmString(fsmVar.variableName); fsmString2.Value = (string)value; } else if (type == typeof(Texture2D)) { FsmTexture fsmTexture2 = fromFsm.Variables.GetFsmTexture(fsmVar.variableName); fsmTexture2.Value = (Texture2D)value; } else if (type == typeof(Vector2)) { FsmVector2 fsmVector3 = fromFsm.Variables.GetFsmVector2(fsmVar.variableName); fsmVector3.Value = (Vector2)value; } else if (type == typeof(Vector3)) { FsmVector3 fsmVector4 = fromFsm.Variables.GetFsmVector3(fsmVar.variableName); fsmVector4.Value = (Vector3)value; } else { Debug.LogWarning("?!?!" + type); } return(true); }
public override void Reset() { ambientGroundColor = null; }
public override void Reset() { base.Reset(); StoreResult = null; }
public override void Reset() { this.colorVariable = null; this.color = null; this.everyFrame = false; }