void Update() { switch (playstate) { case PLAYSTATE.NONE: transform.rotation = new Quaternion(0, 0, 0, 0); gameObject.GetComponentInChildren <Animator>().SetBool("Right", false); break; case PLAYSTATE.RIGHT: if (right2 == false) { transform.Translate(speed * Time.deltaTime, 0, 0); } if (right2 == true) { left2 = false; transform.Translate(speed * Time.deltaTime, 0, 0); cameraObj[0].GetComponent <MainCameraMove>().camerastate = MainCameraMove.CAMERASTATE.RIGHT; if (transform.position.x > 4) { playstate = PLAYSTATE.NONE; transform.position = new Vector3(4, 0.2f, -0.2f); cameraObj[1].GetComponent <MiniMapScripts>().minimapstate = MiniMapScripts.MINIMAPSTATE.NONE; } } break; case PLAYSTATE.LEFT: if (left2 == false) { transform.Translate(speed * Time.deltaTime, 0, 0); if (transform.position.x < -1.7f) { transform.position = new Vector3(-1.7f, 0.2f, -0.2f); playstate = PLAYSTATE.NONE; cameraObj[1].GetComponent <MiniMapScripts>().minimapstate = MiniMapScripts.MINIMAPSTATE.NONE; } } if (left2 == true) { right2 = false; cameraObj[0].GetComponent <MainCameraMove>().camerastate = MainCameraMove.CAMERASTATE.LEFT; transform.Translate(speed * Time.deltaTime, 0, 0); if (transform.position.x < -1.7f) { transform.position = new Vector3(-1.7f, 0.2f, -0.2f); playstate = PLAYSTATE.NONE; cameraObj[1].GetComponent <MiniMapScripts>().minimapstate = MiniMapScripts.MINIMAPSTATE.NONE; } } break; case PLAYSTATE.DEAD: Destroy(gameObject); break; default: break; } if (hpMg.GetComponent <HPManager>().playerGauge.transform.localScale.x <= 0) { playstate = PLAYSTATE.DEAD; } }
public void LeftMove() { playstate = PLAYSTATE.LEFT; transform.rotation = new Quaternion(0, -180, 0, 0); gameObject.GetComponentInChildren <Animator>().SetBool("Right", true); }
public void NoneState() { gameObject.GetComponentInChildren <Animator>().SetBool("Skill", false); playstate = PLAYSTATE.NONE; cameraObj[0].GetComponent <MainCameraMove>().camerastate = MainCameraMove.CAMERASTATE.NONE; }
public void RightMove() { playstate = PLAYSTATE.RIGHT; gameObject.GetComponentInChildren <Animator>().SetBool("Right", true); }
void Update() { if (playerHP > 40) { playerHP = 40; } powerCount.GetComponent <UILabel>().text = powerCT.ToString(); switch (playerHP) { case 0: playHeart[0].SetActive(false); playHeart[1].SetActive(false); playHeart[2].SetActive(false); playHeart[3].SetActive(false); break; case 10: playHeart[0].SetActive(true); playHeart[1].SetActive(false); playHeart[2].SetActive(false); playHeart[3].SetActive(false); break; case 20: playHeart[0].SetActive(true); playHeart[1].SetActive(true); playHeart[2].SetActive(false); playHeart[3].SetActive(false); break; case 30: playHeart[0].SetActive(true); playHeart[1].SetActive(true); playHeart[2].SetActive(true); playHeart[3].SetActive(false); break; case 40: playHeart[0].SetActive(true); playHeart[1].SetActive(true); playHeart[2].SetActive(true); playHeart[3].SetActive(true); break; default: break; } if (multiShot == true) { coolT += Time.deltaTime; bulletMG[0].SetActive(false); bulletMG[1].SetActive(true); bulletMG[2].SetActive(true); bulletMG[3].SetActive(false); playState = PLAYSTATE.MULTI; } if (powerShot == true) { coolT = 0; coolT2 += Time.deltaTime; multiShot = false; bulletMG[0].SetActive(false); bulletMG[1].SetActive(false); bulletMG[2].SetActive(false); bulletMG[3].SetActive(true); playState = PLAYSTATE.POWER; } if (magnetics == true) { coolT4 += Time.deltaTime; playState = PLAYSTATE.MAGNET; } if (hyperMode == true) { coolT3 += Time.deltaTime; playState = PLAYSTATE.HYPER; } switch (playState) { case PLAYSTATE.NONE: //Time.timeScale = 1; break; case PLAYSTATE.MULTI: if (coolT > resPawnT) { multiShot = false; if (multiShot == false) { coolT = 0; playState = PLAYSTATE.NONE; bulletMG[0].SetActive(true); bulletMG[1].SetActive(false); bulletMG[2].SetActive(false); bulletMG[3].SetActive(false); } } if (playerHP <= 0) { multiShot = false; playState = PLAYSTATE.DEAD; } break; case PLAYSTATE.POWER: if (coolT2 > resPawnT2) { powerShot = false; if (powerShot == false) { coolT2 = 0; playState = PLAYSTATE.NONE; bulletMG[0].SetActive(true); bulletMG[1].SetActive(false); bulletMG[2].SetActive(false); bulletMG[3].SetActive(false); } } if (playerHP <= 0) { powerShot = false; playState = PLAYSTATE.DEAD; } break; case PLAYSTATE.HYPER: coolT = 0; coolT2 = 0; multiShot = false; powerShot = false; this.GetComponent <ShakingCamera>().shaking = false; Time.timeScale = 3f; this.GetComponent <PlayerMoving>().playerSpeed = 1.6f; hyperBK[0].SetActive(true); hyperBK[1].SetActive(true); hyperBK[2].SetActive(true); bosst[0].SetActive(true); bosst[1].SetActive(true); bulletMG[0].SetActive(false); bulletMG[1].SetActive(false); bulletMG[2].SetActive(false); bulletMG[3].SetActive(false); bulletMG[4].SetActive(false); bulletMG[5].SetActive(false); bulletMG[6].SetActive(false); fireMG[0].GetComponent <FireManager>().fireB2 = false; fireMG[1].GetComponent <FireManager>().fireB2 = false; fireMG[2].GetComponent <FireManager>().fireB2 = false; if (coolT3 > resPawnT3) { hyperMode = false; if (hyperMode == false) { this.GetComponent <PlayerMoving>().playerSpeed = 6f; coolT3 = 0; hyperBK[0].SetActive(false); hyperBK[1].SetActive(false); hyperBK[2].SetActive(false); bosst[0].SetActive(false); bosst[1].SetActive(false); bulletMG[0].SetActive(true); bulletMG[1].SetActive(false); bulletMG[2].SetActive(false); bulletMG[3].SetActive(false); bulletMG[4].SetActive(true); fireMG[0].GetComponent <FireManager>().fireB2 = true; fireMG[1].GetComponent <FireManager>().fireB2 = true; fireMG[2].GetComponent <FireManager>().fireB2 = true; playState = PLAYSTATE.NONE; Time.timeScale = 1; } } if (playerHP <= 0) { hyperMode = false; playState = PLAYSTATE.DEAD; } break; case PLAYSTATE.MAGNET: magnetics = true; magnetic.SetActive(true); if (coolT4 > resPawnT4) { magnetics = false; if (magnetics == false) { coolT4 = 0; magnetic.SetActive(false); playState = PLAYSTATE.NONE; } } if (playerHP <= 0) { magnetics = false; playState = PLAYSTATE.DEAD; } break; case PLAYSTATE.DEAD: gameObject.SetActive(false); gameOver.GetComponent <FillMount>().overFill = true; break; default: break; } if (playerHP <= 0) { scoreMG.GetComponent <ScoreManager>().disScore = false; playState = PLAYSTATE.DEAD; } if (playerHP < 0) { playerHP = 0; } if (playerHP > 0) { scoreMG.GetComponent <ScoreManager>().disScore = true; } }
public void PlayerIdle() { playstate = PLAYSTATE.NONE; //플레이스테이트에 NONE로 이동 mainCamera.GetComponent <MainCameraMove>().camerastate = MainCameraMove.CAMERASTATE.NONE; //메인카메라에 있는 스크립트에 카메라스테이트를 NONE로 바꿔준다 }
public void LeftMove() { playstate = PLAYSTATE.LEFT;//플레이스테이트에 LEFT로 이동 }
public void RightMove() { playstate = PLAYSTATE.RIGHT;//플레이스테이트에 RIGHT로 이동 }