Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
 void createBullet2(params object[] paras)
 {
     if (paras == null)
     {
         return;
     }
     object[] list = (object[])(paras[0]);
     if (list.Length >= 7)
     {
         CLUnit  attacker = (CLUnit)(list[0]);
         CLUnit  target   = (CLUnit)(list[1]);
         Vector3 orgPos   = (Vector3)(list[2]);
         Vector3 dir      = (Vector3)(list[3]);
         object  attr     = (object)(list[4]);
         object  data     = (object)(list[5]);
         object  callbak  = (object)(list[6]);
         CLBulletBase.fire(attacker, target, orgPos, dir, attr, data, callbak);
     }
     list = null;
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        IEnumerator createBullet(CLUnit attacker, CLUnit target, Vector3 orgPos, Vector3 dir, object attr, object data, object callbak, float waitSeconds)
        {
            yield return(new WaitForSeconds(waitSeconds));

            CLBulletBase.fire(attacker, target, orgPos, dir, attr, data, callbak);
        }