public static void TryDestroyObject(string name) { V_Object vObject = GetObject(name); if (vObject != null) { vObject.DestroySelf(); } }
public static V_Object CreateSkeletonPresetAnim(Vector3 position, Material material, UnitAnimType unitAnimType, Vector3 dir, float frameRateMod) { V_Object instancedObject = CreateSkeleton(position, material); V_UnitSkeleton.OnAnimComplete onAnimComplete = delegate(UnitAnim unitAnim) { instancedObject.DestroySelf(); }; instancedObject.GetLogic <V_UnitAnimation>().PlayAnimForced(unitAnimType, dir, frameRateMod, onAnimComplete, null, null); return(instancedObject); }
public static V_Object CreateSkeletonPresetAnim(Vector3 position, Material material, UnitAnimType unitAnimType, Vector3 dir, float frameRateMod, Vector3 rotatePrefabDir, Vector3 scalePrefab) { V_Object instancedObject = CreateSkeleton(position, material); V_UnitSkeleton.OnAnimComplete onAnimComplete = delegate(UnitAnim unitAnim) { instancedObject.DestroySelf(); }; instancedObject.GetLogic <V_UnitAnimation>().PlayAnimForced(unitAnimType, dir, frameRateMod, onAnimComplete, null, null); instancedObject.GetLogic <V_IObjectTransform>().SetEulerZ(GetAngleFromVector(rotatePrefabDir)); instancedObject.GetLogic <V_IObjectTransform>().SetScale(scalePrefab); return(instancedObject); }
public static V_Object CreateSkeletonPresetAnim(Vector3 position, Material material, UnitAnim unitAnim, float frameRateMod, Vector3 rotatePrefabDir, Vector3 scalePrefab, int sortingOrderOffset) { V_Object instancedObject = CreateSkeleton(position, material); V_UnitSkeleton.OnAnimComplete onAnimComplete = delegate(UnitAnim u) { instancedObject.DestroySelf(); }; instancedObject.GetLogic <V_IObjectTransform>().GetTransform().GetComponent <CodeMonkey.MonoBehaviours.PositionRendererSorter>().SetOffset(sortingOrderOffset); instancedObject.GetLogic <V_UnitAnimation>().PlayAnimForced(unitAnim, frameRateMod, onAnimComplete, null, null); instancedObject.GetLogic <V_IObjectTransform>().SetEulerZ(GetAngleFromVector(rotatePrefabDir)); instancedObject.GetLogic <V_IObjectTransform>().SetScale(scalePrefab); return(instancedObject); }