示例#1
0
        public static BulletData Create(Vector3 pos)
        {
            BulletData data = ReferencePool.Acquire <BulletData>();

            data.m_Pos = pos;
            return(data);
        }
示例#2
0
        protected internal override void OnShow(object userData)
        {
            base.OnShow(userData);

            BulletData data = userData as BulletData;

            Log.Debug("bullet on show " + data);
        }
示例#3
0
        protected internal override void OnInit(object userData)
        {
            base.OnInit(userData);

            BulletData data = userData as BulletData;

            CachedTransform.position = data.Pos;
        }
示例#4
0
        // Update is called once per frame
        void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                Vector3 touchPos = Input.mousePosition;
                touchPos.z = 5;
                Vector3 pos = Camera.main.ScreenToWorldPoint(touchPos);
                Debug.Log(pos + "  " + Input.mousePosition);
                //pos.z = 0;
                entityId++;
                m_EntityManager.ShowEntity(entityId, "Assets/Game/Res/Prefabs/bullet/bullet.prefab", "bullet", typeof(Bullet), BulletData.Create(pos));
                bulletIds.Add(entityId);
            }

            if (Input.GetMouseButtonDown(1))
            {
                if (bulletIds.Count > 0)
                {
                    int id = bulletIds[0];
                    m_EntityManager.HideEntity(id, null);
                    bulletIds.RemoveAt(0);
                }
            }
        }