// Use this for initialization void Start () { anim = GetComponent<Animator> (); ppz = PlayerPositionInZ.Middle; playerHealthy = maxPlayerHealthy; recoverTimePoint = Time.time; isDead = false; }
// Use this for initialization void Start() { anim = GetComponent <Animator> (); ppz = PlayerPositionInZ.Middle; playerHealthy = maxPlayerHealthy; recoverTimePoint = Time.time; isDead = false; }
void ManRoad() { if (isDead) { return; } if (Input.GetKeyDown(KeyCode.W) && ppz == PlayerPositionInZ.Middle) { ppz = PlayerPositionInZ.Top; } else if (Input.GetKeyDown(KeyCode.W) && ppz == PlayerPositionInZ.Bottom) { ppz = PlayerPositionInZ.Middle; } else if (Input.GetKeyDown(KeyCode.S) && ppz == PlayerPositionInZ.Top) { ppz = PlayerPositionInZ.Middle; } else if (Input.GetKeyDown(KeyCode.S) && ppz == PlayerPositionInZ.Middle) { ppz = PlayerPositionInZ.Bottom; } switch (ppz) { case PlayerPositionInZ.Top: z = 10f; break; case PlayerPositionInZ.Middle: z = 0f; break; case PlayerPositionInZ.Bottom: z = -10f; break; default: z = 0; break; } pos.Set(transform.position.x, transform.position.y, z); transform.position = pos; }
void ManRoad(){ if(isDead) return; if(Input.GetKeyDown(KeyCode.W) && ppz==PlayerPositionInZ.Middle) ppz = PlayerPositionInZ.Top; else if(Input.GetKeyDown(KeyCode.W) && ppz==PlayerPositionInZ.Bottom) ppz = PlayerPositionInZ.Middle; else if(Input.GetKeyDown(KeyCode.S) && ppz==PlayerPositionInZ.Top) ppz = PlayerPositionInZ.Middle; else if(Input.GetKeyDown(KeyCode.S) && ppz==PlayerPositionInZ.Middle) ppz = PlayerPositionInZ.Bottom; switch(ppz){ case PlayerPositionInZ.Top: z = 10f; break; case PlayerPositionInZ.Middle: z = 0f; break; case PlayerPositionInZ.Bottom: z = -10f; break; default: z = 0; break; } pos.Set (transform.position.x, transform.position.y, z); transform.position = pos; }