Beispiel #1
0
 protected override void OnTriggerEnter2D(Collider2D collision)
 {
     base.OnTriggerEnter2D(collision);
     if ("PowerBox".Equals(collision.tag))
     {
         currentPowerBoxNum++;
         if (currentPowerBoxNum > maxPowerBoxNum)
         {
             currentPowerBoxNum = 1;
         }
         PoolTool.Recycling(collision.gameObject);
     }
     else if ("RevivalBox".Equals(collision.tag))
     {
         revival++;
         PoolTool.Recycling(collision.gameObject);
     }
     else if ("Option".Equals(collision.tag))
     {
         Option option = collision.GetComponent <Option>();
         if (option != null)
         {
             AddOption(option);
         }
     }
 }
Beispiel #2
0
 protected virtual void Die()
 {
     isAlive = false;
     //PoolTool.Recycling(gameObject);
     Disappear();
     PoolTool.GetGameObject(explosionEffectPoolName, transform.position, Quaternion.identity);
 }
Beispiel #3
0
 private void SpawMember()
 {
     memberInstances = new GameObject[memberCount];
     for (int i = 0; i < memberCount; i++)
     {
         memberInstances[i] = PoolTool.GetGameObject(memberPoolName, transform.position + spacing * i, Quaternion.identity);
     }
 }
Beispiel #4
0
 protected virtual void Shoot()
 {
     for (int i = 0; i < barrelGameObjs.Length; i++)
     {
         GameObject          instance  = PoolTool.GetGameObject(poolName, barrelGameObjs[i].transform.position, barrelGameObjs[i].transform.rotation);
         BaseClass.Something something = instance.GetComponent <BaseClass.Something>();
         something.team = team;
     }
 }
Beispiel #5
0
        private bool GroupUpOption()
        {
            if (currentOptionNum >= maxOptionNum)
            {
                return(false);
            }
            GameObject optionInstance = PoolTool.GetGameObject("Option", transform.position, Quaternion.identity);

            AddOption(optionInstance.GetComponent <Option>());
            return(true);
        }
Beispiel #6
0
        private void SpawBox()
        {
            float randomF = Random.Range(0, 10);

            if (randomF < 0.1)
            {
                PoolTool.GetGameObject("RevivalBox", lastMemberTrans.position, Quaternion.identity);
            }
            else
            {
                PoolTool.GetGameObject("PowerBox", lastMemberTrans.position, Quaternion.identity);
            }
        }
Beispiel #7
0
    //----------------内部调用------------------
    #region 内部调用
    /// <summary>
    /// 场景加载方法
    /// </summary>
    IEnumerator DoLoad(string sceneName)
    {
        _Async = SceneManager.LoadSceneAsync(sceneName);
        yield return(_Async);

        NowSceneName = sceneName;
        _Async       = null;
        TimeTool.Instacne.DoWaitForEndOfFrame(() =>     //等一帧,测试下
        {
            PoolTool.CreateScenePool();
            if (_OnLoadOver != null)
            {
                _OnLoadOver.Invoke();
            }
        });
    }
Beispiel #8
0
 /// <summary>
 /// CS脚本显示UI
 /// </summary>
 public void ShowCSUI(uint id, Action <GameObject> callback)
 {
     if (callback != null)
     {
         _Callback[id] = callback;
     }
     //看此UI是否已加载
     if (_AllUI.ContainsKey(id))
     {
         LoggerHelper.Debug("一个UI显示出来了:    " + _AllUI[id].ConfigTable.Name);
         //已加载,开始显示
         MyShowUI(id);
         var _obj = _AllUI[id].MyCanvas.gameObject;
         //显示完成后,回调
         Action <GameObject> _callback;
         _Callback.TryGetValue(id, out _callback);
         if (_callback != null)
         {
             _Callback.Remove(id);
             _callback.Invoke(_obj);
         }
         //发送MVC消息
         Facade.Instance.SendNotification(string.Concat(_obj.name, MVCNameConst.UI_UIShow));
     }
     else
     {
         //未加载,开始加载
         if (_UIConfig != null)
         {
             UIConfigTable _table = _UIConfig.GetData(id);
             if (_table != null)
             {
                 PoolTool.GetGameObject(_table.Name, _table.AssetName, LoadUIBack, _table, EPoolAddType.No);
             }
             else
             {
                 Debug.Log("在UIConfigTable中,不存在此ID:" + id);
             }
         }
         else
         {
             Debug.Log("UI配置表未加载!");
         }
     }
 }