Beispiel #1
0
        static void onFinishBorrowBullet(params object[] args)
        {
            CLBulletBase bullet = (CLBulletBase)(args [1]);

            if (bullet != null)
            {
                ArrayList list     = (ArrayList)(args [2]);
                CLUnit    attacker = (CLUnit)(list [0]);
                CLUnit    target   = (CLUnit)(list [1]);
                Vector3   orgPos   = (Vector3)(list [2]);
                Vector3   dir      = (Vector3)(list [3]);
                object    attr     = (list [4]);
                object    data     = (list [5]);
                object    callbak  = list [6];
//				fire (attacker, target, orgPos, dir, attr, data, callbak);
                bullet.doFire(attacker, target, orgPos, dir, attr, data, callbak);
                NGUITools.SetActive(bullet.gameObject, true);
            }
        }
Beispiel #2
0
        public static CLBulletBase fire(CLUnit attacker, CLUnit target, Vector3 orgPos,
                                        Vector3 dir, object attr, object data, object callbak)
        {
            if (attr == null || attacker == null)
            {
                Debug.LogError("bullet attr is null");
                return(null);
            }

            string bulletName = MapEx.getString(attr, "PrefabName");

            if (!CLBulletPool.havePrefab(bulletName))
            {
                ArrayList list = new ArrayList();
                list.Add(attacker);
                list.Add(target);
                list.Add(orgPos);
                list.Add(dir);
                list.Add(attr);
                list.Add(data);
                list.Add(callbak);
                CLBulletPool.borrowObjAsyn(bulletName, (Callback)onFinishBorrowBullet, list, null);
                return(null);
            }

            CLBulletBase bullet = CLBulletPool.borrowObj(bulletName);

            if (bullet == null)
            {
                return(null);
            }

            bullet.doFire(attacker, target, orgPos, dir, attr, data, callbak);
            NGUITools.SetActive(bullet.gameObject, true);
//		bullet.FixedUpdate();
            return(bullet);
        }