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(); }
void Awake() { DontDestroyOnLoad(this); s_instance = this; #if UNITY_EDITOR gameObject.AddComponent<LevelEditor>(); #endif }
public void ClickNoticeBtn() { audioSvc.PlayUIAudio(Constants.UIClickBtn); GameRoot.AddTips("ๆฒกๅผๅๅฎ"); }
public int RandomSeedForDebugMax = 100; //< UseRandomSeedForDebug๊ฐ ์ ํจํ ๋ ์ฌ์ฉํ๋ ๋๋ค ๋ ์ธ์ง. public override void initializeMap(GameRoot game_root) { MapCreator mapCreator = MapCreator.getInstance (); Vector3 start_position; int seed = 0; if (UseRandomSeedForDebug) { seed = Random.Range(RandomSeedForDebugMin, RandomSeedForDebugMax); } else { seed = LevelGeneratorSeed; } // ๋งต ์๋ ์์ฑ. mapCreator.generateLevel(seed); // ๋ก์ปฌ ํ๋ ์ด์ด๋ฅผ ์์ฑ. FIXME: ํต์ ๋์. PartyControl.getInstance().createLocalPlayer(GlobalParam.getInstance().global_account_id); // Put items including keys. mapCreator.generateItems(PartyControl.get().getLocalPlayer().getAcountID()); // Put lairs in the map. //mapCreator.generateLairs(); // FIXME: ์ด๊ณณ์ ์ขํ ์ฐ๊ธฐ ๋ช ๋ น์ด ๋๋ ๊ฑด๊ฐ? // ์ผ๋จ ์ขํ๋ฅผ ์ง์ ์จ๋ฃ๋๋ค. start_position = mapCreator.getPlayerStartPosition(); PartyControl.getInstance().getLocalPlayer().transform.position = start_position; mapCreator.createFloorDoor(); // Activate the start room. mapCreator.SetCurrentRoom(mapCreator.getRoomFromPosition(start_position)); { string local_player_id = PartyControl.get().getLocalPlayer().getAcountID(); ItemManager.getInstance().createItem("cake00", local_player_id); ItemManager.getInstance().createItem("candy00", local_player_id); ItemManager.getInstance().createItem("ice00", local_player_id); ItemManager.getInstance().createItem("key00", local_player_id); ItemManager.getInstance().createItem("key01", local_player_id); ItemManager.getInstance().createItem("key02", local_player_id); ItemManager.getInstance().createItem("key03", local_player_id); //ItemManager.getInstance().createItem("key04", local_player_id); ItemManager.getInstance().setPositionToItem("cake00", start_position + new Vector3(2.0f, 0.0f, 0.0f)); ItemManager.getInstance().setPositionToItem("candy00", start_position + new Vector3(4.0f, 0.0f, 0.0f)); ItemManager.getInstance().setPositionToItem("ice00", start_position + new Vector3(6.0f, 0.0f, 0.0f)); ItemManager.getInstance().setPositionToItem("key00", start_position + new Vector3( 2.0f, 0.0f, -2.0f)); ItemManager.getInstance().setPositionToItem("key01", start_position + new Vector3( 4.0f, 0.0f, -2.0f)); ItemManager.getInstance().setPositionToItem("key02", start_position + new Vector3( 6.0f, 0.0f, -2.0f)); ItemManager.getInstance().setPositionToItem("key03", start_position + new Vector3( 8.0f, 0.0f, -2.0f)); //ItemManager.getInstance().setPositionToItem("key04", start_position + new Vector3(10.0f, 0.0f, -2.0f)); } /*{ EnemyRoot.getInstance().createEnemy("Enemy_Kumasan").transform.Translate(new Vector3(0.0f, 0.0f, 5.0f)); EnemyRoot.getInstance().createEnemy("Enemy_Obake").transform.Translate(new Vector3(-5.0f, 0.0f, 5.0f)); }*/ }
//ๅ่ฎฎๅค็ private void ProgressMsg(GameMsg msg) { CMD cmd = (CMD)msg.cmd; ErrorCode err = (ErrorCode)msg.err; //้่ฏฏ็ ๅค็ if (err != ErrorCode.None) { switch (err) { case ErrorCode.AcctIsOnline: GameRoot.AddTips("ๅฝๅ่ดฆๅทๅทฒ็ปๅจ็บฟ"); break; case ErrorCode.WrongPass: GameRoot.AddTips("่ดฆๅทๆๅฏ็ ้่ฏฏ"); break; case ErrorCode.UpdateDBError: //GameRoot.AddTips("ๆดๆนๅผๅธธ"); PECommon.Log("ๆฐๆฎๅบๆดๆฐๅผๅธธ", LogType.Error); GameRoot.AddTips("็ฝ็ปไธ็จณๅฎ"); break; case ErrorCode.ServerDataError: GameRoot.AddTips("ๅฎขๆท็ซฏๆฐๆฎๅผๅธธ"); break; case ErrorCode.MaxStar: GameRoot.AddTips("ๅฝๅ้จไฝๆ็บงๅทฒๆปก"); break; case ErrorCode.LackLevel: GameRoot.AddTips("็ญ็บงไธๅค"); break; case ErrorCode.LackCoin: GameRoot.AddTips("้ๅธไธ่ถณ"); break; case ErrorCode.LackDiamond: GameRoot.AddTips("้ป็ณไธ่ถณ"); break; case ErrorCode.LackCrystal: GameRoot.AddTips("ๆฐดๆถไธ่ถณ"); break; case ErrorCode.LackPower: GameRoot.AddTips("ไฝๅไธ่ถณ"); break; case ErrorCode.ClientDataError: GameRoot.AddTips("ๅฎขๆท็ซฏๆฐๆฎ้่ฏฏ"); break; } switch (cmd) { case CMD.RspBuy: MainCitySys.instance.RspBuyError(msg); break; } //ๆฅๆถ้่ฏฏ็ ๅๆถๆฏไธ่ฟ่กไธไธๆญฅๅค็ return; } //่ฟๆฏๆ ้่ฏฏ็ ็ๆ ๅตไธ่ฟ่ก่ฟไธๆญฅๅค็ //ๅฐๆถๆฏๆ็ฑปๅๅ้ ็ปๅๅบๆจกๅๅค็ switch (cmd) { case CMD.RspLogin: LoginSys.instance.RspLogin(msg); break; case CMD.RspRename: LoginSys.instance.RspRename(msg); break; case CMD.RspGuide: MainCitySys.instance.RspGuide(msg); break; case CMD.RspStrong: MainCitySys.instance.RspStrong(msg); break; case CMD.PshChat: MainCitySys.instance.PshChat(msg); break; case CMD.RspBuy: MainCitySys.instance.RspBuy(msg); break; case CMD.PshPower: MainCitySys.instance.PshPower(msg); break; case CMD.RspTaskReward: MainCitySys.instance.RspTakeTaskReward(msg); break; case CMD.PshTaskPrgs: MainCitySys.instance.PshTaskPrgs(msg); break; case CMD.RspFBFight: FubenSys.instance.RspFBFight(msg); break; default: break; } }
private void Start() { Instance = this; DontDestroyOnLoad(this); Init(); }
public static GameRoot get() { return(GameRoot.getInstance()); }
private void CreateProjectiles(GameTime gameTime) { if (Projectiles.Count < projectileCount && (lastProjectile + projectileInterval) < gameTime.TotalGameTime.TotalMilliseconds) { var projectile = new Projectile(Art.Lazer, GameRoot.ScaleToHighDPI(projectileSize * ScaleX), GameRoot.ScaleToHighDPI(projectileSize * ScaleY)); projectile.SetPosition(new Vector2(Position.X, Position.Y - (Height / 2)), new Vector2(0, -3 * projectileSpeed)); Projectiles.Add(projectile); lastProjectile = gameTime.TotalGameTime.TotalMilliseconds; } }
public virtual void initializeMap(GameRoot game_root) { }
public int RandomSeedForDebugMax = 100; //< UseRandomSeedForDebug๊ฐ ์ ํจํ ๋ ์ฌ์ฉํ๋ ๋๋ค ๋ ์ธ์ง. public override void initializeMap(GameRoot game_root) { MapCreator mapCreator = MapCreator.getInstance(); Vector3 start_position; int seed = 0; if (UseRandomSeedForDebug) { seed = Random.Range(RandomSeedForDebugMin, RandomSeedForDebugMax); } else { seed = LevelGeneratorSeed; } // ๋งต ์๋ ์์ฑ. mapCreator.generateLevel(seed); // ๋ก์ปฌ ํ๋ ์ด์ด๋ฅผ ์์ฑ. FIXME: ํต์ ๋์. PartyControl.getInstance().createLocalPlayer(GlobalParam.getInstance().global_account_id); // Put items including keys. mapCreator.generateItems(PartyControl.get().getLocalPlayer().getAcountID()); // Put lairs in the map. //mapCreator.generateLairs(); // FIXME: ์ด๊ณณ์ ์ขํ ์ฐ๊ธฐ ๋ช ๋ น์ด ๋๋ ๊ฑด๊ฐ? // ์ผ๋จ ์ขํ๋ฅผ ์ง์ ์จ๋ฃ๋๋ค. start_position = mapCreator.getPlayerStartPosition(); PartyControl.getInstance().getLocalPlayer().transform.position = start_position; mapCreator.createFloorDoor(); // Activate the start room. mapCreator.SetCurrentRoom(mapCreator.getRoomFromPosition(start_position)); { string local_player_id = PartyControl.get().getLocalPlayer().getAcountID(); ItemManager.getInstance().createItem("cake00", local_player_id); ItemManager.getInstance().createItem("candy00", local_player_id); ItemManager.getInstance().createItem("ice00", local_player_id); ItemManager.getInstance().createItem("key00", local_player_id); ItemManager.getInstance().createItem("key01", local_player_id); ItemManager.getInstance().createItem("key02", local_player_id); ItemManager.getInstance().createItem("key03", local_player_id); //ItemManager.getInstance().createItem("key04", local_player_id); ItemManager.getInstance().setPositionToItem("cake00", start_position + new Vector3(2.0f, 0.0f, 0.0f)); ItemManager.getInstance().setPositionToItem("candy00", start_position + new Vector3(4.0f, 0.0f, 0.0f)); ItemManager.getInstance().setPositionToItem("ice00", start_position + new Vector3(6.0f, 0.0f, 0.0f)); ItemManager.getInstance().setPositionToItem("key00", start_position + new Vector3(2.0f, 0.0f, -2.0f)); ItemManager.getInstance().setPositionToItem("key01", start_position + new Vector3(4.0f, 0.0f, -2.0f)); ItemManager.getInstance().setPositionToItem("key02", start_position + new Vector3(6.0f, 0.0f, -2.0f)); ItemManager.getInstance().setPositionToItem("key03", start_position + new Vector3(8.0f, 0.0f, -2.0f)); //ItemManager.getInstance().setPositionToItem("key04", start_position + new Vector3(10.0f, 0.0f, -2.0f)); } /*{ * EnemyRoot.getInstance().createEnemy("Enemy_Kumasan").transform.Translate(new Vector3(0.0f, 0.0f, 5.0f)); * EnemyRoot.getInstance().createEnemy("Enemy_Obake").transform.Translate(new Vector3(-5.0f, 0.0f, 5.0f)); * }*/ }
protected override void OnConnected() { base.OnConnected(); GameRoot.AddTips("่ฟๆฅๆๅกๅจๆๅ๏ผ"); }
public void RspCreatePlayer() { GameRoot.AddTips("็ปๅฝๆๅ"); createWnd.SetWndState(); loginWnd.SetWndState(false); }
protected override void OnDisConnected() { base.OnDisConnected(); GameRoot.AddTips("ๆญๅผๆๅกๅจ่ฟๆฅ๏ผ"); }
/// <summary> /// Score constructor /// </summary> /// <param name="game"></param> public EndScore(GameRoot game) : base(game) { this.game = game; this.colour = Color.White; }
public void Portal(int _x, int _y) { MapField field = GameRoot.GetInstance().MapField; field.PortalEntity(this, _x, _y); }
public override void initializeMap(GameRoot game_root) { MapCreator map_creator = MapCreator.get(); PartyControl party_control = PartyControl.get(); map_creator.setRoomNum(1, 1); // Floor ๋ฃจํธ ์์ฑ. map_creator.floor_root_go = new GameObject("Floor"); // ๋ฌด๊ธฐ ์ ํ ํ๋ก์ด์์๋ ๋ฐฉ์ ๋ธ๋ก์ 3 x 4๋ก ๋ณ๊ฒฝ. map_creator.setRoomGridNum(3, 4); // ๋ฐฉ ๋ง๋ค๊ธฐ. RoomController room = map_creator.createRoomFloor(new Map.RoomIndex(0, 0)); // ๋๋ฏธ ๋ฐฉ ๋ง๋ค๊ธฐ. RoomController vacancy = map_creator.createVacancy(new Map.RoomIndex(0, -1)); // ๋ฐฉ ๊ตฌ๋ถ ๋ฒฝ ๋ง๋ค๊ธฐ. map_creator.createRoomWall(); // ์ธ๋ฒฝ ๋ง๋ค๊ธฐ. GameObject outer_walls = map_creator.createOuterWalls(); // ํ๋ก์ด ์ด๋ ๋์ด๋ฅผ ํ๋๋ง ๋ง๋ ๋ค. map_creator.createFloorDoor(new Map.RoomIndex(0, 0), new Map.BlockIndex(1, 3), Map.EWSN.NORTH); // ---------------------------------------------------------------- // Renderer[] renderers = outer_walls.GetComponentsInChildren<Renderer>(); foreach(var render in renderers) { render.material.shader = this.map_shader; } // renderers = vacancy.GetComponentsInChildren<Renderer>(); foreach(var render in renderers) { render.material.shader = this.map_shader; } renderers = room.GetComponentsInChildren<Renderer>(); foreach(var render in renderers) { render.material.shader = this.map_shader; } // ---------------------------------------------------------------- // // ๋ฌด ์์ ์จ. chrController kabusan = CharacterRoot.get().createNPC("NPC_Kabu_San"); kabusan.cmdSetPositionAnon(chrBehaviorKabu.getStayPosition()); kabusan.cmdSetDirectionAnon(chrBehaviorKabu.getStayDirection()); // ---------------------------------------------------------------- // // ๋ก์ปฌ ํ๋ ์ด์ด. party_control.createLocalPlayer(GlobalParam.getInstance().global_account_id); chrBehaviorLocal player = PartyControl.get().getLocalPlayer(); player.control.cmdSetPositionAnon(new Vector3( 0.0f, 0.0f, -9.0f)); player.changeBulletShooter(SHOT_TYPE.EMPTY); // ---------------------------------------------------------------- // // ์์ดํ ์์ฑ. this.generateItems(game_root); party_control.setCurrentRoom(room); ItemWindow.get().setActive(false); }
public void ShowTimer(GameMsg msg) { ShowTimer showTimer = msg.showTimer; GameRoot.AddTips(showTimer.time.ToString()); }
private void Awake() { current = this; if (saboteur == -1) { StartCoroutine(StartSaboteurSequence()); } }
override public void EnterScene() { GameRoot.GetInstance().StartBattle(); }
/// <summary> /// Title constructor /// </summary> /// <param name="game"></param> /// <param name="text"></param> public Title(GameRoot game, string text) : base(game) { this.game = game; this.colour = Color.White; this.text = string.IsNullOrEmpty(text) ? "Placeholder" : text; }
//################# // Update //################# void Update() { //็พๅจใฎใขใใกใผใทใงใณๅใๅๅพ AnimatorStateInfo animStateInfo = animator.GetCurrentAnimatorStateInfo(0); //-------------------------// // ็ถๆ ใฎๅใๆฟใใใงใใฏ //-------------------------// //ใใฎUpdateใพใงใซๆฌกในใใใใๆฑบใพใฃใฆใใชใใใฐ //ๆฌกในใใใใฎ็ถๆ ใ็พในใใใใจๅคใใในใใใฉใใใใงใใฏใใ //ใธใฃใณใใๆผใใใใใ็ๅฐใใฆใใใใใชใฉใชใฉ //็นใซ็ถๆ ใๅคใใชใใฆใใๅ ดๅใnextStepใฏNONEใฎใพใพใซใชใ if (this.nextStep == STEP.NONE) { switch (this.step) { case STEP.IDLE: //ๆปๆใใฟใณใๆผใใใใใๆฌกใฎในใใใ->ATTACK if (Input.GetMouseButtonDown(0)) { this.nextStep = STEP.ATTACK; GameRoot.log("playTime : " + GameRoot.gameTimer); GameRoot.log("PLAYER -> ATTACK"); } break; case STEP.ATTACK: //ๆปๆๅคๅฎๆๅนๆ้ใ็ตใใฃใฆใใใใๆฌกใฎในใใใ->IDLE if (attackTimer < 0.0f) { this.nextStep = STEP.IDLE; GameRoot.log("playTime : " + GameRoot.gameTimer); GameRoot.log("PLAYER -> ATTACK END"); } break; case STEP.DAMAGED: //็พๅจใฎใขใใกใผใทใงใณใใๅพ ๆฉใใซใชใฃใฆใใใใๆฌกใฎในใใใ->IDLE if (animStateInfo.fullPathHash == stateIdle) { this.nextStep = STEP.IDLE; GameRoot.log("playTime : " + GameRoot.gameTimer); GameRoot.log("PLAYER -> IDLE"); } break; default: break; } } //=========================// // ็ถๆ ๅคๅๆใฎๅๆๅฆ็ //=========================// //ๆฌกในใใใใๆฑบใพใฃใฆใใๅ ดๅใใใใฏ็ถๆ ใๅคๅใใใจใใใใจใชใฎใง //ใใฎ้ใซๅฟ ่ฆใชๅฆ็ใๅฎ่ก //็ถๆ ใๅคๅใใชใๅ ดๅใฏใใฎไธญใซใฏๅ ฅใใชใ //whileใไฝฟใฃใฆใใใฎใงใnextStepใNONEใซใชใใชใ้ใใ็นฐใ่ฟใๅฆ็ใ็ถใใ while (this.nextStep != STEP.NONE) { this.step = this.nextStep; this.nextStep = STEP.NONE; //ไธๆฆใในใฆใฎใขใใกใผใทใงใณใใฉใฐใfalseใซใใ animator.SetBool("Idle", false); animator.SetBool("Attack", false); animator.SetBool("Damaged", false); switch (this.step) { case STEP.IDLE: //ๆปๆๅคๅฎใชใใธใงใฏใใ้ใขใฏใใฃใใซใใ //DAMAGEDใใ้ท็งปใใฆใใๆใฏๅฟ ่ฆใชใๅฆ็ใชใฎใ ใโฆ transform.Find("AttackRange").gameObject.SetActive(false); animator.SetBool("Idle", true); break; case STEP.ATTACK: animator.SetBool("Attack", true); //ๆปๆๅคๅฎใชใใธใงใฏใใใขใฏใใฃใใซใใ transform.Find("AttackRange").gameObject.SetActive(true); //ๆปๆๅคๅฎ็บ็ใฟใคใใผใ่ตทๅ attackTimer = ATTACK_TIME; //ใใคใน vc = (Random.value < 0.5)? VCattack01 : VCattack02; audiosrc.PlayOneShot(vc); GameRoot.log("PLAYER -> ATTACK START!"); break; case STEP.DAMAGED: animator.SetBool("Damaged", true); //ใใคใน vc = (Random.value < 0.5)? VCdamaged01 : VCdamaged02; audiosrc.PlayOneShot(vc); break; default: break; } } //=========================// // ๆฏใใฌใผใ ใฎๅฆ็ //=========================// //็พในใใใใฎ็ถๆ ใซๅฟใใๅ็จฎๅฆ็ //็งปๅ้ๅบฆใฎ่ชฟๆดใชใฉ switch (this.step) { case STEP.IDLE: break; case STEP.ATTACK: //ๆปๆๅคๅฎ็บ็ใฟใคใใผใใซใฆใณใใใฆใณ attackTimer -= Time.deltaTime; break; case STEP.DAMAGED: break; default: break; } }
private void ProcessMsg(GameMsg msg) { if (msg.err != (int)ErrorCode.None) { switch ((ErrorCode)msg.err) { case ErrorCode.ServerDataError: PECommon.Log("ๆๅกๅจๆฐๆฎๅผๅธธ", LogType.Error); GameRoot.AddTips("ๅฎขๆท็ซฏๆฐๆฎๅผๅธธ"); break; case ErrorCode.UpdateDBError: PECommon.Log("ๆฐๆฎๅบๆดๆฐๅผๅธธ", LogType.Error); GameRoot.AddTips("็ฝ็ปไธ็จณๅฎ"); break; case ErrorCode.ClientDataError: PECommon.Log("ๅฎขๆท็ซฏๆฐๆฎๅผๅธธ", LogType.Error); break; case ErrorCode.AcctIsOnline: GameRoot.AddTips("ๅฝๅ่ดฆๅทๅทฒ็ปไธ็บฟ"); break; case ErrorCode.WrongPass: GameRoot.AddTips("ๅฏ็ ้่ฏฏ"); break; case ErrorCode.LackLevel: GameRoot.AddTips("่ง่ฒ็ญ็บงไธๅค"); break; case ErrorCode.LackCoin: GameRoot.AddTips("้ๅธๆฐ้ไธๅค"); break; case ErrorCode.LackCrystal: GameRoot.AddTips("ๆฐดๆถๆฐ้ไธๅค"); break; case ErrorCode.LackDiamond: GameRoot.AddTips("้ป็ณๆฐ้ไธๅค"); break; } return; } switch ((CMD)msg.cmd) { case CMD.RspLogin: LoginSys.Instance.RspLogin(msg); break; case CMD.RspRename: LoginSys.Instance.RspRename(msg); break; case CMD.RspGuide: MainCitySys.Instance.RspGuide(msg); break; case CMD.RspStrong: MainCitySys.Instance.RspStrong(msg); break; case CMD.PshChat: MainCitySys.Instance.PshChat(msg); break; case CMD.RspBuy: MainCitySys.Instance.RspBuy(msg); break; case CMD.PshPower: MainCitySys.Instance.PshPower(msg); break; case CMD.RspTakeTaskReward: MainCitySys.Instance.RspTakeTaskReward(msg); break; case CMD.PshTaskPrgs: MainCitySys.Instance.PshTaskPrgs(msg); break; } }
/// <summary> /// ๆถๆฏๅๅๅค็ /// </summary> /// <param name="msg"></param> private void ProcessMsg(GameMsg msg) { // ้่ฏฏ็ ๆ็คบๅค็ if (msg.err != (int)ErrorCode.None) { switch ((ErrorCode)msg.err) { case ErrorCode.UpdateDBError: Common.Log("ๆฐๆฎๅบๆดๆฐๅผๅธธ", LogType.Error); GameRoot.AddTips("็ฝ็ปไธ็จณๅฎ"); break; case ErrorCode.AcctIsOnline: GameRoot.AddTips("ๅฝๅ่ดฆๅทๅทฒ่ขซ็ป้"); break; case ErrorCode.WrongPassword: GameRoot.AddTips("ๅฏ็ ้่ฏฏ"); break; case ErrorCode.ServerDataError: Common.Log("ๆๅกๅจๆฐๆฎไธๅฎขๆท็ซฏๆฐๆฎไธไธ่ด๏ผๅฎขๆท็ซฏๅฏ่ฝๅคๆ", LogType.Error); GameRoot.AddTips("ๅฎขๆท็ซฏๆฐๆฎๅผๅธธ"); break; case ErrorCode.ClientDataError: Common.Log("ๅฎขๆท็ซฏๆฐๆฎไธๅฎขๆท็ซฏๆฐๆฎไธไธ่ด๏ผๅฎขๆท็ซฏๅฏ่ฝๅคๆ", LogType.Error); break; case ErrorCode.LackLevel: GameRoot.AddTips("่ง่ฒ็ญ็บงไธๅค"); break; case ErrorCode.LackCoin: GameRoot.AddTips("้ๅธๆฐ้ไธๅค"); break; case ErrorCode.LackCrystal: GameRoot.AddTips("ๆฐดๆถๆฐ้ไธๅค"); break; case ErrorCode.LackPower: GameRoot.AddTips("ไฝๅๆฐ้ไธๅค"); break; default: break; } return; } // ๆถๆฏๅๅๅค็ switch ((CMD)msg.cmd) { case CMD.RspLogin: LoginSys.Instance.RspLogin(msg); break; case CMD.RspRename: LoginSys.Instance.RspRename(msg); break; case CMD.RspGuide: MainCitySys.Instance.RspGuide(msg); break; case CMD.RspStrong: MainCitySys.Instance.RspStrong(msg); break; case CMD.PshChat: MainCitySys.Instance.PshChat(msg); break; case CMD.RspBuy: MainCitySys.Instance.RspBuy(msg); break; case CMD.PshPower: MainCitySys.Instance.PshPower(msg); break; case CMD.RspTakeTaskReward: MainCitySys.Instance.RspTakeTaskReward(msg); break; case CMD.PshTaskPrgs: MainCitySys.Instance.PshTaskPrgs(msg); break; case CMD.RspFBFight: FubenSys.Instance.RspFBFight(msg); break; case CMD.RspFBFightEnd: BattleSys.Instance.RspFBFightEnd(msg); break; } }
void Update() { this.scene_timer += Time.deltaTime; this.disp_timer -= Time.deltaTime; // ---------------------------------------------------------------- // // ๋ค์ ์ํ๋ก ์ด๋ํ ์ง ์ฒดํฌํฉ๋๋ค. switch (this.step.do_transition()) { case STEP.GAME: { } break; } // ---------------------------------------------------------------- // // ์ํ๊ฐ ์ ํ๋ ๋ ์ด๊ธฐํ. while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { case STEP.CHARACTER_CHANGE: { GlobalParam.get().account_name = this.account_name_net; GlobalParam.get().skip_enter_event = true; Application.LoadLevel("GameScene 1"); } break; case STEP.GAME: { this.account_name_local = GlobalParam.get().account_name; this.account_name_net = GameRoot.getPartnerAcountName(this.account_name_local); if (this.owner == this.account_name_local) { this.is_host = true; } else { // ๋ค๋ฅธ ํ๋ ์ด์ด์ ๋ง์์ ๊ฐ์ ๋. this.is_host = false; } // ํ๋ ์ด์ด๋ฅผ ๋ง๋ญ๋๋ค. this.local_player = CharacterRoot.get().createPlayerAsLocal(this.account_name_local); this.local_player.cmdSetPosition(Vector3.zero); if (GlobalParam.get().is_in_my_home == GlobalParam.get().is_remote_in_my_home) { this.net_player = CharacterRoot.get().createPlayerAsNet(this.account_name_net); this.net_player.cmdSetPosition(Vector3.left * 1.0f); } // ๋ ๋ฒจ ๋ฐ์ดํฐ(level_data.txt)๋ฅผ ์ฝ๊ณ NPC/์์ดํ ์ ๋ฐฐ์นํฉ๋๋ค. MapCreator.get().loadLevel(this.account_name_local, this.account_name_net, !this.is_host); SoundManager.get().playBGM(Sound.ID.TFT_BGM01); // if (!GlobalParam.get().skip_enter_event) { EnterEvent enter_event = EventRoot.get().startEvent <EnterEvent>(); if (enter_event != null) { enter_event.setPrincipal(this.local_player.behavior as chrBehaviorPlayer); enter_event.setIsLocalPlayer(true); } } foreach (ItemManager.ItemState istate in GlobalParam.get().item_table.Values) { if (istate.state == ItemController.State.Picked) { // ์ด๋ฏธ ์์ดํ ์ ํ๋ํ๋ค๋ฉด ๊ฐ์ ธ๊ฐ ์ ์๊ฒ ํฉ๋๋ค. ItemManager.get().finishGrowingItem(istate.item_id); chrController controll = CharacterRoot.getInstance().findPlayer(istate.owner); if (controll != null) { QueryItemPick query = controll.cmdItemQueryPick(istate.item_id, false, true); if (query != null) { query.is_anon = true; query.set_done(true); query.set_success(true); } } } } } break; // ๋ค๋ฅธ ํ๋ ์ด์ด๊ฐ ์ฐพ์์์ต๋๋ค. case STEP.WELCOME: { if (this.net_player == null) { EnterEvent enter_event = EventRoot.get().startEvent <EnterEvent>(); if (enter_event != null) { this.net_player = CharacterRoot.getInstance().createPlayerAsNet(this.account_name_net); this.net_player.cmdSetPosition(Vector3.left); enter_event.setPrincipal(this.net_player.behavior as chrBehaviorPlayer); enter_event.setIsLocalPlayer(false); } } } break; // ๋ค๋ฅธ ํ๋ ์ด์ด๊ฐ ๋์๊ฐ๋๋ค. case STEP.BYEBYE: { if (this.net_player != null) { LeaveEvent leave_event = EventRoot.get().startEvent <LeaveEvent>(); if (leave_event != null) { leave_event.setPrincipal(this.net_player.behavior as chrBehaviorPlayer); leave_event.setIsLocalPlayer(false); } } } break; case STEP.VISIT: { GlobalParam.get().is_in_my_home = false; Application.LoadLevel("GameScene 1"); } break; case STEP.GO_HOME: { // ์๊ธฐ ๋ง์๋ก ๋์์ต๋๋ค. GlobalParam.get().is_in_my_home = true; Application.LoadLevel("GameScene 1"); } break; case STEP.TO_TITLE: { Application.LoadLevel("TitleScene"); } break; } } // ---------------------------------------------------------------- // // ๊ฐ ์ํ์์์ ์คํ ์ฒ๋ฆฌ. switch (this.step.do_execution(Time.deltaTime)) { case STEP.GAME: { } break; } // ---------------------------------------------------------------- // // ํต์ ์ ์ํ ์ด๋ฒคํธ ์ฒ๋ฆฌ. // Network ํด๋์ค์ ์ปดํฌ๋ํธ ํ๋. GameObject go = GameObject.Find("Network"); Network network = go.GetComponent <Network>(); if (network != null) { if (network.IsCommunicating() == true) { if (request_connet_event) { // ์ ์ ์ด๋ฒคํธ๋ฅผ ๋ฐ๋ํฉ๋๋ค. GlobalParam.get().is_connected = true; request_connet_event = false; } else if (GlobalParam.get().is_connected == false) { // ์ ์ํ์ต๋๋ค. Debug.Log("Guest connected."); request_connet_event = true; disp_timer = 5.0f; } } } // ์ ์ ์ข ๋ฃ ์ด๋ฒคํธ๋ฅผ ๋ฐ๋ํฉ๋๋ค. if (request_disconnet_event) { GlobalParam.get().is_disconnected = true; request_disconnet_event = false; // ์ ์ ์ข ๋ฃ ์ ์ด๋ฒคํธ. disconnect_event(); } // ---------------------------------------------------------------- // if (Input.GetKeyDown(KeyCode.Z)) { dbwin.console().print("๋ก๊ทธ ํ ์คํธ " + this.log_test_count); this.log_test_count++; } }
public void ClickNotice() { GameRoot.AddTips("่ฏฅๆจกๅๆๆถๆชๅผๅ๏ผ"); audioSvc.PlayUIAudio(Constants.UIClickBtn); }
public override void UpdateScale(float scaleX, float scaleY, float screenWidth, float screenHeight) { foreach (var projectile in Projectiles) { projectile.UpdateScale(GameRoot.ScaleToHighDPI(projectileSize * scaleX), GameRoot.ScaleToHighDPI(projectileSize * scaleY), screenWidth, screenHeight); } base.UpdateScale(scaleX, scaleY, screenWidth, screenHeight); }
public void ClickNoticeBtn() { GameRoot.AddTips("ๅ่ฝๆญฃๅจๅผๅไธญ..."); }
public void ClickNoticeBtn() { audioSev.PlayUIAudio(Constans.UIClickBtnAudio); GameRoot.AddTips("ๅ่ฝๅผๅไธญ..."); }
public override void execute() { CameraControl camera = CameraControl.get(); // ---------------------------------------------------------------- // // ๋ค์ ์ํ๋ก ์ดํํ ์ง ์ฒดํฌํฉ๋๋ค.. switch (this.step.do_transition()) { // ์ด๋ฒคํธ ์์. case STEP.START: { this.step.set_next(STEP.OPEN_DOOR); //camera.module.parallelMoveTo(this.get_locator_position("cam_loc_0")); // ๋งต์ ์ฐ๊ด๋์ง ์์ ์์ดํ ์ ๊ฐ์ง๊ณ ๋์๊ฐ. bool isPickingup = false; string current_map = MapCreator.get().getCurrentMapName(); ItemController itemYuzu = ItemManager.get().findItem("Yuzu"); if (itemYuzu != null && itemYuzu.isActive()) { if (current_map != itemYuzu.getProduction()) { // ๊ฐ์ง๊ณ ๋์๊ธฐ๋ ์์ดํ ์ด ์์๋ค. this.player.controll.cmdItemQueryPick(itemYuzu.name, true, true); isPickingup = true; } } ItemController itemNegi = ItemManager.get().findItem("Negi"); if (itemNegi != null && itemNegi.isActive()) { if (current_map != itemNegi.getProduction()) { // ๊ฐ์ง๊ณ ๋์๊ฐ๋ ์์ดํ ์ด ์์๋ค. this.player.controll.cmdItemQueryPick(itemNegi.name, true, true); isPickingup = true; } } if (this.player.controll.item_carrier.isCarrying() && isPickingup == false) { ItemController item = this.player.controll.item_carrier.getItem(); if (item.isExportable() == false) { // ๊ฐ์ง๊ณ ๋๊ฐ ์ ์๋ ๊ฒ์ ๋๊ณ ๊ฐ๋๋ค. QueryItemDrop query_drop = this.player.controll.cmdItemQueryDrop(); query_drop.is_drop_done = true; this.player.controll.cmdItemDrop(this.player.controll.account_name); } } } break; // ๋ฐฐ์ถ๊ฐ ์์ผ๋ก ์์ง์ด๊ณ & ๋์ผ๊ฐ ๋ฑ์ฅ. case STEP.OPEN_DOOR: { if (this.hakusai_fcurve.isDone() && this.tarai_fcurve.isDone()) { this.step.set_next(STEP.RIDE_TARAI_0); } } break; // ๋์ผ๋ฅผ ํ๋๋ค(๊ธฐ์ญ๊น์ง ๊ฑท๋๋ค). case STEP.RIDE_TARAI_0: { if (!this.player_move.isMoving()) { this.step.set_next(STEP.RIDE_TARAI_1); } } break; // ๋์ผ๋ฅผ ํ๋๋ค(๋์ผ๋ฅผ ํฅํด ์ ํ). case STEP.RIDE_TARAI_1: { if (!this.player_jump.isMoving()) { this.step.set_next(STEP.CLOSE_DOOR); } } break; // ๋ฐฐ์ถ๊ฐ ๋์์ค๊ณ & ๋์ผ๊ฐ ๋ฐ์ ํฅํด ์ด๋. case STEP.CLOSE_DOOR: { if (this.hakusai_fcurve.isDone() && this.tarai_fcurve.isDone()) { this.step.set_next(STEP.END); } } break; case STEP.END: { camera.module.popPosture(); this.step.set_next(STEP.IDLE); } break; } // ---------------------------------------------------------------- // // ์ํ๊ฐ ์ ํํ ๋์ ์ด๊ธฐํ. while (this.step.get_next() != STEP.NONE) { dbwin.console().print(this.step.ToString()); switch (this.step.do_initialize()) { // ์ด๋ฒคํธ ์์. case STEP.START: { camera.module.pushPosture(); this.player.beginOuterControll(); this.tarai_fune.transform.position = this.tarai_enter_spline.curve.cvs.front().position; } break; // ๋ฐฐ์ถ๊ฐ ์์ผ๋ก ์์ง์ด๊ณ & ๋์ผ๊ฐ ๋ฑ์ฅ. case STEP.OPEN_DOOR: { this.hakusai_set.setControl(true); this.hakusai_fcurve.setSlopeAngle(10.0f, 10.0f); this.hakusai_fcurve.setDuration(4.0f); this.hakusai_fcurve.start(); this.hakusai_tracer.restart(); this.tarai_fcurve.setSlopeAngle(60.0f, 10.0f); this.tarai_fcurve.setDuration(2.0f); this.tarai_fcurve.setDelay(2.0f); this.tarai_fcurve.start(); } break; // ๋์ผ๋ฅผ ํ๋๋ค(๊ธฐ์ญ๊น์ง ๊ฑท๋๋ค). case STEP.RIDE_TARAI_0: { this.player_move.position.start = this.player.controll.getPosition(); this.player_move.position.goal = this.get_locator_position("chr_loc_0"); this.player_move.startConstantVelocity(chrBehaviorLocal.MOVE_SPEED); } break; // ๋์ผ๋ฅผ ํ๋๋ค(๋์ผ๋ฅผ ํฅํด์ ์ ํ). case STEP.RIDE_TARAI_1: { Vector3 start = this.player.controll.getPosition(); Vector3 goal = this.tarai_enter_spline.curve.cvs.back().position; this.player_jump.start(start, goal, 1.0f); } break; // ๋ฐฐ์ถ๊ฐ ๋์์ค๊ณ & ๋์ผ๊ฐ ๋ฐ์ ํฅํด ์ด๋. case STEP.CLOSE_DOOR: { this.hakusai_fcurve.setSlopeAngle(10.0f, 10.0f); this.hakusai_fcurve.setDuration(4.0f); this.hakusai_fcurve.start(); this.hakusai_tracer.restart(); this.hakusai_tracer.setCurrentByDistance(this.hakusai_tracer.curve.calcTotalDistance()); this.tarai_tracer.attach(this.tarai_leave_spline.curve); this.tarai_tracer.restart(); this.tarai_fcurve.reset(); this.tarai_fcurve.setSlopeAngle(20.0f, 60.0f); this.tarai_fcurve.setDuration(2.0f); this.tarai_fcurve.start(); } break; case STEP.END: { // ์ด๋ฒคํธ ์ข ๋ฃ. this.hakusai_set.reset(); this.hakusai_set.setControl(false); if (this.is_local_player) { if (this.is_map_change) { GlobalParam.get().skip_enter_event = false; GlobalParam.get().fadein_start = false; if (GlobalParam.get().is_in_my_home) { GameRoot.get().step.set_next(GameRoot.STEP.VISIT); } else { GameRoot.get().step.set_next(GameRoot.STEP.GO_HOME); } // ์ ์ ์ด๋์ ์๋ฆผ. if (GlobalParam.get().request_move_home) { Debug.Log("NotifyFieldMoving Leave END."); GameRoot.get().NotifyFieldMoving(); } } else { GlobalParam.get().is_in_my_home = !GlobalParam.get().is_in_my_home; this.player.controll.cmdSetPosition(this.initial_player_position); this.player.endOuterControll(); } } else { // ์์ดํ ์ ๋นํ์ฑํํ๊ณ ๋์ ๋๋กญํ์ง ์์ผ๋ฉด ์ฌ์ํฉ๋๋ค. ItemBehaviorFruit fruit = this.player.controll.getCarriedItem <ItemBehaviorFruit>(); if (fruit != null) { fruit.activeItem(false); } // ๋งต ์ด๋์ด ์์ ๋ ์์ดํ ์ ๊ฐ์ง๊ณ ๋์์จ ๊ฒฝ์ฐ ์์ดํ ์ ๊ฒ์ ์ค๋ธ์ ํธ๋ฅผ. // ํ๊ธฐํ์ง ์๊ฒ ํ๊ณ ์ ์์ดํ ์ ๋ฒ๋ฆฝ๋๋ค. this.player.controll.cmdItemDrop(this.player.name); CharacterRoot.get().deletaCharacter(this.player.controll); } this.player = null; } break; } } // ---------------------------------------------------------------- // // ๊ฐ ์ํ์์์ ์คํ ์ฒ๋ฆฌ. switch (this.step.do_execution(Time.deltaTime)) { // ๋ฐฐ์ถ๊ฐ ์์ผ๋ก ์์ง์ด๊ณ & ๋์ผ๊ฐ ๋ฑ์ฅ. case STEP.OPEN_DOOR: { this.hakusai_fcurve.execute(Time.deltaTime); this.hakusai_tracer.proceedToDistance(this.hakusai_tracer.curve.calcTotalDistance() * this.hakusai_fcurve.getValue()); this.hakusai_set.setPosition(this.hakusai_tracer.getCurrent().position); this.tarai_fcurve.execute(Time.deltaTime); this.tarai_tracer.proceedToDistance(this.tarai_tracer.curve.calcTotalDistance() * this.tarai_fcurve.getValue()); this.tarai_fune.setPosition(this.tarai_tracer.getCurrent().position); if (this.tarai_fcurve.isTriggerDone()) { this.ripple_effect.is_created = false; } } break; // ๋์ผ๋ฅผ ํ๋๋ค(๊ธฐ์ญ๊น์ง ๊ฑท๋๋ค). case STEP.RIDE_TARAI_0: { this.player_move.execute(Time.deltaTime); this.player.controll.cmdSetPosition(this.player_move.position.current); this.player.controll.cmdSmoothHeadingTo(this.player_move.position.goal); this.player.playWalkMotion(); } break; // ๋์ผ๋ฅผ ํ๋๋ค(๋์ผ๋ฅผ ํฅํด์ ์ ํ). case STEP.RIDE_TARAI_1: { this.player_jump.execute(Time.deltaTime); this.player.controll.cmdSetPosition(this.player_jump.position); this.player.controll.cmdSmoothHeadingTo(this.player_jump.goal); this.player.stopWalkMotion(); if (this.player_jump.is_trigger_bounce && this.player_jump.bounce_count == 1) { this.ripple_effect.is_created = false; } } break; // ๋ฐฐ์ถ๊ฐ ๋์์ค๊ณ & ๋์ผ๊ฐ ๋ฐ์ ํฅํด ์ด๋. case STEP.CLOSE_DOOR: { this.hakusai_fcurve.execute(Time.deltaTime); this.hakusai_tracer.proceedToDistance(this.hakusai_tracer.curve.calcTotalDistance() * (1.0f - this.hakusai_fcurve.getValue())); this.hakusai_set.setPosition(this.hakusai_tracer.cv.position); this.tarai_fcurve.execute(Time.deltaTime); this.tarai_tracer.proceedToDistance(this.tarai_tracer.curve.calcTotalDistance() * this.tarai_fcurve.getValue()); SimpleSpline.ControlVertex cv = this.tarai_tracer.getCurrent(); this.tarai_fune.setPosition(cv.position); this.player.controll.cmdSetPosition(cv.position); this.player.controll.cmdSmoothHeadingTo(cv.position + cv.tangent.Y(0.0f)); this.player.stopWalkMotion(); } break; } // ๋์ผ ๋ค์ ๋์ค๋ ๋ฌผ๊ฒฐ. if (!this.ripple_effect.is_created || Vector3.Distance(this.ripple_effect.last_position, this.tarai_fune.getPosition()) > 2.0f) { this.ripple_effect.is_created = true; this.ripple_effect.last_position = this.tarai_fune.transform.position; EffectRoot.get().createRipple(this.ripple_effect.last_position); } // ---------------------------------------------------------------- // }
static void Main() { using (var game = new GameRoot()) game.Run(); }
protected override void OnConnected() { GameRoot.AddTips("่ฟๆฅๆๅกๅจๆๅ"); PECommon.Log("Connect To Server Succ"); }
// Use this for initialization void Start() { this.player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerControl>(); this.last_block.is_created = false; this.block_creator = this.gameObject.GetComponent<BlockCreator>(); this.level_control = new LevelControl(); this.level_control.initialize(); //ใใญในใใใใใผใฟใ่ชญใฟๅบใ this.level_control.loadLevelData(this.level_data_text); this.game_root = this.gameObject.GetComponent<GameRoot>(); this.player.level_control = this.level_control; }
protected override void OnDisConnected() { GameRoot.AddTips("ๆๅกๅจๆญๅผ่ฟๆฅ"); PECommon.Log("DisConnect To Server"); }
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 }
// Update is called once per frame private void Update() { if (Input.GetKeyDown(KeyCode.Z)) { if (!topCameraActive) { mainCamera.SetActive(false); topCamera.SetActive(true); topCameraActive = true; } else if (topCameraActive) { mainCamera.SetActive(true); topCamera.SetActive(false); topCameraActive = false; } } if (!MovementComplete) { if (Input.GetKeyDown(KeyCode.W)) { W.GetComponent <Text>().color = Color.green; wComplete = true; } if (Input.GetKeyDown(KeyCode.A)) { A.GetComponent <Text>().color = Color.green; aComplete = true; } if (Input.GetKeyDown(KeyCode.S)) { S.GetComponent <Text>().color = Color.green; sComplete = true; } if (Input.GetKeyDown(KeyCode.D)) { D.GetComponent <Text>().color = Color.green; dComplete = true; } if (dComplete && wComplete && aComplete && sComplete) { MovementTutorial.SetActive(false); TopViewTutorial.SetActive(true); MovementComplete = true; } } if (MovementComplete && !zComplete) { if (Input.GetKeyDown(KeyCode.Z) && zpressedonce == false) { Z.GetComponent <Text>().color = Color.green; zpressedonce = true; } else if (Input.GetKeyDown(KeyCode.Z) && zpressedonce) { Z2.GetComponent <Text>().color = Color.green; zpressedtwice = true; } if (zpressedonce && zpressedtwice) { TopViewTutorial.SetActive(false); FieldInput.SetActive(true); Questions.SetActive(true); zComplete = true; } } if (MovementComplete && zComplete && !rotateComplete) { if (inputedText == "5") { Debug.Log("Correct awnser inputted"); FieldInput.SetActive(false); Questions.SetActive(false); SelectionTutorial.SetActive(true); rotateComplete = true; } if (Input.GetKeyDown(KeyCode.P)) { Debug.Log(inputedText); } } if (MovementComplete && zComplete && rotateComplete) { if (selectionComplete) { SelectionTutorial.SetActive(false); Congrats.SetActive(true); } } // player = GameObject.FindGameObjectWithTag("Player"); if (player.transform.position == previousPosition) { Debug.Log("Not Moving"); timer += (int)Time.deltaTime; if (timer == 30) { GameRoot.ShowTips("Press 'R' to reset position.", true, false); } } else { Debug.Log("Moving"); timer = 0; } if (Input.GetKeyDown(KeyCode.R)) { player.transform.position = startPosition; Debug.Log("R pressed"); } previousPosition = player.transform.position; }
// ๋งต์ ์์ดํ ์ ๋ฐฐ์นํ๋ ๋ฉ์๋. private void generateItems(GameRoot gameRoot) { string local_player_id = PartyControl.get().getLocalPlayer().getAcountID(); string item_type = "shot_negi"; string item_name = item_type + "." + local_player_id; ItemManager.get().createItem(item_type, item_name, local_player_id); ItemManager.get().setPositionToItem(item_name, WeaponSelectMapInitializer.getNegiItemPosition()); item_type = "shot_yuzu"; item_name = item_type + "." + local_player_id; ItemManager.get().createItem(item_type, item_name, local_player_id); ItemManager.get().setPositionToItem(item_name, WeaponSelectMapInitializer.getYuzuItemPosition()); }
// Start is called before the first frame update private void Awake() { _instance = this; DontDestroyOnLoad(this); Init(); }
// ================================================================ // // MonoBehaviour ใใใฎ็ถๆฟ. void Start() { this.player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerControl>(); // this.last_block.is_created = false; this.level_control = new LevelControl(); this.level_control.initialize(); this.level_control.loadLevelData(this.level_data_text); this.player.level_control = this.level_control; // this.game_root = this.gameObject.GetComponent<GameRoot>(); this.block_creator = this.gameObject.GetComponent<BlockCreator>(); this.coin_creator = this.gameObject.GetComponent<CoinCreator>(); this.enemy_creator = this.gameObject.GetComponent<EnemyCreator>(); this.block_creator.map_creator = this; this.coin_creator.map_creator = this; this.enemy_creator.map_creator = this; // this.create_floor_block(); }
//ๅฝ้ผ ๆ ไฝไบ่ฟไธชcolliderไนไธ็ๆถๅ๏ผไผๅจๆฏไธๅธง่ฐ็จ่ฟไธชๆนๆณ protected void OnMouseOver() { //ๅฝ็นๅปไบNPCไนๅ if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) { if (isInGround) { //็นๅปๅฎ็ฎฑไบไปถ //OnMouseClick(); //ๅฎ็ฎฑๆฏๆๅผ็ถๆไธ๏ผ้ๅฎ็ถๆ่ชๅจๅไธบ่งฃ้ if (isOn) { isLocked = false; } if (isLocked) { GameRoot.AddTips("ๅฎ็ฎฑ้ไฝไบ๏ผๆ ๆณๆๅผ"); if (chestAudio != null) { chestAudio.clip = AudioManager.Instance.LoadAudioClip("Sound/wood_box_locked", true); if (chestAudio.isPlaying) { chestAudio.Stop(); } chestAudio.Play(); } } else { isOn = !isOn; if (isOn) { if (chestAudio != null) { chestAudio.clip = AudioManager.Instance.LoadAudioClip("Sound/wood_box_opened", true); if (chestAudio.isPlaying) { chestAudio.Stop(); } chestAudio.Play(); } } else { if (chestAudio != null) { chestAudio.clip = AudioManager.Instance.LoadAudioClip("Sound/wood_box_closed1", true); if (chestAudio.isPlaying) { chestAudio.Stop(); } chestAudio.Play(); } } } } else { GameRoot.AddTips("่ท็ฆปๅคช่ฟ๏ผๆ ๆณๆๅผ"); } } }
public static GameRoot getInstance() { if(GameRoot.instance == null) { GameRoot.instance = GameObject.Find("GameRoot").GetComponent<GameRoot>(); } return(GameRoot.instance); }
private void Update() { if (Input.GetKeyDown(KeyCode.R)) { player.transform.localPosition = startPosition; GameRoot.instance.IsLock(false); P03W.ShowChoicePanel(false); isTriggerQuestion = false; GameRoot.ShowTips("", true, false); } if (isRotate) { if (Mathf.Abs(diffRotation.x) <= 2f && Mathf.Abs(diffRotation.y) <= 2f && Mathf.Abs(diffRotation.z) <= 2f) { plane.transform.eulerAngles = finalRotation; isRotate = false; //Stop audio FX rotated puzzle environment plane.GetComponent <PuzzleEnvironmentController>().PlayRotatedSoundFX(false); } else { CalDiffRotation(); currentRotation = Vector3.Slerp(currentRotation, finalRotation, 0.01f * rotatedSpeed); plane.transform.eulerAngles = currentRotation; } } if (Input.GetKeyDown(KeyCode.Z)) { topCamera.depth = topCamera.depth == 0 ? 1 : 0; } //*********************** Interaction with the trigger and submission ************************* if (isInQuestion && Input.GetKeyDown(KeyCode.E)) { if (isTriggerQuestion) { GameRoot.instance.IsLock(false); GameRoot.isPuzzleLock = false; P03W.ShowChoicePanel(false); isTriggerQuestion = false; GameRoot.instance.audioService.PlayUIAudio(Constants.audioP03ExitQuestion); } else { isTriggerQuestion = true; GameRoot.instance.IsLock(true); GameRoot.isPuzzleLock = true; P03W.ShowChoicePanel(true); GameRoot.instance.audioService.PlayUIAudio(Constants.audioP03TriggerQuestion); } } // *********************************************************************************************** if (isTipsAnimate) { tipsPoint2.localPosition = Vector3.Lerp(tipsPoint2.localPosition, tipsPoint2FinalPos, tipsAnimationSpeed); tipsPoint3.localPosition = Vector3.Lerp(tipsPoint3.localPosition, tipsPoint3FinalPos, tipsAnimationSpeed); Vector3 diffTP2 = tipsPoint2FinalPos - tipsPoint2.localPosition; Vector3 diffTP3 = tipsPoint3FinalPos - tipsPoint3.localPosition; if ((Mathf.Abs(diffTP2.x) <= 0.05f && Mathf.Abs(diffTP2.y) <= 0.05f && Mathf.Abs(diffTP2.z) <= 0.05f) && (Mathf.Abs(diffTP3.x) <= 0.05f && Mathf.Abs(diffTP3.y) <= 0.05f && Mathf.Abs(diffTP3.z) <= 0.05f)) { tipsPoint2.localPosition = tipsPoint2FinalPos; tipsPoint3.localPosition = tipsPoint3FinalPos; isTipsAnimate = false; } } //When player finish sub-level, the puzzle environment shift into next sub-level if (isShiftPlane) { playerPosition.position = Vector3.Lerp(playerPosition.position, playerPositionList[subPuzzleID].position, planeShiftSpeed); Vector3 diffPP = playerPositionList[subPuzzleID].position - playerPosition.position; if (Mathf.Abs(diffPP.z) <= 0.05f) { if (subPuzzleID >= DBP03.subLevelPlanes.Length) { playerPosition.position = playerPositionList[subPuzzleID].position; SetActive(endWall, false); P03W.ShowChoicePanel(false); GameRoot.instance.IsLock(false); GameRoot.ShowTips("", false, false); isInQuestion = false; P03W.SetInstructionalText("Go to the exit."); } isShiftPlane = false; } } previousPosition = player.transform.position; }