Exemplo n.º 1
0
//
        public void Initialize()
        {
            gravity         = slot.GetComponent <SlotGravity> ();
            slot.gravity    = false;
            gravity.enabled = false;
            eventCountBorn  = FightMgr.Instance.eventCount;
        }
Exemplo n.º 2
0
        IEnumerator DestroyingRoutine()
        {
            destroying = true;

            GameObject o = FightMgr.Instance.LoadAndInstantiate(FightDefine.Prefab_Particle_WeedCrush);

            o.transform.position = transform.position;

                        #if !FightTest
            MusicManager.Instance.PlaySoundEff("Music/WeedCrushMusic");
                        #endif
            anim.Play("JellyDestroy");

            slot.gravity = true;
            slot.SetBlock(null);
            SlotGravity.Reshading();

            while (anim.isPlaying)
            {
                yield return(0);
            }


            Destroy(gameObject);
        }
Exemplo n.º 3
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--;
            FieldMgr.field.blocks[slot.Point.X, slot.Point.Y] = level;
            if (level == 0)
            {
                slot.gravity = true;
//	            slot.SetScore(1);
                slot.SetBlock(null);
                SlotGravity.Reshading();
                StartCoroutine(DestroyingRoutine());
                return;
            }
            if (level > 0)
            {
                anim.Play("BlockCrush");
                                #if !FightTest
                MusicManager.Instance.PlaySoundEff("Music/BlockHit");
                                #endif
                _uiSprite.spriteName = spritesName[level - 1];
            }
        }
Exemplo n.º 4
0
        void  Awake()
        {
//			slotForChip = GetComponent<SlotForCard>();
            slotGravity  = GetComponent <SlotGravity>();
            slotTeleport = GetComponent <SlotTeleport>();

            _animIceBlock = transform.Find("IceBlock").GetComponent <Animation>();
            _animIceGloss = _animIceBlock.transform.Find("Gloss").GetComponent <Animation>();
        }
Exemplo n.º 5
0
        private void DoFlyBlockToMyself()
        {
            _isDoSkillToSlot = true;

            var listTarget = _filedMgr.FindFlyBlockTargetSlots(_FlyBlockToMyCnt);

            List <FlyingBezier> list = new List <FlyingBezier>();

            for (int i = 0; i < listTarget.Count; i++)
            {
                FlyingBezier         obj  = null;
                Queue <FlyingBezier> pool = null;
                bool isBlock = true;                //Random.Range(1,1000) <= 750;
                if (isBlock)
                {
                    //木块
                    if (_poolsBlock.Count > 0)
                    {
                        obj = _poolsBlock.Dequeue();
                    }
                    else
                    {
                        obj = FightMgr.Instance.LoadAndInstantiate(FightDefine.Prefab_Flying_Block).GetComponent <BlockFlyToOpp>();                       // ResourceMgr.Instance.LoadAndInstanceGameObjectFromPreload(FightDefine.ParticleCardCrush);
                    }

                    pool = _poolsBlock;
                }

                obj.transform.SetParent(goBossOpp.transform, false);
                obj.transform.localPosition = new Vector3(Random.Range(-46f, 46f), Random.Range(-46f, 46f), 0);
                obj.transform.SetParent(listTarget[i].transform);
                obj.gameObject.SetActive(false);
                obj.Speed = 0.8f;
                (obj as BlockFlyToOpp).Play(i * 0.3f, pool, list, false,
                                            () =>
                {
                    SlotGravity.Reshading();
                    _isDoSkillToSlot = false;
                    EventCounter();
                },
                                            listTarget[i],
                                            (targetSlot) =>
                {
                    _filedMgr.CreateOneBlock(targetSlot);
                });
            }

            _FlyBlockToMyCnt = 0;
        }
Exemplo n.º 6
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
            }
        }
