コード例 #1
0
ファイル: Block.cs プロジェクト: nick-yangzj/MyMatch1
        // Crush block funtion
        override public void  BlockCrush(bool force)
        {
            if (destroying)
            {
                return;
            }
            if (eventCountBorn == SessionControl.Instance.eventCount && !force)
            {
                return;
            }

            eventCountBorn = SessionControl.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)
            {
                anim.Play("BlockCrush");
//	            AudioAssistant.Shot("BlockHit");
                _uiSprite.spriteName = spritesName[level - 1];
            }
        }
コード例 #2
0
ファイル: Branch.cs プロジェクト: nick-yangzj/MyMatch1
 public void Initialize()
 {
     gravity         = slot.GetComponent <SlotGravity> ();
     slot.gravity    = false;
     gravity.enabled = false;
     eventCountBorn  = SessionControl.Instance.eventCount;
 }
コード例 #3
0
ファイル: Boss.cs プロジェクト: nick-yangzj/MyMatch1
//		private Dragon _dragon;


        #region implemented abstract members of BlockInterface

        // Crush block funtion
        override public void  BlockCrush(bool force)
        {
            if (destroying)
            {
                return;
            }
            if (eventCountBorn == SessionControl.Instance.eventCount && !force)
            {
                return;
            }
            eventCountBorn = SessionControl.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(_dragon == null)
//					_dragon = FindObjectOfType<Dragon>();
//
//				if(_dragon == null) return;
//				_dragon.TakeDamage(Dragon.DamageConst);
//	//			anim.Play("BlockCrush");
//	//            AudioAssistant.Shot("BlockHit");
//				_dragon.IsPlayHitAnim = true;//PlayAnim(Dragon.E_DragonAnim.get_hit_front);
//
//	//			sr.sprite = sprites[level-1];

                //MyFrameWork.NetworkManager.Instance.ClientSendFightDataMsg(33);
                FightControl.Instance.AttackBoss();
//				if(_dragon == null)
//					_dragon = FindObjectOfType<Dragon>();
//
//				if(_dragon == null) return;

//				_dragon.IsPlayHitAnim = true;
//				_dragon.PlayAnim(Dragon.E_DragonAnim.get_hit_front);

//				//test
//				Protocol.ServerFightResult s2c = new Protocol.ServerFightResult();
//				s2c.result = Protocol.Result.FIGHT_WIN;
//				MyFrameWork.EventDispatcher.TriggerEvent<Protocol.MsgNo, Protocol.ServerFightResult>(Protocol.MsgNo.SERVER_FIGHT_RESULT.ToString(), Protocol.MsgNo.SERVER_FIGHT_RESULT, s2c);
            }
        }
コード例 #4
0
ファイル: Branch.cs プロジェクト: nick-yangzj/MyMatch1
        public override void BlockCrush(bool force)
        {
            if (eventCountBorn == SessionControl.Instance.eventCount && !force)
            {
                return;
            }
            if (destroying)
            {
                return;
            }
            eventCountBorn = SessionControl.Instance.eventCount;
            GameObject o = ResourceMgr.Instance.LoadAndInstanceGameObjectFromPreload(crushEffect);

            o.transform.position = transform.position;
            slot.gravity         = true;
//	        slot.SetScore(1);
            SlotGravity.Reshading();
            Destroy(gameObject);
            return;
        }
コード例 #5
0
ファイル: Weed.cs プロジェクト: nick-yangzj/MyMatch1
        IEnumerator DestroyingRoutine()
        {
            destroying = true;

            GameObject o = ResourceMgr.Instance.LoadAndInstanceGameObjectFromPreload(crushEffect);

            o.transform.position = transform.position;

//	        AudioAssistant.Shot("WeedCrush");
            anim.Play("JellyDestroy");
            while (anim.isPlaying)
            {
                yield return(0);
            }

            slot.gravity = true;
            slot.SetBlock(null);
            SlotGravity.Reshading();
            Destroy(gameObject);
        }
