// 将连击数设置为0 public void clearComboCount() { this.combo_count = 0; this.combo = COMBO.NORMAL; Navi.get().setCombo(this.combo); }
private void SetIsBreakEx(int damage, int lockonBonus) { if ( enemyState == State.FOLLOWINGLEADER || enemyState == State.ATTACK) { if (life > 0) { life -= damage; } if (life <= 0) { // 毁坏敌机 enemyState = State.BREAK; isBreakByPlayer = true; // 统计得分 Navi.get().AddScore(score * lockonBonus); // 向子窗口输出消息 printMessage.SetMessage("DESTROYED " + enemyTypeString + " BY LOCK BONUS X " + lockonBonus); } else { // 毁坏动画 if (effectDamage) { Instantiate( effectDamage, transform.position, new Quaternion(0f, 0f, 0f, 0f)); } } } }
public override void initializeMap(GameRoot game_root) { MapCreator map_creator = MapCreator.get(); PartyControl party_control = PartyControl.get(); map_creator.setRoomNum(1, 1); map_creator.floor_root_go = new GameObject("Floor"); // 방 만들기. RoomController room = map_creator.createRoomFloor(new Map.RoomIndex(0, 0)); // 더미 방 만들기. map_creator.createVacancy(new Map.RoomIndex(0, -1)); // 방을 구분하는 벽을 만든다. map_creator.createRoomWall(); // 외벽을 만든다. map_creator.createOuterWalls(); GameRoot.get().createLocalPlayer(); GameRoot.get().createNetPlayers(); // 플레이어 위치 설정. chrBehaviorLocal local_player = PartyControl.get().getLocalPlayer(); Vector3 playerStartPosition = Vector3.zero; local_player.transform.position = playerStartPosition + PartyControl.get().getPositionOffset(local_player.control.global_index); for (int i = 0; i < PartyControl.get().getFriendCount(); i++) { chrBehaviorPlayer friend = PartyControl.get().getFriend(i); friend.control.cmdSetPositionAnon(playerStartPosition + PartyControl.get().getPositionOffset(friend.control.global_index)); } party_control.setCurrentRoom(room); // ボスの作成. chrControllerEnemyBase enemy; if (UsesHumanControlForBoss) { enemy = CharacterRoot.get().createEnemy("Boss1", "chrControllerEnemyBoss", "chrBehaviorEnemyBoss_Human") as chrControllerEnemyBase; } else { enemy = CharacterRoot.get().createEnemy("Boss1", "chrControllerEnemyBoss", "chrBehaviorEnemyBoss") as chrControllerEnemyBase; } enemy.cmdSetPosition(new Vector3(0.0f, 0.0f, 20.0f)); // 스테이터스 창. Navi.get().createStatusWindows(); }
private void SetIsBreakEx(int damage, int lockonBonus) { if ( enemyState == State.FOLLOWINGLEADER || enemyState == State.ATTACK) { if (life > 0) { life -= damage; } if (life <= 0) { // 敵機を破壊した. enemyState = State.BREAK; isBreakByPlayer = true; // 点数加算. Navi.get().AddScore(score * lockonBonus); // サブスクリーンへメッセージ出力. printMessage.SetMessage("DESTROYED " + enemyTypeString + " BY LOCK BONUS X " + lockonBonus); } else { // ダメージアニメーション. if (effectDamage) { Instantiate( effectDamage, transform.position, new Quaternion(0f, 0f, 0f, 0f)); } } } }
public override void end() { this.player.endOuterControll(); Navi.get().finishKabusanSpeech(); CameraControl.get().is_smooth_revert = true; CameraControl.get().endOuterControll(); }
// ---------------------------------------------------------------- // // 다른 플레이어의 상황을 나타내는 아이콘을 생성한다. protected void create_selecting_icons() { this.selecting_icons = new List <SelectingIcon>(); for (int i = 0; i < NetConfig.PLAYER_MAX; i++) { if (!GameRoot.get().isConnected(i)) { continue; } this.selecting_icons.Add(Navi.get().createSelectingIcon(i)); } switch (this.selecting_icons.Count) { case 1: { this.selecting_icons[0].setPosition(new Vector3(0.0f, 0.0f, 0.0f)); } break; case 2: { this.selecting_icons[0].setPosition(new Vector3(-75.0f, 0.0f, 0.0f)); this.selecting_icons[0].setFlip(true); this.selecting_icons[1].setPosition(new Vector3(75.0f, 0.0f, 0.0f)); } break; case 3: { this.selecting_icons[0].setPosition(new Vector3(-75.0f, 0.0f, 0.0f)); this.selecting_icons[0].setFlip(true); this.selecting_icons[1].setPosition(new Vector3(75.0f, 50.0f, 0.0f)); this.selecting_icons[2].setPosition(new Vector3(150.0f, -50.0f, 0.0f)); } break; case 4: { this.selecting_icons[0].setPosition(new Vector3(-75.0f, 50.0f, 0.0f)); this.selecting_icons[0].setFlip(true); this.selecting_icons[1].setPosition(new Vector3(-150.0f, -50.0f, 0.0f)); this.selecting_icons[1].setFlip(true); this.selecting_icons[2].setPosition(new Vector3(75.0f, 50.0f, 0.0f)); this.selecting_icons[3].setPosition(new Vector3(150.0f, -50.0f, 0.0f)); } break; } foreach (var icon in this.selecting_icons) { icon.setVisible(false); } }
private float speed = 0f; // 爆発エフェクト用: スピード. void Start() { // プレイヤーのインスタンスを取得. player = GameObject.FindGameObjectWithTag("Player"); // PrintMessage のインスタンスを取得. printMessage = Navi.get().GetPrintMessage(); // 敵機のTYPE名をセット. enemyTypeString = SetEnemyType(); // 追加の初期化処理. StartSub(); }
private PrintMessage printMessage; // SubScreenのメッセージ領域. void Start() { // playerのインスタンスを取得. player = GameObject.FindGameObjectWithTag("Player"); // プレイヤーステータスのインスタンスを取得. playerStatus = player.GetComponent <PlayerStatus>(); // バルカン弾の発射位置情報を取得. shotPosition = GetComponentInChildren <Transform>().Find("ShotPosition").gameObject; // PrintMessage のインスタンスを取得. printMessage = Navi.get().GetPrintMessage(); }
private PrintMessage printMessage; // SubScreen的消息区域 void Start() { // 取得player的实例 player = GameObject.FindGameObjectWithTag("Player"); // 取得玩家状态的实例 playerStatus = player.GetComponent <PlayerStatus>(); // 取得机关炮弹的发射位置信息 shotPosition = GetComponentInChildren <Transform>().Find("ShotPosition").gameObject; // 取得SubScreenMessage的实例 printMessage = Navi.get().GetPrintMessage(); }
private int invalidInstanceId = -1; // lockedOnEnemyIds[] が未使用であることを表す値. void Start() { // ロックオン敵機. lockedOnEnemys = new GameObject[MAX_LOCKON_COUNT]; lockedOnEnemyIds = new int[MAX_LOCKON_COUNT]; lockonLaserIds = new int[MAX_LOCKON_COUNT]; lockedOnSights = new GameObject[MAX_LOCKON_COUNT]; // ロックオンサイトのインスタンスを取得. lockonSights = new GameObject[MAX_LOCKON_COUNT]; lockonSights[0] = lockonSight1; lockonSights[1] = lockonSight2; lockonSights[2] = lockonSight3; lockonSights[3] = lockonSight4; lockonSights[4] = lockonSight5; lockonSights[5] = lockonSight6; // playerのインスタンスを取得. player = GameObject.FindGameObjectWithTag("Player"); // 索敵レーザーのコリジョン補間を取得. scoutingLaserMesh = GameObject.FindGameObjectWithTag("ScoutingLaserMesh"); // 索敵レーザーの前方への線のインスタンスを取得. scoutingLaserLine = GameObject.FindGameObjectWithTag("ScoutingLaserLine").GetComponent <MeshRenderer>(); // ロックオンサイトの初期化. this.GetComponent <TrailRenderer>().enabled = isScanOn; scoutingLaserLine.enabled = isScanOn; // LockBonusのインスタンスを取得. lockBonus = Navi.get().GetLockBonus(); // LockSlotのインスタンスを取得. lockSlot = Navi.get().GetLockSlot(); // PrintMessage のインスタンスを取得. printMessage = Navi.get().GetPrintMessage(); // lockedOnEnemyIds[] が未使用であることを表す値. // 自分自身はロックオンされることはないので. invalidInstanceId = this.gameObject.GetInstanceID(); for (int i = 0; i < lockedOnEnemyIds.Length; i++) { lockedOnEnemyIds[i] = invalidInstanceId; lockonLaserIds[i] = invalidInstanceId; } }
private int invalidInstanceId = -1; // 表示lockedOnEnemyIds[] 未被使用的值 void Start() { // 锁定敌机 lockedOnEnemys = new GameObject[MAX_LOCKON_COUNT]; lockedOnEnemyIds = new int[MAX_LOCKON_COUNT]; lockonLaserIds = new int[MAX_LOCKON_COUNT]; lockedOnSights = new GameObject[MAX_LOCKON_COUNT]; // 获取锁定瞄准器的实例 lockonSights = new GameObject[MAX_LOCKON_COUNT]; lockonSights[0] = lockonSight1; lockonSights[1] = lockonSight2; lockonSights[2] = lockonSight3; lockonSights[3] = lockonSight4; lockonSights[4] = lockonSight5; lockonSights[5] = lockonSight6; // 获取player的实例 player = GameObject.FindGameObjectWithTag("Player"); // 获取索敌激光的碰撞补间 scoutingLaserMesh = GameObject.FindGameObjectWithTag("ScoutingLaserMesh"); // 获取索敌激光前方线的实例 scoutingLaserLine = GameObject.FindGameObjectWithTag("ScoutingLaserLine").GetComponent <MeshRenderer>(); // 锁定瞄准器的初始化 this.GetComponent <TrailRenderer>().enabled = isScanOn; scoutingLaserLine.enabled = isScanOn; // 获取LockBonus的实例 lockBonus = Navi.get().GetLockBonus(); // 获取LockSlot的实例 lockSlot = Navi.get().GetLockSlot(); // 获取PrintMessage 的实例 printMessage = Navi.get().GetPrintMessage(); // 表示lockedOnEnemyIds[] 未被使用时的值 // 自身不会被锁定 invalidInstanceId = this.gameObject.GetInstanceID(); for (int i = 0; i < lockedOnEnemyIds.Length; i++) { lockedOnEnemyIds[i] = invalidInstanceId; lockonLaserIds[i] = invalidInstanceId; } }
private float speed = 0f; // 用于爆炸特效: 速度 void Start() { // 取得玩家的实例 player = GameObject.FindGameObjectWithTag("Player"); // 获取PrintMessage 的实例 printMessage = Navi.get().GetPrintMessage(); // 设置敌机的TYPE名 enemyTypeString = SetEnemyType(); // 追加的初始化处理 StartSub(); }
// 매 프레임 호출. public override void execute() { // ---------------------------------------------------------------- // // 다음 상태로 전환할지 체크한다. switch (this.step.do_transition()) { case STEP.IN_ACTION: { if (this.boss == null) { this.step.set_next(STEP.FINISH); } } break; } // ---------------------------------------------------------------- // // 상태 전환 시 초기화. while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { case STEP.IN_ACTION: { Navi.get().dispatchYell(YELL_WORD.READY); } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. switch (this.step.do_execution(Time.deltaTime)) { case STEP.IN_ACTION: { } break; } // ---------------------------------------------------------------- // }
// ------------------------------------------------------------------------ // HISCOREを保持する. // ------------------------------------------------------------------------ private bool SetHiscore() { // SCORE/HISCOREを取得. int hiScore = Navi.get().GetHiScore(); int score = Navi.get().GetScore(); // HISCOREを超えたか? if (score > hiScore) { // ハイスコア更新. Navi.get().SetHiScore(score); // グローバル領域に保存する. GlobalParam.GetInstance().SetHiScore(score); return(true); } return(false); }
// ------------------------------------------------------------------------ // 存储HISCORE // ------------------------------------------------------------------------ private bool SetHiscore() { // 获取SCORE/HISCORE int hiScore = Navi.get().GetHiScore(); int score = Navi.get().GetScore(); // 是否超过了HISCORE? if (score > hiScore) { // 更新最高得分 Navi.get().SetHiScore(score); // 保存到GlobalParam GlobalParam.GetInstance().SetHiScore(score); return(true); } return(false); }
// ------------------------------------------------------------------------ // 如果SCORE超过了HISCORE则存储 // ------------------------------------------------------------------------ private bool SetHiscore() { // 获取SCORE/HISCORE int hiScore = Navi.get().GetHiScore(); int score = Navi.get().GetScore(); // 判断是否超过HISCORE? if (score > hiScore) { // 更新得分记录 Navi.get().SetHiScore(score); // 存储在GlobalParam区域中 GlobalParam.GetInstance().SetHiScore(score); return(true); } return(false); }
// ------------------------------------------------------------------------ // 显示玩家 // ------------------------------------------------------------------------ private bool ShowPlayer() { // 确认玩家数量为0 if (playerCount <= 0) { // 更新最高得分 bool isHiScore = SetHiscore(); Navi.get().SetIsHiScore(isHiScore); // 显示游戏结束的文字 Navi.get().ShowGameOver(); // 设置跳转到开场画面的点击事件为有效 GameObject.FindGameObjectWithTag("MainCamera").GetComponent <ClickToOpening>().enabled = true; // 一定时间后返回开场画面 StartCoroutine(WaitAndCallScene(5f, "opening")); return(false); } else { // 玩家数量减1 playerCount--; // 显示玩家 Component[] meshRenderers = this.GetComponentsInChildren <MeshRenderer>(); foreach (MeshRenderer meshRenderer in meshRenderers) { meshRenderer.enabled = true; } // 显示Player Left Navi.get().SetPlayerLeftCount(playerCount); //设置玩家状态为生存 this.GetComponent <PlayerController>().SetIsAlive(true); return(true); } }
// ------------------------------------------------------------------------ // プレイヤーを表示する. // ------------------------------------------------------------------------ private bool ShowPlayer() { // プレイヤー数が0か確認. if (playerCount <= 0) { // ハイスコア更新. bool isHiScore = SetHiscore(); Navi.get().SetIsHiScore(isHiScore); // ゲームオーバーの文字を表示. Navi.get().ShowGameOver(); // オープニングへのクリックイベントを有効にする. GameObject.FindGameObjectWithTag("MainCamera").GetComponent <ClickToOpening>().enabled = true; // 一定時間後にオープニング画面に戻る. StartCoroutine(WaitAndCallScene(5f, "opening")); return(false); } else { // プレイヤー数を1つ減らす. playerCount--; // プレイヤーを表示する. Component[] meshRenderers = this.GetComponentsInChildren <MeshRenderer>(); foreach (MeshRenderer meshRenderer in meshRenderers) { meshRenderer.enabled = true; } // Player Left の表示. Navi.get().SetPlayerLeftCount(playerCount); // プレイヤーは生きている状態とする. this.GetComponent <PlayerController>().SetIsAlive(true); return(true); } }
// ------------------------------------------------------------------------ // ステージ - GameClear. // ------------------------------------------------------------------------ private void GameClearMessage() { if (stage == Stage.GAMECLEAR && state == State.END) { stage = Stage.END; // ハイスコア更新. bool isHiScore = SetHiscore(); Navi.get().SetIsHiScore(isHiScore); // ミッション成功の文字を表示. Navi.get().ShowMisssionAccomplished(); // オープニングへのクリックイベントを有効にする. GameObject.FindGameObjectWithTag("MainCamera").GetComponent <ClickToOpening>().enabled = true; // 一定時間後にオープニング画面に戻る. StartCoroutine(WaitAndCallScene(5f, "ending")); } }
// ------------------------------------------------------------------------ // 关卡场景 - GameClear. // ------------------------------------------------------------------------ private void GameClearMessage() { if (stage == Stage.GAMECLEAR && state == State.END) { stage = Stage.END; // 更新得分记录 bool isHiScore = SetHiscore(); Navi.get().SetIsHiScore(isHiScore); // 显示游戏结束的文字 Navi.get().ShowMisssionAccomplished(); // 使转向开场场景的点击事件有效 GameObject.FindGameObjectWithTag("MainCamera").GetComponent <ClickToOpening>().enabled = true; // 经过一定时间后返回开场画面 StartCoroutine(WaitAndCallScene(5f, "ending")); } }
// ------------------------------------------------------------------------ // 设置敌机为消灭状态(毁坏状态将传递给父对象) // ------------------------------------------------------------------------ public void SetIsBreak(bool isBreak) { if (isBreak) { if ( enemyState == State.FOLLOWINGLEADER || enemyState == State.ATTACK) { if (life > 0) { life--; } if (life <= 0) { // 毁坏敌机 enemyState = State.BREAK; isBreakByPlayer = true; // 统计得分 Navi.get().AddScore(score * lockonBonus); // 向子窗口输出消息 printMessage.SetMessage("DESTROYED " + enemyTypeString + " BY LOCK BONUS X " + lockonBonus); } else { // 毁坏动画 if (effectDamage) { Instantiate( effectDamage, transform.position, transform.rotation); } } isBreak = false; } } }
// ------------------------------------------------------------------------ // 敵機を破壊状態にする(ダメージを親へ伝播). // ------------------------------------------------------------------------ public void SetIsBreak(bool isBreak) { if (isBreak) { if ( enemyState == State.FOLLOWINGLEADER || enemyState == State.ATTACK) { if (life > 0) { life--; } if (life <= 0) { // 敵機を破壊した. enemyState = State.BREAK; isBreakByPlayer = true; // 点数加算. Navi.get().AddScore(score * lockonBonus); // サブスクリーンへメッセージ出力. printMessage.SetMessage("DESTROYED " + enemyTypeString + " BY LOCK BONUS X " + lockonBonus); } else { // ダメージアニメーション. if (effectDamage) { Instantiate( effectDamage, transform.position, transform.rotation); } } isBreak = false; } } }
// 增加连击数 public void addComboCount() { this.combo_count++; switch (this.combo_count) { case 0: { GetComponent <AudioSource>().clip = COMBO_SOUND_01; } break; case 1: { GetComponent <AudioSource>().clip = COMBO_SOUND_01; } break; case 2: { GetComponent <AudioSource>().clip = COMBO_SOUND_02; this.combo = COMBO.CHAIN01; Navi.get().setCombo(this.combo); } break; default: { GetComponent <AudioSource>().clip = COMBO_SOUND_03; this.combo = COMBO.CHAIN02; Navi.get().setCombo(this.combo); } break; } GetComponent <AudioSource>().Play(); }
void Update() { float delta_time = Time.deltaTime; AudioSource audio = GetComponent <AudioSource>(); // ---------------------------------------------------------------- // // 检测是否迁移到下一状态 switch (this.step.do_transition()) { case STEP.NONE: { this.step.set_next(STEP.GAME); } break; case STEP.GAME: { do { int shoji_num = this.getPaperNum(); if (shoji_num == 0) { this.step.set_next(STEP.CLEAR); break; } if (this.lifecnt <= 0) { this.step.set_next(STEP.GAMEOVER); break; } } while(false); } break; case STEP.CLEAR: { do { if (this.disp_end_timer <= 1.0f) { break; } if (!Input.GetMouseButtonDown(0)) { break; } this.step.set_next(STEP.DONE); } while(false); } break; } // ---------------------------------------------------------------- // // 状态迁移时的初始化 while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { case STEP.GAME: { this.clearComboCount(); lifecnt = LIFE_COUNT; } break; case STEP.CLEAR: { audio.clip = CLEAR_NEKO_SOUND; audio.Play(); // 自動運転開始. this.neko_control.beginAutoDrive(); } break; case STEP.GAMEOVER: { audio.clip = GAMEOVER_NEKO_SOUND; audio.Play(); // 立刻显示“结束” Navi.get().dispEnd(); } break; case STEP.DONE: { UnityEngine.SceneManagement.SceneManager.LoadScene("TitleScene"); } break; } } // ---------------------------------------------------------------- // // 各个状态的执行处理 switch (this.step.do_execution(delta_time)) { case STEP.CLEAR: { if (this.step.is_acrossing_time(CLEAR_NEKO_SOUND.length)) { audio.clip = CLEAR_SOUND; audio.Play(); } if (this.step.is_acrossing_time(CLEAR_NEKO_SOUND.length + CLEAR_SOUND.length)) { audio.clip = CLEAR_LOOP_SOUND; audio.loop = true; audio.Play(); } if (Input.GetMouseButtonDown(0)) { if (!Navi.get().isDispEnd()) { Navi.get().dispEnd(); } } // 经过一定时间后,自动显示“结束” if (this.step.is_acrossing_time(CLEAR_NEKO_SOUND.length + CLEAR_SOUND.length + CLEAR_LOOP_SOUND.length)) { if (!Navi.get().isDispEnd()) { Navi.get().dispEnd(); } } if (Navi.get().isDispEnd()) { this.disp_end_timer += delta_time; } } break; case STEP.GAMEOVER: { if (this.step.is_acrossing_time(GAMEOVER_NEKO_SOUND.length)) { audio.clip = GAMEOVER_SOUND; audio.Play(); } } break; } // ---------------------------------------------------------------- // }
// 撞破窗户纸的瞬间 public void onPlayerHitted() { this.combo = COMBO.FAILED; Navi.get().setCombo(this.combo); }
public int RandomSeedForDebugMax = 1000; //< UseRandomSeedForDebug가 유효한 때 사용하는 랜덤 레인지. public override void initializeMap(GameRoot game_root) { MapCreator mapCreator = MapCreator.getInstance(); Vector3 playerStartPosition; int seed = 0; if (UseRandomSeedForDebug) { TimeSpan ts = new TimeSpan(DateTime.Now.Ticks); double seconds = ts.TotalSeconds; seed = (int)((long)seconds - (long)(seconds / 1000.0) * 1000); //seed = Random.Range(RandomSeedForDebugMin, RandomSeedForDebugMax); } else { seed = GlobalParam.get().seed; } // 맵 자동 생성. Debug.Log("Use random seed:" + seed); mapCreator.generateLevel(seed); GameRoot.get().createLocalPlayer(); GameRoot.get().createNetPlayers(); chrBehaviorLocal local_player = PartyControl.get().getLocalPlayer(); // 아이템을 만든다. mapCreator.generateItems(local_player.getAcountID()); mapCreator.createFloorDoor(); // 플레이어의 위치 설정. playerStartPosition = mapCreator.getPlayerStartPosition(); local_player.transform.position = playerStartPosition + PartyControl.get().getPositionOffset(local_player.control.global_index); for (int i = 0; i < PartyControl.get().getFriendCount(); i++) { chrBehaviorPlayer friend = PartyControl.get().getFriend(i); friend.control.cmdSetPositionAnon(playerStartPosition + PartyControl.get().getPositionOffset(friend.control.global_index)); } PartyControl.get().setCurrentRoom(mapCreator.getRoomFromPosition(playerStartPosition)); // 스테이터스 윈도우. Navi.get().createStatusWindows(); // // #if false string local_player_id = PartyControl.get().getLocalPlayer().getAcountID(); ItemManager.get().createItem("candy00", local_player_id); ItemManager.get().setPositionToItem("candy00", playerStartPosition + new Vector3(0.0f, 0.0f, 4.0f)); ItemManager.get().createItem("ice00", local_player_id); ItemManager.get().setPositionToItem("ice00", playerStartPosition + new Vector3(7.0f, 0.0f, 0.0f)); ItemManager.get().createItem("key00", local_player_id); ItemManager.get().setPositionToItem("key00", playerStartPosition + new Vector3(10.0f, 0.0f, 0.0f)); ItemManager.get().createItem("key01", local_player_id); ItemManager.get().setPositionToItem("key01", playerStartPosition + new Vector3(10.0f, 0.0f, 0.0f)); ItemManager.get().createItem("key02", local_player_id); ItemManager.get().setPositionToItem("key02", playerStartPosition + new Vector3(10.0f, 0.0f, 0.0f)); ItemManager.get().createItem("key03", local_player_id); ItemManager.get().setPositionToItem("key03", playerStartPosition + new Vector3(10.0f, 0.0f, 0.0f)); #endif }
// 매 프레임 호출. public override void execute() { // ---------------------------------------------------------------- // // 다음 상태로 전환할지 체크. switch (this.step.do_transition()) { case STEP.IN_ACTION: { var player = PartyControl.get().getLocalPlayer(); if (player.step.get_current() == chrBehaviorLocal.STEP.WAIT_RESTART) { // 체력이 0이 되면 재시작. player.start(); player.control.cmdSetPositionAnon(this.restart_point.position); player.control.cmdSetDirectionAnon(this.restart_point.direction); if (this.restart_point.door != null) { this.restart_point.door.beginWaitLeave(); } this.step.set_next(STEP.RESTART); } else { // 방 이동 이벤트 시작?. var ev = EventRoot.get().getCurrentEvent <TransportEvent>(); if (ev != null) { DoorControl door = ev.getDoor(); if (door.type == DoorControl.TYPE.FLOOR) { // 플로어 이동 도어일 때 . this.is_floor_door_event = true; ev.setEndAtHoleIn(true); } else { // 방 이동 도어일 때. this.restart_point.door = door.connect_to; this.is_floor_door_event = false; } this.step.set_next(STEP.TRANSPORT); } } } break; // 방 이동 이벤트 중. case STEP.TRANSPORT: { // 방 이동 이벤트가 끝나면 일반 모드로. var ev = EventRoot.get().getCurrentEvent <TransportEvent>(); wait_counter += Time.deltaTime; if (ev == null) { if (this.is_floor_door_event) { this.step.set_next(STEP.WAIT_FINISH); } else { this.step.set_next(STEP.READY); wait_counter = 0.0f; } } else { if (ev.step.get_current() == TransportEvent.STEP.READY) { this.step.set_next(STEP.READY); wait_counter = 0.0f; } } } break; // 'レディ!' 표시. // 쓰러졌을 때 재시작. case STEP.READY: case STEP.RESTART: { if (this.is_first_ready) { if (this.step.get_time() > 1.0f) { this.step.set_next(STEP.IN_ACTION); this.is_first_ready = false; } } else { var ev = EventRoot.get().getCurrentEvent <TransportEvent>(); if (ev == null) { this.step.set_next(STEP.IN_ACTION); } } } break; case STEP.WAIT_FINISH: { // 약긴 대기. wait_counter += Time.deltaTime; if (wait_counter > 3.0f) { this.step.set_next(STEP.FINISH); } } break; } // ---------------------------------------------------------------- // // 상태 전환 시 초기화. while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { case STEP.IN_ACTION: { Navi.get().dispatchPlayerMarker(); LevelControl.get().endStillEnemies(null, 0.0f); } break; // 방 이동 이벤트 중. case STEP.TRANSPORT: { var current_room = PartyControl.get().getCurrentRoom(); var next_room = PartyControl.get().getNextRoom(); // 다음 방에 적을 만든다. // 방 이동 이벤트 조료 시에 갑자기 적이 나타나지 않게. // 일짜김치 만들어 둔다. LevelControl.get().createRoomEnemies(next_room); LevelControl.get().beginStillEnemies(next_room); LevelControl.get().beginStillEnemies(current_room); } break; // 'レディ!표시. case STEP.READY: { var current_room = PartyControl.get().getCurrentRoom(); var next_room = PartyControl.get().getNextRoom(); if (this.is_first_ready) { LevelControl.get().createRoomEnemies(current_room); LevelControl.get().beginStillEnemies(current_room); LevelControl.get().onEnterRoom(current_room); } else { LevelControl.get().onLeaveRoom(current_room); LevelControl.get().onEnterRoom(next_room); } // 'レディ!' 표시 Navi.get().dispatchYell(YELL_WORD.READY); // 전에 있던 방의 적을 삭제.. if (next_room != current_room) { LevelControl.get().deleteRoomEnemies(current_room); } ItemWindow.get().onRoomChanged(next_room); this.restart_point.position = PartyControl.get().getLocalPlayer().control.getPosition(); this.restart_point.direction = PartyControl.get().getLocalPlayer().control.getDirection(); } break; // 쓰러진 후 재시작. case STEP.RESTART: { // 'レディ!' 표시. Navi.get().dispatchYell(YELL_WORD.READY); this.restart_point.position = PartyControl.get().getLocalPlayer().control.getPosition(); this.restart_point.direction = PartyControl.get().getLocalPlayer().control.getDirection(); } break; case STEP.FINISH: { GameRoot.get().setNextScene("BossScene"); } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. switch (this.step.do_execution(Time.deltaTime)) { case STEP.IN_ACTION: { } break; } // ---------------------------------------------------------------- // }
// 매 프레임 호출. public override void execute() { // ---------------------------------------------------------------- // // 다음 상태로 전환할지 체크. switch (this.step.do_transition()) { case STEP.VS_BOSS: { if (this.child.isFinished()) { GameObject.Destroy(this.child); this.child = null; this.step.set_next(STEP.CAKE_BIKING); } } break; case STEP.CAKE_BIKING: { if (this.child.isFinished()) { GameObject.Destroy(this.child); this.child = null; this.step.set_next(STEP.RESULT); } } break; case STEP.RESULT: { if (this.child.isFinished()) { GameObject.Destroy(this.child); this.child = null; this.step.set_next(STEP.FINISH); } } break; } // ---------------------------------------------------------------- // // 상태 전환 시 초기화. while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { case STEP.VS_BOSS: { this.child = this.gameObject.AddComponent <BossLevelSequenceBoss>(); this.child.parent = this; this.child.createDebugWindow(this.window); this.child.start(); Navi.get().dispatchPlayerMarker(); } break; case STEP.CAKE_BIKING: { this.child = this.gameObject.AddComponent <BossLevelSequenceCake>(); this.child.parent = this; this.child.createDebugWindow(this.window); this.child.start(); } break; case STEP.RESULT: { this.child = this.gameObject.AddComponent <BossLevelSequenceResult>(); this.child.parent = this; this.child.createDebugWindow(this.window); this.child.start(); } break; case STEP.FINISH: { // Network 클래스의 컴포넌트 획득. GameObject obj = GameObject.Find("Network"); Network network = null; if (obj != null) { network = obj.GetComponent <Network>(); } if (network != null) { if (GameRoot.get().isHost()) { network.StopGameServer(); } network.StopServer(); network.Disconnect(); GameObject.Destroy(network); } GameRoot.get().setNextScene("TitleScene"); } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. switch (this.step.do_execution(Time.deltaTime)) { case STEP.VS_BOSS: { this.child.execute(); } break; case STEP.CAKE_BIKING: { this.child.execute(); } break; case STEP.RESULT: { this.child.execute(); } break; } // ---------------------------------------------------------------- // }
// 매 프레임 호출. public override void execute() { // ---------------------------------------------------------------- // // 다음 상태로 전환할지 체크. switch (this.step.do_transition()) { case STEP.IN_ACTION: { // 타임오버. if (this.step.get_time() > this.time_limit) { Navi.get().dispatchYell(YELL_WORD.TIMEUP); CakeTrolley.get().stopServe(); // 남아있는 게이크를 전부 지움. CakeTrolley.get().deleteAllCakes(); this.step.set_next(STEP.FINISH); } } break; } // ---------------------------------------------------------------- // // 상태 전환 시 초기화. while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { case STEP.IN_ACTION: { // 쏠 수 없게 한다. var players = PartyControl.get().getPlayers(); foreach (var player in players) { player.setShotEnable(false); } Navi.get().dispatchYell(YELL_WORD.OYATU); Navi.get().createCakeTimer(); CakeTrolley.get().startServe(); } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. float current_time = 1.0f; switch (this.step.do_execution(Time.deltaTime)) { case STEP.IN_ACTION: { current_time = this.step.get_time() / this.time_limit; } break; } Navi.get().getCakeTimer().setTime(current_time); //dbPrint.setLocate(20, 15); //dbPrint.print("남은 시간." + Mathf.FloorToInt(this.time_limit - this.step.get_time()).ToString()); //dbPrint.setLocate(20, 20); //dbPrint.print("획득 수(디버그용)). " + PartyControl.get().getLocalPlayer().getCakeCount().ToString()); // ---------------------------------------------------------------- // }
// ================================================================ // public void create() { Navi navi = Navi.get(); // this.root_sprite = Sprite2DRoot.get().createNull(); this.root_sprite.setPosition(new Vector3(0.0f, POSITION_Y, 0.0f)); // 아이콘, 문자 오브젝트 생성. this.icon = new Yell.Icon(); this.icon.create(this.icon_texture); this.icon.sprite.transform.parent = this.root_sprite.transform; // this.mojis = new List <Yell.Moji>(); for (int i = 0; i < this.yell_words.Length; i++) { YellFontData font_data = navi.getYellFontData(this.yell_words[i]); Yell.Moji moji = new Yell.Moji(); moji.create(font_data.texture, this.moji_mae_texture); if (font_data.is_small) { moji.moji_mae_scale *= 0.5f; } moji.yell = this; moji.index = i; moji.sprite.transform.parent = this.root_sprite.transform; moji.reset(); if (i % 3 == 0) { moji.sprite.setVertexColor(new Color(1.0f, 1.0f, 0.5f)); } else if (i % 3 == 1) { moji.sprite.setVertexColor(new Color(1.0f, 0.7f, 0.7f)); } else if (i % 3 == 2) { moji.sprite.setVertexColor(new Color(0.3f, 1.0f, 1.0f)); } this.mojis.Add(moji); } this.icon.sprite.setDepth(this.mojis[this.mojis.Count - 1].sprite.getDepth() - 0.1f); // 문자 위치. float pitch = 54.0f; Vector2 p0 = Vector2.zero; Vector2 p1 = Vector2.zero; p0.x = (float)this.mojis.Count * pitch / 2.0f; p0.y = 0.0f; p1.x = 0.0f - ((float)this.mojis.Count) * pitch / 2.0f - pitch / 2.0f; p1.y = p0.y; this.icon.p0 = p0; this.icon.p1 = p1; p1.x += pitch; p0.x = p1.x; for (int i = 0; i < this.mojis.Count; i++) { YellFontData font_data = navi.getYellFontData(this.yell_words[i]); this.mojis[i].p0 = p0; this.mojis[i].reset(); if (font_data.is_small) { this.mojis[i].p0.x -= pitch * 0.25f; this.mojis[i].p0.y -= pitch * 0.25f; p0.x += pitch * 0.5f; } else { p0.x += pitch; } } }