Exemplo n.º 7
0
//

        /// <summary>
        /// 默认generator的shadow为true,出生点线路上的置为false
        /// </summary>
        // Update shadows at all slots (for example, after the blocks destruction)
        public static void Reshading()
        {
            SlotGravity sg       = null;
            List <Slot> listSlot = FightMgr.Instance.GetSlotsList();
            Slot        slotItem;

            for (int i = 0; i < listSlot.Count; i++)
            {
                slotItem = listSlot[i];

                sg = slotItem.slotGravity;
                if (sg != null)
                {
                    sg.shadow = true;
                }
            }

            Slot                 slot;
            List <Slot>          stock     = new List <Slot>();
            List <SlotGenerator> generator = FightMgr.Instance.AllSlotGenerator;
            // Gravity shading
            SlotGenerator sgen;

            for (int i = 0; i < generator.Count; i++)
            {
                sgen = generator[i];

                if (!sgen.IsInUse)
                {
                    return;
                }

                slot = sgen.Slot;
                stock.Clear();
                while (slot && slot.Block == null && slot.slotGravity.shadow && !stock.Contains(slot))
                {
                    slot.slotGravity.shadow = false;
                    stock.Add(slot);
                    slot = slot[slot.slotGravity.gravityDirection];
                }
                sgen.Slot.slotGravity.shadow = false;
            }


            if (FightMgr.Instance.AllSlotTeleport.Count > 0)
            {
//				DebugUtil.Info("SlotTeleport count: " + telePortLen);

                // Teleport shading
                for (int i = 0; i < generator.Count; i++)
                {
                    sgen = generator[i];

                    if (!sgen.IsInUse)
                    {
                        continue;
                    }

                    slot = sgen.Slot;
                    stock.Clear();
                    while (slot && slot.Block == null && !stock.Contains(slot))
                    {
                        slot.slotGravity.shadow = false;
                        stock.Add(slot);
                        if (slot.slotTeleport)
                        {
                            slot = slot.slotTeleport.TargetSlot;
                        }
                        else
                        {
                            slot = slot[slot.slotGravity.gravityDirection];
                        }
                    }

                    sgen.Slot.slotGravity.shadow = false;
                }
            }


            //foreach (SlotGravity s in GameObject.FindObjectsOfType<SlotGravity>())
            //    ScoreBubble.Bubbling(s.shadow ? 1 : 0, s.transform, 0);

            //Debug.Break();
        }
Exemplo n.º 8
0
        public IEnumerator CreateMap(int level)
        {
            //加载当前地图
            Fight.LevelProfile.NewCurrentLevelProfile = Fight.Level.AllLevels[level];

            //保存地图数据
            _currentLevelProfile = Fight.LevelProfile.NewCurrentLevelProfile;
            field           = new MatchField(_currentLevelProfile.Width, _currentLevelProfile.Height);
            field.chipCount = _currentLevelProfile.CardCount;

            //生成底图
            yield return(FightMgr.Instance.StartCoroutine(GenerateSlots()));

            //生成障碍物
            yield return(FightMgr.Instance.StartCoroutine(GenerateBlocks()));

            InitializeSlot();

            yield return(FightMgr.Instance.StartCoroutine(GenerateWalls()));

            SlotGravity.Reshading();

            //yield return StartCoroutine(GenerateJelly());
            yield return(FightMgr.Instance.StartCoroutine(GenerateChips()));

            yield return(FightMgr.Instance.StartCoroutine(GeneratePowerups()));


            yield return(FightMgr.Instance.StartCoroutine(GenerateBoss()));

                        #if FightTest
            //可以开始
            for (int i = 0; i < MyBossRoot.childCount; i++)
            {
                MyBossRoot.GetChild(i).gameObject.SetActive(true);
            }

            for (int i = 0; i < EnemyRoot.childCount; i++)
            {
                EnemyRoot.GetChild(i).gameObject.SetActive(true);
            }

            yield return(new WaitForSeconds(1f));

            FightMgr.Instance.isPlaying = true;
                        #else
            //UIMatching._instance.ShowEffect(0);
            yield return(new WaitForSeconds(0.3f));

            EventDispatcher.TriggerEvent <int>(UIFight.BossCreateEvent, 0);
//			yield return new WaitForSeconds(1f);

            //UIMgr.Instance.DestroyUI(E_UIType.UIMainPanel);

            EventDispatcher.TriggerEvent(UIFight.BeginStartTime);

            MusicManager.Instance.PlaySoundEff("Music/readyGo");

//			FightMgr.Instance.RefreshEnergy(0f);

            FightMgr.Instance.isPlaying  = true;
            FightMgr.Instance.IsFighting = true;
#endif
            EventDispatcher.TriggerEvent(FightDefine.Event_LevelLoadOver);

            //新生成的
            if (FightMgr.Instance.ListNewPowerUp.Count > 0)
            {
                EventDispatcher.TriggerEvent <Slot, E_CardType>(FightDefine.Event_HasNewBomb, FightMgr.Instance.ListNewPowerUp[0].Slot, FightMgr.Instance.ListNewPowerUp[0].CardType);
                FightMgr.Instance.ListNewPowerUp.Clear();
            }
        }