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


C# GameObject.Initialize方法代码示例

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


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

示例1: CallWithIntervals

        public static ICallbackObject CallWithIntervals(Action callback, int repeat = int.MaxValue, float waitTime = float.MinValue)
        {
            IntervalCallBackObject intervalCallBack = new GameObject("", typeof(IntervalCallBackObject)).GetComponent<IntervalCallBackObject>();
            intervalCallBack.Initialize(callback, repeat, waitTime);
            Instance.InitializeCallBack(intervalCallBack);

            return intervalCallBack;
        }
开发者ID:kewur,项目名称:HungryDude,代码行数:8,代码来源:Invoker.cs

示例2: CreateModel

        public GameObject CreateModel()
        {
            if (IsModelCreated)
                return null;

            var m = new GameObject().AddComponent<BuildingPolygon>();
            m.gameObject.transform.position = Center;
            m.Initialize(_verts);
            m.gameObject.GetComponent<Renderer>().material = Resources.Load("buildings01") as Material;

            IsModelCreated = true;
            return m.gameObject;
        }
开发者ID:QuantumLeap,项目名称:Vi3W,代码行数:13,代码来源:BuildingHolder.cs

示例3: Create

        public static Vehicle Create(VehicleSpawner spawner)
        {
            var inst = new GameObject().AddComponent<Vehicle>();

            VehicleDef def;
            if (spawner.Info.CarId == -1) {
                def = GetRandomDef();
            } else {
                def = Item.GetDefinition<VehicleDef>(spawner.Info.CarId);
            }

            inst.Initialize(def, spawner.Info.Colors);

            inst.transform.position = spawner.transform.position - Vector3.up * inst.AverageWheelHeight;
            inst.transform.localRotation = spawner.transform.rotation;

            Networking.Server.Instance.GlobalGroup.Add(inst);

            return inst;
        }
开发者ID:katalist5296,项目名称:SanAndreasUnity,代码行数:20,代码来源:Vehicle_Spawning.cs

示例4: Create

 public static VehicleSpawner Create(ParkedVehicle info)
 {
     var vs = new GameObject().AddComponent<VehicleSpawner>();
     vs.Initialize(info);
     return vs;
 }
开发者ID:katalist5296,项目名称:SanAndreasUnity,代码行数:6,代码来源:VehicleSpawner.cs

示例5: ExecuteOnCondition

        public static ICallbackObject ExecuteOnCondition(Action callBack, Func<bool> condition, float checkInterval = float.MinValue)
        {
            ConditionCallBackObject conditionCallback = new GameObject("", typeof(ConditionCallBackObject)).GetComponent<ConditionCallBackObject>();
            conditionCallback.Initialize(callBack, condition, checkInterval);
            Instance.InitializeCallBack(conditionCallback);

            return conditionCallback;
        }
开发者ID:kewur,项目名称:HungryDude,代码行数:8,代码来源:Invoker.cs

示例6: WaitThanCallback

        public static ICallbackObject WaitThanCallback(Action callback, float waitTime)
        {
            WaitThanCallBackObject waitThanCallBackObject = new GameObject("", typeof(WaitThanCallBackObject)).GetComponent<WaitThanCallBackObject>();
            waitThanCallBackObject.Initialize(callback, waitTime);
            Instance.InitializeCallBack(waitThanCallBackObject);

            return waitThanCallBackObject;
        }
开发者ID:kewur,项目名称:HungryDude,代码行数:8,代码来源:Invoker.cs

示例7: GenerateSection

		private ContourSegment GenerateSection(Contour terrain, ContourSegmentConfig config) {
			ContourSegment section = new GameObject("Section", typeof(ContourSegment)).GetComponent<ContourSegment>();
			section.Initialize(terrain, config, attributes);
			return section;
		}
开发者ID:wtrebella,项目名称:Grappler,代码行数:5,代码来源:ContourSegmentGenerator.cs

示例8: CreateRoads

        private void CreateRoads(JSONObject mapData)
        {
            foreach (var geo in mapData["features"].list)
            {
                var l = new List<Vector3>();

                for (int i = 0; i < geo["geometry"]["coordinates"].list.Count; i++)
                {
                    var c = geo["geometry"]["coordinates"][i];
                    var bm = GM.LatLonToMeters(c[1].f, c[0].f);
                    var pm = new Vector2(bm.x - Rect.center.x, bm.y - Rect.center.y);
                    l.Add(pm.ToVector3xz());
                }

                var m = new GameObject("road").AddComponent<RoadPolygon>();
                m.transform.parent = this.transform;
                try
                {
                    m.Initialize(geo["properties"]["id"].str, this, l, geo["properties"]["kind"].str);
                }
                catch (Exception ex)
                {
                    Debug.Log(ex);
                }
            }
        }
开发者ID:QuantumLeap,项目名称:Vi3W,代码行数:26,代码来源:Tile.cs


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