Example #1
0
		public static Bullet Create(int kid)
		{
			Bullet bullet = new Bullet();
			bullet.Uid = Guid.NewGuid().ToString();
			bullet.Data = BulletDataManager.Instance.GetData(kid) as BulletData;
			bullet.Script = ResourceManager.Instance.LoadAsset<BulletScript>(ObjectType.GameObject, bullet.Data.GetResPath());
			bullet.Script.transform.parent = RootTransform.Instance.BulletRoot;	
			bullet.Script.CallbackUpdate = bullet.Update;
			bullet.Script.CallbackHit = bullet.OnHit;
			bullet.Script.CallbackDestroy = bullet.OnDestroy;
			bullet.battleProxy = ApplicationFacade.Instance.RetrieveProxy<BattleProxy>();
			
			return bullet;
		}
Example #2
0
		public static void Recycle(Bullet bullet)
		{
			if (bullet != null)
			{
				bullet.Data = null;
				bullet.Script.CallbackUpdate = null;
				bullet.Script.CallbackHit = null;
				bullet.Script.CallbackDestroy = null;
				bullet.Script.StopAllCoroutines();
				ResourceManager.Instance.RecycleAsset(bullet.Script.gameObject);
				bullet.Script = null;
				bullet.battleProxy = null;
				bullet.timeCounter = 0f;
			}
			else
			{
				BaseLogger.Log("Recyle a null bullet!");
			}
		}
Example #3
0
		private void HandleBulletDespawn(Bullet bullet)
		{
			bulletProxy.RemoveBullet(bullet.Uid);
		}
Example #4
0
		private void HandleBulletSpawn(Bullet bullet)
		{
			bulletProxy.AddBullet(bullet);
		}