コード例 #6
0
 void  Awake()
 {
     slotForChip  = GetComponent <SlotForCard>();
     slotGravity  = GetComponent <SlotGravity>();
     slotTeleport = GetComponent <SlotTeleport>();
 }
コード例 #7
0
        // Field generator
        public IEnumerator CreateField()
        {
            //Utils.waitingStatus = "Level loading";
            DebugUtil.Info("Level loading");

            //删除原先布局,稍后用对象池
            SlotManager.Instance.DestroyAllSlot();

            if (GameEntrance.Instance.IsTestFight)
            {
                FightControl.Instance.EFightStatus = E_FightStatus.LoadingBoss3;

                field           = new MatchField(LevelProfile.CurrentLevelProfile.Width, LevelProfile.CurrentLevelProfile.Height);
                field.chipCount = LevelProfile.CurrentLevelProfile.CardCount;

                yield return(StartCoroutine(GenerateSlots()));

                _goSlotCreateBoss3.SetActive(true);

                yield return(StartCoroutine(GenerateBlocks()));

                SlotManager.Instance.Initialize();

                yield return(StartCoroutine(GenerateWalls()));

                SlotGravity.Reshading();

                //			yield return StartCoroutine(GenerateJelly());
                yield return(StartCoroutine(GenerateChips()));

                yield return(StartCoroutine(GeneratePowerups()));

                UIMgr.Instance.DestroyUI(E_UIType.UIMainPanel);

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



                FightControl.Instance.EFightStatus = E_FightStatus.FightBoss3;
            }
            else
            {
                for (int i = 0; i < FightControl.Instance.ModuleFight.LevelId.Length; i++)
                {
                    if (i == 0)
                    {
                        FightControl.Instance.EFightStatus = E_FightStatus.LoadingBoss1;
                    }
                    else if (i == 1)
                    {
                        FightControl.Instance.EFightStatus = E_FightStatus.LoadingBoss2;
                    }
                    else
                    {
                        FightControl.Instance.EFightStatus = E_FightStatus.LoadingBoss3;
                    }

                    field           = new MatchField(LevelProfile.CurrentLevelProfile.Width, LevelProfile.CurrentLevelProfile.Height);
                    field.chipCount = LevelProfile.CurrentLevelProfile.CardCount;

                    yield return(StartCoroutine(GenerateSlots()));

                    yield return(StartCoroutine(GenerateBlocks()));

                    SlotManager.Instance.Initialize();

                    yield return(StartCoroutine(GenerateWalls()));

                    SlotGravity.Reshading();

                    //			yield return StartCoroutine(GenerateJelly());
                    yield return(StartCoroutine(GenerateChips()));

                    yield return(StartCoroutine(GeneratePowerups()));
                }

                FightControl.Instance.EFightStatus = E_FightStatus.PreviewScene;
            }


//			SUBoosterButton.Generate(Slot.folder);
        }
コード例 #8
0
ファイル: SlotGravity.cs プロジェクト: nick-yangzj/MyMatch1
        // Update shadows at all slots (for example, after the blocks destruction)
        public static void  Reshading()
        {
            SlotGravity sg = null;

            foreach (var slotItem in SlotManager.Instance.DicSlotNow.Values)
            {
                sg = slotItem.slotGravity;

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

            Slot                 slot;
            List <Slot>          stock     = new List <Slot>();
            List <SlotGenerator> generator = new List <SlotGenerator>(GameObject.FindObjectsOfType <SlotGenerator>());

            // Gravity shading
            foreach (SlotGenerator sgen in generator)
            {
                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;
            }

            int telePortLen = GameObject.FindObjectsOfType <SlotTeleport>().Length;

            if (telePortLen > 0)
            {
                DebugUtil.Info("SlotTeleport count: " + telePortLen);

                // Teleport shading
                foreach (SlotGenerator sgen in generator)
                {
                    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();
        }