public static GameTimer StartTimer(float time, bool once, bool destroyOnLoad, EventHandler receiver, string tname = "timer") { var go = new GameObject(tname); var com = go.AddComponent(typeof(GameTimer)) as GameTimer; com.OnTimer = receiver; com.timeLeft_ = time; com.elapse_ = time; com.once_ = once; com.destroyOnLoad_ = destroyOnLoad; //CategorySettings CategorySettings.Attach(go.transform, "_timers/", false); return(com); }
/*public CMapObject(JsonData data, MapObjectReference mapgoref) * { * this.ActorData = new PlayActor(); * this.ActorData.SN = Convert.ToInt64(data["SN"]); * this.reference = mapgoref; * if (reference == null) * { * Debug.LogError(string.Format("The map object not exist:{0},please check 'MapObjectReference' config.May be the 'MapObjectReference' config in server and client are not synchronized,please synchronized.", refid)); * Dispose(); * return; * } * this.refid = mapgoref.Id; * this.ActorData.Movedata.X = Convert.ToInt32(data["pos"]["x"]); * this.ActorData.Movedata.Z = Convert.ToInt32(data["pos"]["y"]); * this.ActorData.Movedata.Dir_X = Convert.ToSingle(data["forward"]["x"]); * this.ActorData.Movedata.Dir_Z = Convert.ToSingle(data["forward"]["y"]); * * Vector3 navpos; * CClientCommon.GetNavMeshPostion(out navpos, new Vector3(this.ActorData.Movedata.X, 0f, this.ActorData.Movedata.Z), Global.world.NavLayerMask); * position = navpos; * SetPosition(navpos); * * float x = this.ActorData.Movedata.Dir_X; * float z = this.ActorData.Movedata.Dir_Z; * if (x != 0 || z != 0) * SetForward(new Vector3(x, 0, z).normalized); * * this.Name = string.Format("XYMapObject{0}_{1}", this.ActorData.SN, this.refid); * * MapObjectList.Add(this.ActorData.SN, this); * SetLayer(CDefines.Layer.Player); * }*/ protected override void OnAllModelsLoadDone() { base.OnAllModelsLoadDone(); CategorySettings.Attach(base.Transform, "_roles/_map_objects/", false); }
protected override void OnCreate() { base.OnCreate(); CategorySettings.Attach(gameObject.transform, "_effect/"); ShowTouchEffect(effectPos); }