public static void MoveBackward(GameObject player) { // Works the same as above but x and y are flipped Vector2 dir = AIDirectionBehaviour.GetRotationVector(player); AIBasicBehaviour.GetController(player).playerController.playerMovement.MovePlayer(-dir.x, -dir.y); }
public static void MoveForward(GameObject player) { /* This method moves player forward but it does not * take care of the direction. To make the player run to the ball * use RunToTheBall method. */ Vector2 dir = AIDirectionBehaviour.GetRotationVector(player); AIBasicBehaviour.GetController(player).playerController.playerMovement.MovePlayer(dir.x, dir.y); }
public static void LookAt(GameObject player, GameObject o) { /* This method makes the player look at the object. * This is usually used to make the player look at the ball. * First, the position of the object we want to look at, in regards of the player * is found and then the player is rotated. */ float x = o.transform.position.x - player.transform.position.x; float y = o.transform.position.y - player.transform.position.y; AIBasicBehaviour.GetController(player).playerRotator.Rotate(x, y); }
public static void MoveForward(GameObject player, float x, float y) { /* x and y are not the position of the object but the vector towards it. */ AIBasicBehaviour.GetController(player).playerController.playerMovement.MovePlayer(x, y); }
public static void LookAt(GameObject player, float x, float y) { AIBasicBehaviour.GetController(player).playerRotator.Rotate(x - player.transform.position.x, y - player.transform.position.y); }