private static BaseInvokableCall GetObjectCall(UnityEngine.Object target, MethodInfo method, ArgumentCache arguments) { System.Type type = typeof(UnityEngine.Object); if (!string.IsNullOrEmpty(arguments.unityObjectArgumentAssemblyTypeName)) { System.Type type1 = System.Type.GetType(arguments.unityObjectArgumentAssemblyTypeName, false); if (type1 != null) { type = type1; } else { type = typeof(UnityEngine.Object); } } System.Type type2 = typeof(CachedInvokableCall<>); System.Type[] typeArguments = new System.Type[] { type }; System.Type[] types = new System.Type[] { typeof(UnityEngine.Object), typeof(MethodInfo), type }; ConstructorInfo constructor = type2.MakeGenericType(typeArguments).GetConstructor(types); UnityEngine.Object unityObjectArgument = arguments.unityObjectArgument; if ((unityObjectArgument != null) && !type.IsAssignableFrom(unityObjectArgument.GetType())) { unityObjectArgument = null; } object[] parameters = new object[] { target, method, unityObjectArgument }; return (constructor.Invoke(parameters) as BaseInvokableCall); }
static internal int checkDelegate(IntPtr l,int p,out UnityEngine.Display.DisplaysUpdatedDelegate ua) { int op = extractFunction(l,p); if(LuaDLL.lua_isnil(l,p)) { ua=null; return op; } else if (LuaDLL.lua_isuserdata(l, p)==1) { ua = (UnityEngine.Display.DisplaysUpdatedDelegate)checkObj(l, p); return op; } LuaDelegate ld; checkType(l, -1, out ld); if(ld.d!=null) { ua = (UnityEngine.Display.DisplaysUpdatedDelegate)ld.d; return op; } LuaDLL.lua_pop(l,1); l = LuaState.get(l).L; ua = () => { int error = pushTry(l); ld.pcall(0, error); LuaDLL.lua_settop(l, error-1); }; ld.d=ua; return op; }
static internal int checkDelegate(IntPtr l,int p,out UnityEngine.Application.AdvertisingIdentifierCallback ua) { int op = extractFunction(l,p); if(LuaDLL.lua_isnil(l,p)) { ua=null; return op; } else if (LuaDLL.lua_isuserdata(l, p)==1) { ua = (UnityEngine.Application.AdvertisingIdentifierCallback)checkObj(l, p); return op; } LuaDelegate ld; checkType(l, -1, out ld); if(ld.d!=null) { ua = (UnityEngine.Application.AdvertisingIdentifierCallback)ld.d; return op; } LuaDLL.lua_pop(l,1); l = LuaState.get(l).L; ua = (string a1,bool a2,string a3) => { int error = pushTry(l); pushValue(l,a1); pushValue(l,a2); pushValue(l,a3); ld.pcall(3, error); LuaDLL.lua_settop(l, error-1); }; ld.d=ua; return op; }
public static void RecordObject( UnityEngine.Object obj, string name ) { #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 Undo.RegisterUndo(obj, name); #else Undo.RecordObject(obj, name); #endif }
public Entity ReplaceRect(UnityEngine.Rect newRect) { var componentPool = GetComponentPool(ComponentIds.Rect); var component = (RectComponent)(componentPool.Count > 0 ? componentPool.Pop() : new RectComponent()); component.rect = newRect; ReplaceComponent(ComponentIds.Rect, component); return this; }
public Entity ReplaceVector4(UnityEngine.Vector4 newVector4) { var component = CreateComponent<Vector4Component>(VisualDebuggingComponentIds.Vector4); component.vector4 = newVector4; ReplaceComponent(VisualDebuggingComponentIds.Vector4, component); return this; }
public Entity ReplaceVector2(UnityEngine.Vector2 newVector2) { var component = CreateComponent<Vector2Component>(VisualDebuggingComponentIds.Vector2); component.vector2 = newVector2; ReplaceComponent(VisualDebuggingComponentIds.Vector2, component); return this; }
public Entity ReplacePosition(UnityEngine.Vector2 newPos) { var component = CreateComponent<PositionComponent>(ComponentIds.Position); component.pos = newPos; ReplaceComponent(ComponentIds.Position, component); return this; }
/// <summary> /// Notifies all registered achievements that an event has occurred. /// </summary> /// <param name="entity">An entity related to the event.</param> /// <param name="eventType">A unique string identifying the event.</param> public override void OnNotify(UnityEngine.MonoBehaviour entity, string eventType) { foreach (Achievement a in achievements) { a.OnNotify(entity, eventType); } }
/// <summary> /// Constructor from UnityEngine.Vector4 /// </summary> /// <param name="v">UnityEngine.Vector4 from</param> public Vector4(UnityEngine.Vector4 v) { this.x = v.x; this.y = v.y; this.z = v.z; this.w = v.w; }
public static void Assert(bool condition, string message, UnityEngine.Object context) { if (!condition) { logger.Log(LogType.Assert, message, context); } }
public Entity AddRect(UnityEngine.Rect newRect) { var componentPool = GetComponentPool(ComponentIds.Rect); var component = (RectComponent)(componentPool.Count > 0 ? componentPool.Pop() : new RectComponent()); component.rect = newRect; return AddComponent(ComponentIds.Rect, component); }
public static void Assert(bool condition, UnityEngine.Object context) { if (!condition) { logger.Log(LogType.Assert, "Assertion failed", context); } }
private static GameObject CalculatePreviewGameObject(UnityEngine.Animator selectedAnimator, Motion motion, ModelImporterAnimationType animationType) { AnimationClip firstAnimationClipFromMotion = GetFirstAnimationClipFromMotion(motion); GameObject preview = AvatarPreviewSelection.GetPreview(animationType); if (IsValidPreviewGameObject(preview, ModelImporterAnimationType.None)) { return preview; } if ((selectedAnimator != null) && IsValidPreviewGameObject(selectedAnimator.gameObject, animationType)) { return selectedAnimator.gameObject; } preview = FindBestFittingRenderableGameObjectFromModelAsset(firstAnimationClipFromMotion, animationType); if (preview != null) { return preview; } if (animationType == ModelImporterAnimationType.Human) { return GetHumanoidFallback(); } if (animationType == ModelImporterAnimationType.Generic) { return GetGenericAnimationFallback(); } return null; }
public void HandleTranslateRequest(UnityEngine.Vector3 movementVector) { if (mCurrentShape == null) return; //Move current shape mTetrisGrid.HandleTranslateRequest (mCurrentShape, movementVector); //Check for end game condition if (mTetrisGrid.GetRowBlockCount (0) > 0) { NotifyObservers (ClassicTetrisStateUpdate.GameEnded); return; } //Check if a shape was placed. If so, check for full rows, spawn new shape if (mTetrisGrid.WasShapeAddedToScene) { //Delete full rows foreach (int row in mTetrisGrid.GetFullRows ()) { UnityEngine.Debug.Log ("Row " + row + " is full. Deleting now..." + ++mDebugId); NotifyObservers (ClassicTetrisStateUpdate.RowDeleted); mTetrisGrid.DeleteRow (row); } mCurrentShape = mPreviewShape; mCurrentShape.TranslateToInitialPosition (); mPreviewShape = mFactory.SpawnRandomizedTetrisShape (mRulesetOption); NotifyObservers (ClassicTetrisStateUpdate.GeneratedNewShape); } }
internal static int checkDelegate(IntPtr l,int p,out UnityEngine.RectTransform.ReapplyDrivenProperties ua) { int op = extractFunction(l,p); if(LuaDLL.lua_isnil(l,p)) { ua=null; return op; } else if (LuaDLL.lua_isuserdata(l, p)==1) { ua = (UnityEngine.RectTransform.ReapplyDrivenProperties)checkObj(l, p); return op; } LuaDelegate ld; checkType(l, -1, out ld); if(ld.d!=null) { ua = (UnityEngine.RectTransform.ReapplyDrivenProperties)ld.d; return op; } LuaDLL.lua_pop(l,1); l = LuaState.get(l).L; ua = (UnityEngine.RectTransform a1) => { int error = pushTry(l); pushValue(l,a1); ld.pcall(1, error); LuaDLL.lua_settop(l, error-1); }; ld.d=ua; return op; }
void OnCollisionEnter(UnityEngine.Collision hit) { hitobject = hit.gameObject.tag; if(hitobject == "Wall") { Debug.Log ("hit cube"); PlayerPrefs.SetInt ("CurrentScore", CountdownTime.GearCogCount); if (CountdownTime.GearCogCount > PlayerPrefs.GetInt("HighScore")) { PlayerPrefs.SetInt ("HighScore", CountdownTime.GearCogCount); } //Destroy(hit.transform.parent.gameObject); Instantiate(explosionPrefab, transform.position, transform.rotation); //hit.transform.Translate = new Vector3(-880.03, 37.497, 2175.14); //hit.transform.parent.position = new Vector3(-860, 37, 2124); //hit.transform.parent.rotation = new Quaternion (0,0,0,0); //transform.parent.position = new Vector3(-860, 37, 2124); //transform.parent.rotation = new Quaternion (0,0,0,0); //hit.transform.parent.rotation = cubePos.transform.rotation; //hit.transform.parent.position = cubePos.transform.position;//new Vector3(-3084, -22, -1220); //hit.transform.parent.rotation = cubePos.transform.localRotation; //hit.transform.localRotation = initialRotation; //hit.transform.localPosition = initialPos; Fzero.current_speed = 0; Application.LoadLevel("GameOver"); } }
void GUI() { if (GUI.Button(UnityEngine.Rect(10, 10, 100, 100), "ROLL")) { GameManager.isDiceRoll = true; } }
public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) { Debug.logger.logHandler.LogFormat(logType, context, format, args); if (UILogView.sInstance != null) { UILogView.sInstance.AddLog (string.Format (format, args)); } }
//-------------------------------------------------------------------------------------------------------------------- //Name: matchResponse //Description: Called once server has returned a list of available matches then displays them in the lobbies viewport //Parameters: UnityEngine.Networking.Match.ListmatchResponse matches //Returns: NA //-------------------------------------------------------------------------------------------------------------------- public void matchResponse(UnityEngine.Networking.Match.ListMatchResponse matches) { toggleWaitScreen (false, ""); if (matches.matches == null) return; descriptions = matches.matches.ToArray (); //Remove any children currently present for (int i = 0; i < viewPort.transform.childCount; i++) Destroy (viewPort.transform.GetChild (i).gameObject); //Populate new list with the match options. for (int i = 0; i < descriptions.Length; i++) { GameObject content = GameObject.Instantiate (matchContent); content.transform.SetParent (viewPort.transform); RectTransform rect = content.GetComponent<RectTransform> (); rect.offsetMin = new Vector2 (0, -67 - 67 * i); rect.offsetMax = new Vector2 (1, -67 * i); content.transform.localScale = new Vector3 (1, 1, 1); content.GetComponent<MatchContent> ().setText (descriptions [i]); content.GetComponent<Button> ().onClick.AddListener (delegate { SelectedMatch = content.GetComponent<MatchContent> ().getDesctription (); print("23"); transform.FindChild("ButtonPanel").FindChild("Join").GetComponent<JoinButton>().interactable=true; }); } //End for(int i = 0; i < descriptions.Length; i ++) }
protected static void OnLoadSpriteCollectionAsset(UnityEngine.Object obj, params object[] args) { string resPath = args[0] as string; Action<UnityEngine.Object> externalCallback = args[1] as Action<UnityEngine.Object>; GameObject colObj = obj as GameObject; colObj.transform.parent = DepContainer.transform; obj.name = resPath; tk2dSpriteCollectionData colData = colObj.GetComponent<tk2dSpriteCollectionData>(); Log.Assert(colData); var colDep = colObj.GetComponent<KAssetDep>(); if (!(colDep && colDep.GetType() == typeof (CTk2dSpriteCollectionDep))) // 依赖材质Material, 加载后是Material { Log.Error("Wrong Collection DepType - {0}", resPath); } colDep.AddFinishCallback((assetDep, _obj) => { Material _mat = _obj as Material; //_mat.renderQueue = 4000; // 2D Toolkit渲染顺序靠前! // 塞Material进去SpriteCollection colData.materials = new Material[] { _mat }; colData.textures = new Texture[] { _mat.mainTexture }; foreach (var def in colData.spriteDefinitions) { def.material = _mat; } externalCallback(colData); }); }
static internal int checkDelegate(IntPtr l,int p,out UnityEngine.EventSystems.ExecuteEvents.EventFunction<UnityEngine.EventSystems.ICancelHandler> ua) { int op = extractFunction(l,p); if(LuaDLL.lua_isnil(l,p)) { ua=null; return op; } else if (LuaDLL.lua_isuserdata(l, p)==1) { ua = (UnityEngine.EventSystems.ExecuteEvents.EventFunction<UnityEngine.EventSystems.ICancelHandler>)checkObj(l, p); return op; } LuaDelegate ld; checkType(l, -1, out ld); if(ld.d!=null) { ua = (UnityEngine.EventSystems.ExecuteEvents.EventFunction<UnityEngine.EventSystems.ICancelHandler>)ld.d; return op; } LuaDLL.lua_pop(l,1); l = LuaState.get(l).L; ua = (UnityEngine.EventSystems.ICancelHandler a1,UnityEngine.EventSystems.BaseEventData a2) => { int error = pushTry(l); pushValue(l,a1); pushValue(l,a2); ld.pcall(2, error); LuaDLL.lua_settop(l, error-1); }; ld.d=ua; return op; }
public static RMC.Common.UnityEngineReplacement.Bounds Convert(UnityEngine.Bounds uBounds) { return new RMC.Common.UnityEngineReplacement.Bounds( Convert(uBounds.center), Convert(uBounds.size) ); }
public static void DebugLog(string text, UnityEngine.Object context) { if (debugLogActive) { Debug.Log("[EFX] " + text, context); } }
void OnCollisionEnter(UnityEngine.Collision hit) { if (hit.gameObject.ToString() == "Cube (UnityEngine.GameObject)") { if(PortScript != null && PortScript.ConnectionIsOpen()) { if(this.transform.parent.gameObject.ToString() == "thumb (UnityEngine.GameObject)") { PortScript.thumbTip = 255; //PortScript.thumbTip = 255; print ("ThumbIn"); } if(this.transform.parent.gameObject.ToString() == "index (UnityEngine.GameObject)") { PortScript.indexTip = 255; print ("IndexIn"); } if(this.transform.parent.gameObject.ToString() == "middle (UnityEngine.GameObject)") { PortScript.middleTip = 255; print ("MiddleIn"); } if(this.transform.parent.gameObject.ToString() == "ring (UnityEngine.GameObject)") { PortScript.ringTip = 255; print ("RingIn"); } if(this.transform.parent.gameObject.ToString() == "pinky (UnityEngine.GameObject)") { PortScript.pinkyTip = 255; print ("PinkyIn"); } } } }
void OnCollisionExit(UnityEngine.Collision hit) { if (hit.gameObject.ToString() == "Cube (UnityEngine.GameObject)") { if(1==1)//if(PortScript != null && PortScript.ConnectionIsOpen()) { if(this.transform.parent.gameObject.ToString() == "thumb (UnityEngine.GameObject)") { PortScript.thumbTip = 0; print ("ThumbOut"); } if(this.transform.parent.gameObject.ToString() == "index (UnityEngine.GameObject)") { PortScript.indexTip = 0; print ("IndexOut"); } if(this.transform.parent.gameObject.ToString() == "middle (UnityEngine.GameObject)") { PortScript.middleTip = 0; print ("MiddleOut"); } if(this.transform.parent.gameObject.ToString() == "ring (UnityEngine.GameObject)") { PortScript.ringTip = 0; print ("RingOut"); } if(this.transform.parent.gameObject.ToString() == "pinky (UnityEngine.GameObject)") { PortScript.pinkyTip = 0; print ("PinkyOut"); } } } }
public static void Log(string str, UnityEngine.Object obj) { if (CanLog()) { UnityEngine.Debug.Log(str, obj); } }
//鼠标滑轮 public void OnScroll(UnityEngine.EventSystems.PointerEventData evt) { if (listView != null) { // listView.OnScroll(evt); } }
// Returns the PrefabType and suppresses warnings // EditorUtility.GetPrefabType is deprecated as of Unity 3.5 public static PrefabType GetPrefabType(UnityEngine.Object target) { // Disable the obsolete method warning #pragma warning disable 618 return EditorUtility.GetPrefabType(target); #pragma warning restore 618 }
public Entity ReplaceAnimationCurve(UnityEngine.AnimationCurve newAnimationCurve) { var component = CreateComponent<AnimationCurveComponent>(VisualDebuggingComponentIds.AnimationCurve); component.animationCurve = newAnimationCurve; ReplaceComponent(VisualDebuggingComponentIds.AnimationCurve, component); return this; }
public static Texture2D CreatePreviewForAsset(UnityEngine.Object obj, UnityEngine.Object[] subAssets, string assetPath) { if (obj == null) { return null; } System.Type type = CustomEditorAttributes.FindCustomEditorType(obj, false); if (type == null) { return null; } MethodInfo method = type.GetMethod("RenderStaticPreview"); if (method == null) { Debug.LogError("Fail to find RenderStaticPreview base method"); return null; } if (method.DeclaringType == typeof(Editor)) { return null; } Editor editor = Editor.CreateEditor(obj); if (editor == null) { return null; } Texture2D textured = editor.RenderStaticPreview(assetPath, subAssets, 0x80, 0x80); UnityEngine.Object.DestroyImmediate(editor); return textured; }
// -------------------------------------------------- // // PUBLIC METHODS // // -------------------------------------------------- // /// <summary> /// Safely destroy an Object. /// </summary> /// <param name="obj">Object to destroy.</param> public static void Destroy(UnityEngine.Object obj) { #if UNITY_EDITOR UnityEngine.Object.DestroyImmediate(obj); #else UnityEngine.Destroy(obj); #endif }
public static T GetNextNonRepeatingRandom() { var nonrepeaters = _cache .Except(_memory); // Not familar with unity.. but this should make // sense what I am doing var next = nonrepeaters.ElementAt(UnityEngine.Random(0, nonrepeaters.Count() - 1)); // this fast, Stack will know it's count so no GetEnumerator() // and _cache List is the same (Count() will call List.Count) if (_memory.Count > _cache.Count() / 2) { _memory.Pop(); } _memory.Push(next); return(next); }
private void OnTriggerStay(Collider other) { if (switchPos == SWITCH_POSITION_E.DISABLED) { return; } // Keep the press haptic tracking the hand's Y position. if (other.name == "HandTrackedBlock") { Debug.Log("Running on stay"); Block.transform.position = new UnityEngine.Vector3( _pistonPresser.transform.position.x, _buttonPositionY _pistonPresser.transform.position.z, ); } }
protected override void Apply() { if (!toAlpha.HasValue && !toRed.HasValue && !toGreen.HasValue && !toBlue.HasValue) { if (targetGraphic) { To(targetGraphic !.color); } else if (targetSprite) { To(targetSprite !.color); } else if (meshRenderer) { To(meshRenderer !.material.color); } else if (canvasGroup) { To(new UnityEngine.Color(1f, 1f, 1f, canvasGroup !.alpha)); } } if (!fromAlpha.HasValue && !fromRed.HasValue && !fromGreen.HasValue && !fromBlue.HasValue) { if (targetGraphic) { From(targetGraphic !.color); } else if (targetSprite) { From(targetSprite !.color); } else if (meshRenderer) { From(meshRenderer !.material.color); } else if (canvasGroup) { From(new UnityEngine.Color(1f, 1f, 1f, canvasGroup !.alpha)); } } var color = UnityEngine.Color.white; if (targetGraphic) { color = targetGraphic !.color; } if (targetSprite) { color = targetSprite !.color; } if (meshRenderer) { color = meshRenderer !.material.color; } if (canvasGroup) { color = new UnityEngine.Color(1f, 1f, 1f, canvasGroup !.alpha); } if (fromAlpha.HasValue && toAlpha.HasValue) { color.a = function.Invoke(fromAlpha.Value, toAlpha.Value, NormalizdElapsedTime); } if (fromRed.HasValue && toRed.HasValue) { color.r = function.Invoke(fromRed.Value, toRed.Value, NormalizdElapsedTime); } if (fromGreen.HasValue && toGreen.HasValue) { color.g = function.Invoke(fromGreen.Value, toGreen.Value, NormalizdElapsedTime); } if (fromBlue.HasValue && toBlue.HasValue) { color.b = function.Invoke(fromBlue.Value, toBlue.Value, NormalizdElapsedTime); } if (targetGraphic) { targetGraphic !.color = color; } else if (targetSprite) { targetSprite !.color = color; } else if (meshRenderer) { meshRenderer !.material.color = color; } else if (canvasGroup) { canvasGroup !.alpha = color.a; } }
public Class1() { var c = new UnityEngine.Color(0.3f, 0.4f, 0.6f, 0.7f { caret });
public Class1() { var c = new UnityEngine.Color32(30, 40, 50, 60 { caret });