private void Update() { if (Input.GetAxis("Jump") != 0) { controller.JumpTowards(Camera.main.ScreenToWorldPoint(Input.mousePosition)); } if (Input.GetAxis("Fire1") != 0) { controller.Running(Camera.main.ScreenToWorldPoint(Input.mousePosition), 1f); } if (Input.GetAxis("Fire2") != 0) { controller.Shock(); controller.Running(Camera.main.ScreenToWorldPoint(Input.mousePosition), -1f); } }
void InvokeBehaviour(Behaviour behaviour, Vector2 targetPosition) { switch (behaviour) { case Behaviour.shock: controller.Shock(); break; case Behaviour.avoid: controller.Running(targetPosition, 1f); break; case Behaviour.follow: controller.Running(targetPosition, -1f); break; case Behaviour.jumpTowards: controller.JumpTowards(targetPosition); break; } }