예제 #1
0
        /// <summary>
        /// 充能
        /// </summary>
        /// <param name="type">Type.</param>
        public void AddEnergy(E_AddEnergyType type)
        {
            float addEnergy = 0f;

            if (type == E_AddEnergyType.Normal)
            {
                addEnergy = NormalAddEnergy;
            }
            else if (type == E_AddEnergyType.Powup)
            {
                addEnergy = PowupAddEnergy;
            }
            else if (type == E_AddEnergyType.Stone)
            {
                addEnergy = EnergyStone;
            }
            else if (type == E_AddEnergyType.Recovery)
            {
                addEnergy = RecoverEnergy;
            }
//			else if(type == E_AddEnergyType.UseSkill)
//				addEnergy = -3;//-MaxEnergy;

//			DebugUtil.Debug("加能量:" + addEnergy);
            Energy += addEnergy;

            FightMgr.Instance.RefreshEnergy(Energy);

            if (!FightMgr.Instance.IsTriggerEnergyForTutorial && Energy >= SkillModuleMgr.Instance.MinNeedEnergy)
            {
                FightMgr.Instance.IsTriggerEnergyForTutorial = true;
                //能量满了,通知新手引导
                EventDispatcher.TriggerEvent <int, int>(FightDefine.Event_HasEnergy, (int)Energy, SkillModuleMgr.Instance.MinSkillId);
            }
        }
예제 #2
0
        public void PlayEnergySmall(float delay, Queue <FlyingBezier> pool, List <FlyingBezier> list, E_AddEnergyType addType, System.Action <E_AddEnergyType> OnFinish)
        {
            //			if(!FightMgr.Instance.isPlaying) return;

            if (_anim == null)
            {
                _anim = GetComponent <Animation>();
            }

            if (_bezier == null)
            {
                _bezier = new Bezier();
            }

            Vector3 target = Vector3.zero;
            float   x      = (this.transform.localPosition.x - target.x) * 0.33f;
            float   y      = (this.transform.localPosition.y - target.y) * 0.5f;

            _bezier.SetParas(this.transform.localPosition, new Vector3(x, y, 0), target, target);
            _canMove = false;
            _arrive  = false;

            onFinishEnergySmall = OnFinish;
            _addEnergyType      = addType;

            FightMgr.Instance.StartCoroutine(Move(delay, pool, list));
        }
예제 #3
0
        /// <summary>
        /// 自己boss充能
        /// </summary>
        /// <param name="type">Type.</param>
        public void AddEnergy(E_AddEnergyType type)
        {
            BossData boss = CurrentMyBoss;

            if (boss != null)
            {
                boss.AddEnergy(type);

//				if(boss.IsCanUseSkill)
//					SkillAttackBoss();
            }
            else
            {
                DebugUtil.Error("增加本方Boss能量,本方boss不存在");
            }
        }
예제 #4
0
        public void AddEnergySmall(Transform posParent, E_AddEnergyType addType)
        {
//			if(!FightMgr.Instance.isPlaying) return;

            if (FightMgr.Instance.limitationRoutineIsOver)
            {
                //游戏结束了
                return;
            }

            int   count = GetEnergyCount(addType);
            float delay = 0f;
            List <FlyingBezier> list = new List <FlyingBezier>();

            for (int i = 0; i < count; i++)
            {
                FlyingBezier obj = null;

                if (_poolsEnergy.Count > 0)
                {
                    obj = _poolsEnergy.Dequeue();
                }
                else
                {
                    obj = FightMgr.Instance.LoadAndInstantiate(FightDefine.Prefab_Particle_EnergySmall).GetComponent <EnergySmall>();                   // ResourceMgr.Instance.LoadAndInstanceGameObjectFromPreload(FightDefine.ParticleCardCrush);
                }
                list.Add(obj);

                obj.transform.SetParent(posParent, false);
                obj.transform.localPosition = new Vector3(Random.Range(-26f, 26f), Random.Range(-26f, 26f), 0);
                obj.transform.SetParent(FieldMgr.MyBossPosEffect);
                obj.gameObject.SetActive(false);
                obj.Speed = 0.8f;
                (obj as EnergySmall).PlayEnergySmall(delay, _poolsEnergy, list, addType, OnFinishEnergySmall);
                delay += 0.1f;
            }

//			FightMgr.Instance.StartCoroutine(AddEnergy(addType,list));
        }
예제 #5
0
        // Crush block funtion
        override public void  BlockCrush(bool force, Transform parent, bool isDirect = false, E_CardType cardType = E_CardType.None)
        {
            if (destroying)
            {
                return;
            }
            if (eventCountBorn == FightMgr.Instance.eventCount && !force)
            {
                return;
            }
            eventCountBorn = FightMgr.Instance.eventCount;
            //		level --;
            //FieldAssistant.Instance.field.blocks[slot.Row, slot.Col] = level;

            if (level == 0)
            {
                slot.gravity = true;
//	            slot.SetScore(1);
                slot.SetBlock(null);
                SlotGravity.Reshading();
                StartCoroutine(DestroyingRoutine());
                return;
            }

            if (level > 0)
            {
//				#if !FightTest
//				FightMgr.Instance.AttackBoss();
//				#endif

                                #if !FightTest
                E_AddEnergyType addType = isDirect ? E_AddEnergyType.Powup : E_AddEnergyType.Normal;
//				FightMgr.Instance.AddEnergy(addType);
                EnergyMgr.Instance.AddEnergySmall(parent, addType);
                                #endif
            }
        }
예제 #6
0
        private int GetEnergyCount(E_AddEnergyType addType)
        {
            int rtnCount = 0;

            if (addType == E_AddEnergyType.Normal)
            {
                rtnCount = Mathf.CeilToInt(BossData.NormalAddEnergy * 10);
            }
            else if (addType == E_AddEnergyType.Powup)
            {
                rtnCount = Mathf.CeilToInt(BossData.PowupAddEnergy * 10);
            }
            else if (addType == E_AddEnergyType.Stone)
            {
                rtnCount = Mathf.CeilToInt(BossData.EnergyStone * 10);;
            }
            else if (addType == E_AddEnergyType.Recovery)
            {
                rtnCount = Mathf.CeilToInt(BossData.RecoverEnergy * 10);
            }

//			rtnCount *= 1;
            return(Mathf.Min(rtnCount, 10));
        }
예제 #7
0
 private void OnFinishEnergySmall(E_AddEnergyType addType)
 {
     FightMgr.Instance.AddEnergy(addType);
 }