public static void ReleaseObj(GameObjData Data) { if (Data != null) { Data.Release(); } }
public ItemCommon( string name, string objClass, string script, string dataPath, GameObjData data, float scale, Vector2 pos, float azi, Vector2 vel, float rotaVel ) : this( name, objClass, script, Path.Combine( dataPath, data.baseNode.texPaths[0] ), data.baseNode.structKeyPoints[0], scale, data.baseNode.visiKeyPoints.ToArray(), pos, azi, vel, rotaVel ) { }
public Ball(string name, float scale, Vector2 pos, float azi, Vector2 vel, float rotaVel) : base(name, "item", "Scorpion", Path.Combine(Directories.GameObjsDirectory, "Internal\\Ball"), GameObjData.Load(File.OpenRead(Path.Combine(Directories.GameObjsDirectory, "Internal\\Ball\\Ball.xml"))), scale, pos, azi, vel, rotaVel) { this.GetEyeableInfoHandler = new GetEyeableInfoHandler(GetItemInfo); }
private GameObject GetGameObjectFromGameObjectData(GameObjData god, GameObject go) { go.transform.position = god.position; go.transform.rotation = Quaternion.Euler(god.rotation); go.transform.localScale = god.scale; return(go); }
public static GameObjData CreateObj(params object[] param) { GameObject Object; if (string.IsNullOrEmpty((string)param[0])) { Object = new GameObject(); //创建 } else { string path = param[0] as string; if (string.IsNullOrEmpty(path)) { return(null); } Object = Resources.Load(path) as GameObject; //加载 if (Object == null) { return(null); } Object = GameObject.Instantiate(Object); } Transform parent = (Transform)param[1]; Object.SetActive(false); Object.transform.SetParent(parent); GameObjData gameObjDate = new GameObjData(Object); return(gameObjDate); }
public TankSinTur(string name, GameObjInfo objInfo, string texPath, GameObjData skinData, float raderLength, float raderAng, Color raderColor, float maxForwardSpeed, float maxBackwardSpeed, float maxRotaSpeed, float maxTurretRotaSpeed, float maxRaderRotaSpeed, float fireCDTime, Vector2 pos, float baseAzi) : this(name, objInfo, texPath, skinData, raderLength, raderAng, raderColor, 0, maxForwardSpeed, maxBackwardSpeed, maxRotaSpeed, maxTurretRotaSpeed, maxRaderRotaSpeed, fireCDTime, pos, 0, 0) { }
//对象池对象隐藏 private void InActiveGameObject() { if (pQueue.Count == 0) { return; } GameObjData obj = pQueue.Dequeue(); obj.gameObject.SetActive(false); Tpool.InActiveGameObject(obj); }
public DuelTank(string name, string texPath, GameObjData skinData, Vector2 pos, float Azi, string tankName, float tankRaderLength, float tankMaxForwardSpd, float tankMaxBackwardSpd, float live) : base(name, new GameObjInfo("DuelTank", tankName), texPath, skinData, tankRaderLength, MathHelper.Pi * 0.15f, Color.Yellow, tankMaxForwardSpd, tankMaxBackwardSpd, MathHelper.PiOver4, MathHelper.PiOver4, MathHelper.Pi, 0.8f, pos, Azi) { this.live = live; smoke = new SmokeGenerater(0, 30, Vector2.Zero, 0.3f, 0, false, this); this.GetEyeableInfoHandler = TankSinTur.GetCommonEyeInfoFun; }
public void Insert(GameObjData data) { if (!BoundUtils.Constains(bound, data.position)) { return; } if (gameObjs == null) { gameObjs = new List <GameObjData>(); } gameObjs.Add(data); }
public SceneData(GameObject camera, GameObject obj, GameObject light, GameObject cylinder) { infoRegister = new Dictionary <string, int>(); cameraData = new GameObjData(camera.transform); objData = new GameObjData(obj.transform); lightData = new GameObjData(light.transform); cylinderData = new GameObjData(cylinder.transform); infoRegister.Add("cam", 1); infoRegister.Add("obj", 1); infoRegister.Add("lit", 1); infoRegister.Add("cyl", 1); }
public void Insert(GameObjData data) { if (!BoundUtils.Constains(bound, data.position)) { return; } if (childs == null) { CreateChild(); } foreach (var child in childs) { child.Insert(data); } }
public TankSinTur(string name, GameObjInfo objInfo, string texPath, GameObjData skinData, float raderLength, float raderAng, Color raderColor, float raderAzi, float maxForwardSpeed, float maxBackwardSpeed, float maxRotaSpeed, float maxTurretRotaSpeed, float maxRaderRotaSpeed, float fireCDTime, Vector2 pos, float baseRota, float turretRota) { this.name = name; this.objInfo = objInfo; this.skin = new TankSkinSinTur(new TankSkinSinTurData(texPath, skinData)); skin.Initial(pos, baseRota, turretRota); controller = new TankContrSinTur(objInfo, new Sprite[] { skin.Sprites[0] }, pos, baseRota, maxForwardSpeed, maxBackwardSpeed, maxRotaSpeed, maxTurretRotaSpeed, maxRaderRotaSpeed, Math.Max(0, fireCDTime)); colChecker = controller; phisicalUpdater = controller; controller.onShoot += new EventHandler(controller_onShoot); controller.OnCollied += new OnCollidedEventHandler(controller_OnCollied); controller.OnOverlap += new OnCollidedEventHandler(controller_OnOverlap); rader = new Rader(raderAng, raderLength, pos, raderAzi + baseRota, raderColor); }
public GameObjData RestoreDataFromMemento(GameObjMemento memento) { return this.GameObject = memento.GetDataObject(); }
//留言回顾 public void ImgGet() { float t = Time.realtimeSinceStartup; //cameraImage.gameObject.SetActive(false); reviewMsgUI.SetActive(true); drawManager.isForbid = true; int index = 0; if (allTex2d.Count == 0) { if (loadType == LoadType.IO) { LoadAllPicture(); } else { StartCoroutine(LoadWWWAllPicture()); } } allTex2d.Sort(IndexSort); float t1 = Time.realtimeSinceStartup - t; //Debug.LogError(t1); t = Time.realtimeSinceStartup; if (allTex2d.Count > 0) { Transform topTrans = reviewMsgUI.transform.Find("Top").transform; Vector3 startpos = topTrans.localPosition + new Vector3(-610, 270); suncount = allTex2d.Count / 3; int count = allTex2d.Count; if (count < minCount) { count = minCount; suncount = count / 3; } //Debug.Log(pPool.GetActiveObjectCount()); for (int i = 0; i < Tpool.GetActiveObjectCount(); i++) { GameObjData objData = Tpool.GetActiveObject(i); GameObject obj = objData.gameObject; //obj.name = "item" + i; if (!obj.GetComponent <RawImage>()) { obj.AddComponent <RawImage>(); } obj.transform.SetParent(topTrans, false); obj.transform.localScale = Vector3.one; obj.transform.localPosition = Vector3.zero; if (!obj.GetComponent <ImageMove>()) { obj.AddComponent <ImageMove>(); } if (i - lastCount > allTex2d.Count - 1) { lastCount = i; } //最近的图片在最前 Texture2D tmp = allTex2d[i - lastCount];//allTex2d[i > allTex2d.Count - 1 ? UnityEngine.Random.Range(0, allTex2d.Count) : i]; //allTex2d[i]; tmp.filterMode = FilterMode.Point; obj.GetComponent <RawImage>().texture = tmp; obj.GetComponent <RectTransform>().sizeDelta = new Vector3(1296, 864); obj.GetComponent <RectTransform>().localScale = new Vector3(0.3f, 0.3f); if (i / 3 != index) { index = i / 3; startpos = topTrans.localPosition + new Vector3(-610 + index * 416, 270); } obj.transform.localPosition = startpos; startpos = startpos + new Vector3(0, -274); } float t2 = Time.realtimeSinceStartup - t; //Debug.LogError(t2); } }
//Memento, not that the stupid name does'nt give it away... public GameObjMemento(GameObjData gameData) { this.GameData = gameData; }
public TankSkinSinTurData(string texPath, GameObjData data) : this(Path.Combine(texPath, data.baseNode.texPaths[0]), Path.Combine(texPath, data.baseNode.childNodes[0].texPaths[0]), data.baseNode.floatDatas[0], data.baseNode.structKeyPoints[0], data.baseNode.structKeyPoints[1], data.baseNode.childNodes[0].structKeyPoints[0], data.baseNode.childNodes[0].structKeyPoints[0].Y, data.baseNode.visiKeyPoints.ToArray(), 3, 7, data.baseNode.intDatas[0]) { }
public TankSinTur(string name, GameObjInfo objInfo, string texPath, GameObjData skinData, float raderLength, float raderAng, Color raderColor, float raderAzi, float maxForwardSpeed, float maxBackwardSpeed, float maxRotaSpeed, float maxTurretRotaSpeed, float maxRaderRotaSpeed, float fireCDTime, Vector2 pos, float baseRota, float turretRota) { this.name = name; this.objInfo = objInfo; this.skin = new TankSkinSinTur(new TankSkinSinTurData(texPath, skinData)); skin.Initial(pos, baseRota, turretRota); controller = new TankContrSinTur(objInfo, new Sprite[] { skin.Sprites[0] } , pos, baseRota, maxForwardSpeed, maxBackwardSpeed, maxRotaSpeed, maxTurretRotaSpeed, maxRaderRotaSpeed, Math.Max(0, fireCDTime)); colChecker = controller; phisicalUpdater = controller; controller.onShoot += new EventHandler(controller_onShoot); controller.OnCollied += new OnCollidedEventHandler(controller_OnCollied); controller.OnOverlap += new OnCollidedEventHandler(controller_OnOverlap); controller.posAziChanged += new SmartTank.PhiCol.NonInertiasPhiUpdater.PosAziChangedEventHandler(controller_OnPosAziChanged); rader = new Rader(raderAng, raderLength, pos, raderAzi + baseRota, raderColor); }
public TankSkinSinTurData ( string texPath, GameObjData data ) : this( Path.Combine( texPath, data.baseNode.texPaths[0] ), Path.Combine( texPath, data.baseNode.childNodes[0].texPaths[0] ), data.baseNode.floatDatas[0], data.baseNode.structKeyPoints[0], data.baseNode.structKeyPoints[1], data.baseNode.childNodes[0].structKeyPoints[0], data.baseNode.childNodes[0].structKeyPoints[0].Y, data.baseNode.visiKeyPoints.ToArray(), 3, 7, data.baseNode.intDatas[0] ) { }
public void Insert(GameObjData go) { root.Insert(go); }
public DuelTank( string name, string texPath, GameObjData skinData , Vector2 pos, float Azi , string tankName, float tankRaderLength, float tankMaxForwardSpd, float tankMaxBackwardSpd , float live ) : base( name, new GameObjInfo( "DuelTank", tankName ) , texPath , skinData , tankRaderLength , MathHelper.Pi * 0.15f , Color.Yellow , tankMaxForwardSpd , tankMaxBackwardSpd , MathHelper.PiOver4 , MathHelper.PiOver4 , MathHelper.Pi , 0.8f , pos , Azi ) { this.live = live; smoke = new SmokeGenerater( 0, 30, Vector2.Zero, 0.3f, 0, false, this ); this.GetEyeableInfoHandler = TankSinTur.GetCommonEyeInfoFun; }
public void Set(GameObjData gameObject) { this.GameObject = gameObject; }
public ItemCommon(string name, string objClass, string script, string dataPath, GameObjData data, float scale, Vector2 pos, float azi, Vector2 vel, float rotaVel) : this(name, objClass, script, Path.Combine(dataPath, data.baseNode.texPaths[0]), data.baseNode.structKeyPoints[0], scale, data.baseNode.visiKeyPoints.ToArray(), pos, azi, vel, rotaVel) { }