void Update() { if (Time.timeScale == 0) { return; } SetCurrentCollidingShiftable(); if (currentCollidingShiftable != null && (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.JoystickButton0))) { currentCollidingShiftable.GetComponent <ShapeShiftController> ().CaptureGhost(); currentCollidingShiftable = null; currentCollidingShiftables.Clear(); } if (rb.velocity.magnitude < maxSpeed) { rb.AddForce(new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")) * ghostSpeed); } else { rb.velocity = rb.velocity.normalized * maxSpeed; } }
void Start() { anim = GetComponent <Animator> (); ss = GetComponent <ShapeShiftController> (); dia = GetComponentInChildren <Dialog> (); bus = GameObject.Find("Bus").gameObject; rb = bus.GetComponent <Rigidbody2D> (); ending_scene = false; }
void OnTriggerEnter2D(Collider2D col) { ShapeShiftController controller = col.GetComponent <ShapeShiftController> (); if (controller != null) { currentCollidingShiftables.Add(col.GetComponent <ShapeShiftController> ()); } }
void Start() { anim = GetComponent<Animator> (); ss = GetComponent<ShapeShiftController> (); dia = GetComponentInChildren<Dialog> (); bus = GameObject.Find("Bus").gameObject; rb = bus.GetComponent<Rigidbody2D> (); ending_scene = false; }
void Update() { if (Time.timeScale == 0) { return; } SetCurrentCollidingShiftable (); if (currentCollidingShiftable != null && ( Input.GetKeyDown (KeyCode.Return) || Input.GetKeyDown(KeyCode.JoystickButton0))) { currentCollidingShiftable.GetComponent<ShapeShiftController> ().CaptureGhost (); currentCollidingShiftable = null; currentCollidingShiftables.Clear (); } if (rb.velocity.magnitude < maxSpeed) { rb.AddForce (new Vector2 (Input.GetAxisRaw ("Horizontal"), Input.GetAxisRaw ("Vertical")) * ghostSpeed); } else { rb.velocity = rb.velocity.normalized * maxSpeed; } }
private void SetCurrentCollidingShiftable() { if (currentCollidingShiftable == null && currentCollidingShiftables.Count == 0) { return; } if (currentCollidingShiftables.Count != 0 && currentCollidingShiftable == currentCollidingShiftables [0]) { return; } if (currentCollidingShiftable != null) { currentCollidingShiftable.Unhighlight (); currentCollidingShiftable = null; } if (currentCollidingShiftables.Count != 0) { currentCollidingShiftable = currentCollidingShiftables[0]; currentCollidingShiftable.Highlight (); } }
private void SetCurrentCollidingShiftable() { if (currentCollidingShiftable == null && currentCollidingShiftables.Count == 0) { return; } if (currentCollidingShiftables.Count != 0 && currentCollidingShiftable == currentCollidingShiftables [0]) { return; } if (currentCollidingShiftable != null) { currentCollidingShiftable.Unhighlight(); currentCollidingShiftable = null; } if (currentCollidingShiftables.Count != 0) { currentCollidingShiftable = currentCollidingShiftables[0]; currentCollidingShiftable.Highlight(); } }