AngleSelectTeleport.cs 921 B

12345678910111213141516171819202122
  1. //***********************************************************
  2. // Filename: AngleSelectTeleport.cs
  3. // Author: Moritz Kolvenbach, Marco Fendrich
  4. // Last changes: Wednesday, 8th of August 2018
  5. // Content: Class that adds a rotation via touchpad coordinates to ParabolicTeleport
  6. //***********************************************************
  7. using UnityEngine;
  8. /// <summary>
  9. /// Child class of ParabolicTeleport adding a rotation via touchpad
  10. /// </summary>
  11. public class AngleSelectTeleport : ParabolicTeleport, ITouchpadAxis
  12. {
  13. /// <summary>
  14. /// take x and y coordinates of touchpad and translate them to a rotation around the normal of the touchpad
  15. /// this rotation is being sent through RenderableTeleport to actual teleport script
  16. /// </summary>
  17. /// <param name="axis">touchpad axis</param>
  18. public void OnButtonPressed(Vector2 axis)
  19. { rotation = Vector2.SignedAngle(axis, Vector2.up); }
  20. }