本文整理汇总了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;
}
示例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;
}
示例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;
}
示例4: Create
public static VehicleSpawner Create(ParkedVehicle info)
{
var vs = new GameObject().AddComponent<VehicleSpawner>();
vs.Initialize(info);
return vs;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}