当前位置: 首页>>代码示例>>C#>>正文


C# UnityEngine类代码示例

本文整理汇总了C#中UnityEngine的典型用法代码示例。如果您正苦于以下问题:C# UnityEngine类的具体用法?C# UnityEngine怎么用?C# UnityEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UnityEngine类属于命名空间,在下文中一共展示了UnityEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetObjectCall

 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);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:27,代码来源:PersistentCall.cs

示例2: checkDelegate

        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;
		}
开发者ID:602147629,项目名称:2DPlatformer-SLua,代码行数:31,代码来源:LuaDelegate_UnityEngine_Display_DisplaysUpdatedDelegate.cs

示例3: HandleTranslateRequest

        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);
                        }
        }
开发者ID:jcbrock,项目名称:UnityTetris,代码行数:29,代码来源:ClassicTetrisRules.cs

示例4: CreatePreviewForAsset

 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;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:30,代码来源:AssetPreviewUpdater.cs

示例5: OnLoadSpriteCollectionAsset

    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);
        });
    }
开发者ID:mr-kelly,项目名称:KEngine,代码行数:35,代码来源:CTk2dSpriteCollectionDep.cs

示例6: OnScroll

 //鼠标滑轮
 public void OnScroll(UnityEngine.EventSystems.PointerEventData evt)
 {
     if (listView != null)
     {
        // listView.OnScroll(evt);
     }
 }
开发者ID:ideadreamDefy,项目名称:Defy,代码行数:8,代码来源:ScrollListener.cs

示例7: OnCollisionExit

 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");
             }
         }
     }
 }
开发者ID:TheHolodeckProject,项目名称:UnityHolodeckProject,代码行数:34,代码来源:IntensityState.cs

示例8: Vector4

 /// <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;
 }
开发者ID:albmarvil,项目名称:BattleChess,代码行数:11,代码来源:Vector4.cs

示例9: ReplaceVector2

 public Entity ReplaceVector2(UnityEngine.Vector2 newVector2)
 {
     var component = CreateComponent<Vector2Component>(VisualDebuggingComponentIds.Vector2);
     component.vector2 = newVector2;
     ReplaceComponent(VisualDebuggingComponentIds.Vector2, component);
     return this;
 }
开发者ID:JuDelCo,项目名称:Entitas-CSharp,代码行数:7,代码来源:Vector2ComponentGeneratedExtension.cs

示例10: AddRect

 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);
 }
开发者ID:robinryf,项目名称:Entitas-CSharp,代码行数:7,代码来源:RectComponentGeneratedExtension.cs

示例11: OnNotify

 /// <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);
     }
 }
开发者ID:Jay2645,项目名称:UnityHelperFunctions,代码行数:12,代码来源:AchievementManager.cs

示例12: Assert

 public static void Assert(bool condition, string message, UnityEngine.Object context)
 {
     if (!condition)
     {
         logger.Log(LogType.Assert, message, context);
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:7,代码来源:Debug.cs

示例13: CalculatePreviewGameObject

 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;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:27,代码来源:AvatarPreview.cs

示例14: GetPrefabType

 // 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
 }
开发者ID:yonutix,项目名称:BattleTroops,代码行数:9,代码来源:QCARUtilities.cs

示例15: ReplacePosition

 public Entity ReplacePosition(UnityEngine.Vector2 newPos)
 {
     var component = CreateComponent<PositionComponent>(ComponentIds.Position);
     component.pos = newPos;
     ReplaceComponent(ComponentIds.Position, component);
     return this;
 }
开发者ID:kicholen,项目名称:SpaceShooter,代码行数:7,代码来源:PositionComponentGeneratedExtension.cs


注:本文中的UnityEngine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。