private void SetFromAndToValue(object ToValue) { Type type = ToValue.GetType(); if (type == typeof(CatVector3)) { CatVector3 value = (CatVector3)ToValue; toValue = value.ParameterClone(); } else if (type == typeof(CatVector2)) { CatVector2 value = (CatVector2)ToValue; toValue = value.ParameterClone(); } else if (type == typeof(CatFloat)) { CatFloat value = (CatFloat)ToValue; toValue = value.ParameterClone(); } else if (type == typeof(CatInteger)) { CatInteger value = (CatInteger)ToValue; toValue = value.ParameterClone(); } }
private void SetFromValue() { Type type = refValue.GetType(); if (type == typeof(CatVector3)) { CatVector3 value = (CatVector3)refValue; fromValue = value.ParameterClone(); } else if (type == typeof(CatVector2)) { CatVector2 value = (CatVector2)refValue; fromValue = value.ParameterClone(); } else if (type == typeof(CatFloat)) { CatFloat value = (CatFloat)refValue; fromValue = value.ParameterClone(); } else if (type == typeof(CatInteger)) { CatInteger value = (CatInteger)refValue; fromValue = value.ParameterClone(); } }
public void SetObserve(CatFloat _value) { m_fValue = _value; m_iValue = null; // x.xxx inputBox.DecimalPlaces = 3; UpdateShowValue(); }
public ColliderBase(GameObject _gameObject) : base(_gameObject) { m_bodyType = new CatInteger(0); m_mass = new CatFloat(0.5f); m_friction = new CatFloat(0.2f); m_restitution = new CatFloat(0.0f); }
/// <summary> /// Function that creates new instance of type "type" /// </summary> /// <param name="type">Primitive type: "int", "long", "byte", "double", "angle", "string", "bool", "float", "precise"</param> /// <param name="args">Value of an object. Can contain</param> /// <returns></returns> public static int CreatePrimitiveObject(string type, params CatStructureObject[] args) { CatPrimitiveObject objToLoad = null; switch (type) { case "byte": objToLoad = new CatByte(args[0]); break; case "int": objToLoad = new CatInt(args[0]); break; case "long": objToLoad = new CatLong(args[0]); break; case "angle": objToLoad = new CatAngle(args[0]); break; case "string": objToLoad = new CatString(args[0]); break; case "bool": objToLoad = new CatBool(args[0]); break; case "float": objToLoad = new CatFloat(args[0]); break; case "double": objToLoad = new CatDouble(args[0]); break; case "precise": objToLoad = new CatPrecise(args[0]); break; case "array": objToLoad = new CatArray(args); break; } if (objToLoad != null) { return(HeapHandler.LoadObjectToHeap(objToLoad)); } throw new ArgumentException(); }
private void UpdateValue() { Type type = refValue.GetType(); if (type == typeof(CatVector3)) { // delta CatVector3 _fromValue = (CatVector3)fromValue; CatVector3 _toValue = (CatVector3)toValue; CatVector3 delta = _toValue - _fromValue; // set value CatVector3 value = (CatVector3)refValue; float percent = (float)curTick / totalTick; value.SetValue(_fromValue.GetValue() + delta.GetValue() * GetCurveValue(percent)); } else if (type == typeof(CatVector2)) { //delta CatVector2 _fromValue = (CatVector2)fromValue; CatVector2 _toValue = (CatVector2)toValue; CatVector2 delta = _toValue - _fromValue; // set value CatVector2 value = (CatVector2)refValue; float percent = (float)curTick / totalTick; value.SetValue(_fromValue.GetValue() + delta.GetValue() * GetCurveValue(percent)); } else if (type == typeof(CatFloat)) { // delta float _fromValue = ((CatFloat)fromValue); float _toValue = ((CatFloat)toValue); float delta = _toValue - _fromValue; // set value CatFloat value = (CatFloat)refValue; value.SetValue(_fromValue + delta * GetCurveValue((float)curTick / totalTick)); } else if (type == typeof(CatInteger)) { // delta int _fromValue = ((CatInteger)fromValue); int _toValue = ((CatInteger)toValue); int delta = _toValue - _fromValue; // set value CatInteger value = (CatInteger)refValue; value.SetValue(_fromValue + (int)(delta * GetCurveValue((float)curTick / totalTick))); } }
public CircleCollider(GameObject _gameObject) : base(_gameObject) { m_radius = new CatFloat(0.2f); }
public CircleCollider() : base() { m_radius = new CatFloat(0.2f); }