Пример #1
0
 public virtual void stop()
 {
     if (isStoped)
     {
         return;
     }
     CancelInvoke("timeOut");
     isStoped  = true;
     isFireNow = false;
     NGUITools.SetActive(gameObject, false);
     CLBulletPool.returnObj(this);
 }
Пример #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);
        }