Example #1
0
        private void LoadSummon(UnitAnimatorEvent uae, int skillId, int modelId)
        {
            UnitSkillsProto.UnitSkill skillData = controller.GetUnitSkillData(skillId);
            //3 summon
            if (skillData.CarrierType == 3)
            {
                SummonProto.Summon summonData = controller.GetSummonData(skillData.CarrierID);

                if (summonData.Show_summon_time == 0)
                {
                    return;
                }

                curShowSummonData         = new ShowSummonData();
                curShowSummonData.modelId = modelId;
                curShowSummonData.canShow = false;

                string[] pos = summonData.Show_summon_pos.Split('|');
                if (pos.Length != 3)
                {
                    DebugUtils.LogError(DebugUtils.Type.UI, "unit show summon postion err! pos:" + summonData.Show_summon_pos);
                }
                else
                {
                    curShowSummonData.pos = new Vector3(float.Parse(pos[0]), float.Parse(pos[1]), float.Parse(pos[2]));
                }

                DataManager.GetInstance().AddMainMenuCacheId(summonData.Show_model_id);

                loadManager.LoadAssetAsync <GameObject, int>(summonData.Show_model_id, LoadSummonComplete, modelId);
                uae.AddEvent(summonData.Show_summon_time, modelId.ToString(), ShowSummonTime);
            }
        }
Example #2
0
 private void CameraShakeHandler(UnitAnimatorEvent uae, string[] times, string[] levels, int modelID)
 {
     if (times.Length != levels.Length)
     {
         DebugUtils.LogError(DebugUtils.Type.UI, "The unit table data field length is inconsistent, show_shake_time!=show_shake_num");
         return;
     }
     //times = new string[] { "1.5", "1.8", "2.5" };
     for (int i = 0; i < times.Length; i++)
     {
         uae.AddEvent(float.Parse(times[i]), string.Concat(levels[i], "|", modelID), ShowCameraShake);
     }
 }
Example #3
0
        private void UnitShow(GameObject effect, int modelID)
        {
            if (goUnitModelGameObject == null)
            {
                return;
            }

            unitModelGameObject = GameObject.Instantiate(goUnitModelGameObject);
            unitModelGameObject.transform.SetParent(unitParent, false);
            UnitAnimatorEvent unitAnimatorEvent = unitModelGameObject.AddComponent <UnitAnimatorEvent>();

            unitAnimatorEvent.Init();
            GameObject.Instantiate(effect).transform.SetParent(unitModelGameObject.transform, false);

            string[] shakeTimes = curUnitData.show_shake_time.Split('|');
            if (shakeTimes.Length > 0 && float.Parse(shakeTimes[0]) != 0)
            {
                string[] shakeLevels = curUnitData.show_shake_num.Split('|');
                CameraShakeHandler(unitAnimatorEvent, shakeTimes, shakeLevels, modelID);
            }

            LoadSummon(unitAnimatorEvent, curUnitData.SkillID, curUnitData.show_model_res);
            LoadSummon(unitAnimatorEvent, curUnitData.SkillID2, curUnitData.show_model_res);
        }