Exemple #1
0
    private void LoadAttackEffectCompleteCB(GameObject gameObj, System.Guid uid, params object[] param)
    {
        if (gameObj != null)
        {
            GameObject createObj = Instantiate(gameObj) as GameObject;

            createObj.transform.parent = GameManager.Instance.rootPanelArray[(int)GameManager.eRootPanelType.Type_Effect].transform;

            createObj.transform.localScale    = gameObj.transform.localScale;
            createObj.transform.localPosition = Vector3.zero;

            SpriteEffect effect = createObj.GetComponent <SpriteEffect>();
            if (effect != null)
            {
                if (param.Length.Equals(2))
                {
                    effect.Init((Transform)param[0], (EffectTable.TableRow)param[1]);
                }
                else if (param.Length.Equals(3))
                {
                    effect.Init((Transform)param[0], (EffectTable.TableRow)param[1], (SpriteEffect.EffectCompleteCB)param[2]);
                }
            }
        }
    }
Exemple #2
0
    public void Sell()
    {
        StopAllCoroutines();

        SpriteEffect effect = null;

        if (PoolManager.Instance != null && PoolManager.Instance.GetEffectFromPool((int)EffectTable.eEffectType.Type_Tower_Sell, out effect))
        {
            effect.Init(transform);
        }
        else
        {
            EffectTable.TableRow effectTable = null;
            if (EffectTable.Instance.FindTable((int)EffectTable.eEffectType.Type_Tower_Sell, out effectTable))
            {
                LoadAssetbundle.LoadPrefabCB loadPrefabCB = new LoadAssetbundle.LoadPrefabCB(LoadDestroyEffectCompleteCB);
                PrefabManager.Instance.LoadPrefab(effectTable.effectPath, System.Guid.NewGuid(), loadPrefabCB, effectTable);
            }
        }

        if (TowerManager.Instance != null)
        {
            TowerManager.Instance.RemoveTowerList(this);
        }

        if (PoolManager.Instance != null)
        {
            PoolManager.Instance.AddTowerPool(this);
        }
        if (GameManager.Instance != null)
        {
            GameManager.Instance.AddGameGold(status.GetSellPrice);
        }
    }
Exemple #3
0
    private void LoadDamageEffectCompleteCB(GameObject gameObj, System.Guid uid, params object[] param)
    {
        if (gameObj != null)
        {
            GameObject createObj = Instantiate(gameObj) as GameObject;

            createObj.transform.parent     = GameManager.Instance.rootPanelArray[(int)GameManager.eRootPanelType.Type_Effect].transform;
            createObj.transform.localScale = gameObj.transform.localScale;

            SpriteEffect effect = createObj.GetComponent <SpriteEffect>();
            if (effect != null)
            {
                effect.Init(effectDummy, (EffectTable.TableRow)param[0]);
            }
        }
    }
Exemple #4
0
 private void LoadAttackEffect(Transform target, SpriteEffect.EffectCompleteCB effectCompleteCB)
 {
     if (status.GetEffectTable != null)
     {
         SpriteEffect effect = null;
         if (PoolManager.Instance != null && PoolManager.Instance.GetEffectFromPool(status.GetEffectTable.id, out effect))
         {
             effect.Init(target, effectCompleteCB);
         }
         else
         {
             LoadAssetbundle.LoadPrefabCB loadEffectCB = new LoadAssetbundle.LoadPrefabCB(LoadAttackEffectCompleteCB);
             PrefabManager.Instance.LoadPrefab(status.GetEffectTable.effectPath, System.Guid.NewGuid(),
                                               loadEffectCB, target, status.GetEffectTable, effectCompleteCB);
         }
     }
 }
Exemple #5
0
    private void SetDamageEffect(DamageParam param)
    {
        SpriteEffect effect = null;

        if (PoolManager.Instance != null && PoolManager.Instance.GetEffectFromPool(param.GetDamageEffectID, out effect))
        {
            effect.Init(effectDummy);
        }
        else
        {
            EffectTable.TableRow effectTable = null;
            if (EffectTable.Instance.FindTable(param.GetDamageEffectID, out effectTable))
            {
                LoadAssetbundle.LoadPrefabCB loadDamageEffectPrefabCB = new LoadAssetbundle.LoadPrefabCB(LoadDamageEffectCompleteCB);
                PrefabManager.Instance.LoadPrefab(effectTable.effectPath, System.Guid.NewGuid(), loadDamageEffectPrefabCB, effectTable);
            }
        }
    }
Exemple #6
0
 private void SetAttackEffect(SpriteEffect effect, Transform parent)
 {
     effect.gameObject.transform.localRotation = gameObject.transform.localRotation;
     effect.Init(parent);
 }