Exemplo n.º 1
0
        public override void OnStartTurn()
        {
            base.OnStartTurn();
            //
            _bim.locked = true;
            //
            switch (state)
            {
            case ENTRANCE:
            {
                _bui.ShowBossWarningVFX(BOSSWARNING_TIME, GotoNextState);
                remainTalk = bossTalk_1_num;
                break;
            }

            case STAGE_1:
            {
                var t = _bfm.Field.GetRandomTile("Bunker.Game.NormalTile", true);
                if (t != null)
                {
                    var robot = _rmm.CreateRobot <RobotThief>();
                    robot.SetToGird(t.ParentGrid);
                    robotDeployCounter++;
                    _bui.ShowBossTalkingVFX(DIALOG_TIME, dialogues[bossTalk_1_during], null);
                }
                break;
            }

            case STAGE_2:
            {
                MissionManager.getInstance.ConsumeStep();
                _bui.ShowBossTalkingVFX(DIALOG_TIME, dialogues[bossTalk_2_during], null);
                break;
            }
            }
        }
Exemplo n.º 2
0
        public override void OnStartTurn()
        {
            base.OnStartTurn();
            //锁住场景操作
            _bim.locked = true;
            //将此关卡载入时的任务系统完成后的回调断开
            MissionManager.getInstance.OnMissionValueHandler = null;
            //
            switch (state)
            {
            case ENTRANCE:      //特效
            {
                _bui.ShowBossWarningVFX(BOSSWARNING_TIME, GotoNextState);
                remainTalk = bossTalk_num;
                break;
            }

            case STAGE_1:       //前期唠嗑
                break;

            case STAGE_2:       //战斗阶段,在boss回合开始前,进行对小鬼的补充
            {
                int n = _rmm.GetRobotCount(ROBOT_TYPE_NAME);
                if (n < MAX_GHOST_COUNT)
                {
                    for (int i = MAX_GHOST_COUNT - n; i > 0; i--)
                    {
                        var t = _bfm.Field.GetRandomTile("Bunker.Game.NormalTile", true);

                        if (t != null)
                        {
                            var robot = _rmm.CreateRobot(ROBOT_TYPE_NAME);
                            robot.SetToGird(t.ParentGrid);
                        }
                    }
                }
                //
                if (curRound == LOCATION_ROUND)
                {
                    //随机找到特殊格子,及其位置,播放移动动画
                    Vector2Int rnd = new Vector2Int(UnityEngine.Random.Range(1, 8), 9);
                    dest_tile = _bfm.Field.GetTile(rnd.x, rnd.y);
                    var dest_pos = new Vector3(dest_tile.Node.transform.position.x,
                                               boss_body.transform.position.y,
                                               boss_body.transform.position.z);
                    boss_body.transform.DOMove(dest_pos, 1.2f).OnComplete(CB_OnFinishMovement);
                }
                else if (curRound == CHARGE_ROUND)
                {
                    //播放枪口处的充能动画 或者是充能特效
                    boss_body.OnCharge();
                    CB_OnFinishMovement();
                }
                else if (curRound == LAZER_ROUND)
                {
                    const float lazer_speed = 30f;
                    const float bias        = .5f;
                    //释放lazer
                    float dist_1      = 20;
                    float dist_2      = 20;
                    float dist_1_time = 0;
                    float dist_2_time = 0;
                    //两个起始点,进行向前扫描
                    var t_1 = _bfm.Field.GetTile(dest_tile.ParentGrid.ColID + 1, dest_tile.ParentGrid.RowID);
                    var t_2 = _bfm.Field.GetTile(dest_tile.ParentGrid.ColID - 1, dest_tile.ParentGrid.RowID);
                    if (t_1 != null)
                    {
                        int grid_x = dest_tile.ParentGrid.ColID + 1;
                        int grid_y = 9;         //此处应该是mapsize
                        for (int y = grid_y; y >= 0; y--)
                        {
                            if (CanBlockLazer(grid_x, y))
                            {
                                var t = _bfm.Field.GetTile(grid_x, y);
                                dist_1 = Mathf.Abs(t.Node.transform.position.y -
                                                   boss_body.Emiter_1.position.y) + bias;
                                dest_grid_1.Set(grid_x, y);
                                CDebug.Log(string.Format("创建激光[1],距离{0},时间{1} | GRID:{2},{3}", dist_1, dist_1_time, grid_x, y), Constant.COLOR_NAME.ORANGE);
                                break;
                            }
                        }
                        //
                        dist_1_time = dist_1 / lazer_speed;

                        Sequence mySequence = DOTween.Sequence();
                        mySequence.Append(DOTween.To(CB_Lazer_1_HeightUpdate, 1.5f, dist_1, dist_1_time))
                        .AppendInterval(.5f).AppendCallback(CB_Lazer_Shoot_Finish);
                    }
                    if (t_2 != null)
                    {
                        int grid_x = dest_tile.ParentGrid.ColID - 1;
                        int grid_y = 9;         //此处应该是mapsize
                        for (int y = grid_y; y >= 0; y--)
                        {
                            if (CanBlockLazer(grid_x, y))
                            {
                                var t = _bfm.Field.GetTile(grid_x, y);
                                dist_2 = Mathf.Abs(t.Node.transform.position.y -
                                                   boss_body.Emiter_2.position.y) + bias;
                                dest_grid_2.Set(grid_x, y);
                                CDebug.Log(string.Format("创建激光[1],距离{0},时间{1} | GRID:{2},{3}", dist_2, dist_2_time, grid_x, y), Constant.COLOR_NAME.ORANGE);
                                break;
                            }
                        }
                        //
                        dist_2_time = dist_2 / lazer_speed;

                        Sequence mySequence = DOTween.Sequence();
                        mySequence.Append(DOTween.To(CB_Lazer_2_HeightUpdate, 1.5f, dist_2, dist_2_time))
                        .AppendInterval(.5f).AppendCallback(CB_Lazer_Shoot_Finish);
                    }
                    //
                    boss_body.OnShoot();
                }
            }
            break;

            case STAGE_3:
                break;
            }
        }