void john_back() { if (MoveUtil.MoveByFrame(transform, johnGhost.transform.position, moveSpeed) == 0.0f) { transform.position = johnGhost.transform.position; john_movement = John_Movement.john_back_idle; _animator.SetInteger("john_movement", (int)john_movement); //touchPad.SetActive(true); return; } }
void ProcessInput() { if (Input.GetMouseButtonDown(0)) { ManagerGame.ghostMoved = false; Vector2 wp = Camera.main.ScreenToWorldPoint(Input.mousePosition); Ray2D ray = new Ray2D(wp, Vector2.zero); RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction, 10000f, _layermask); if (hit.collider != null) { int layer = hit.transform.gameObject.layer; if (layer == LayerMask.NameToLayer("TouchPad")) { string tag = hit.transform.gameObject.tag; johnsNextPosition = transform.position; prevPosition = transform.position; if (tag == "Right") { //Debug.Log("Right"); johnsNextPosition.x += movePixel; johnGhost.transform.position = johnsNextPosition; ManagerGame.ghostMoved = true; john_movement = John_Movement.john_right; _animator.SetInteger("john_movement", (int)john_movement); touchPad.transform.position = johnGhost.transform.position; touchPad.SetActive(false); } else if (tag == "Left") { // Debug.Log("Left"); johnsNextPosition.x -= movePixel; johnGhost.transform.position = johnsNextPosition; ManagerGame.ghostMoved = true; john_movement = John_Movement.john_left; _animator.SetInteger("john_movement", (int)john_movement); touchPad.transform.position = johnGhost.transform.position; touchPad.SetActive(false); } else if (tag == "Up") { //Debug.Log("Up"); johnsNextPosition.y += movePixel; johnGhost.transform.position = johnsNextPosition; ManagerGame.ghostMoved = true; john_movement = John_Movement.john_back; _animator.SetInteger("john_movement", (int)john_movement); touchPad.transform.position = johnGhost.transform.position; touchPad.SetActive(false); } else if (tag == "Down") { //Debug.Log("Down"); johnsNextPosition.y -= movePixel; johnGhost.transform.position = johnsNextPosition; ManagerGame.ghostMoved = true; john_movement = John_Movement.john_forward; _animator.SetInteger("john_movement", (int)john_movement); touchPad.transform.position = johnGhost.transform.position; touchPad.SetActive(false); } else if (tag == "Mid") { //Debug.Log("Mid"); //johnGhost.transform.position = johnsNextPosition; //ManagerGame.ghostMoved = true; //state = State.Idle; //touchPad.transform.position = johnGhost.transform.position; //touchPad.SetActive(false); Mid(); } ManagerGame.gamePhase = 4; } } } }
public void Mid() { johnsNextPosition = transform.position; prevPosition = transform.position; johnGhost.transform.position = johnsNextPosition; ManagerGame.ghostMoved = true; john_movement = John_Movement.john_forward_idle; _animator.SetInteger("john_movement", (int)john_movement); touchPad.transform.position = johnGhost.transform.position; touchPad.SetActive(false); }