You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CozmoAcademy.cs 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. ///-----------------------------------------------------------------
  2. /// Namespace: <Cozmo>
  3. /// Class: <CozmoAcademy>
  4. /// Description: <The academy used for cozmo. Sets cozmo back to its starting position if the academy gets reset.>
  5. /// Author: <Tobias Hassel> Date: <29.07.2019>
  6. /// Notes: <>
  7. ///-----------------------------------------------------------------
  8. ///
  9. using MLAgents;
  10. using UnityEngine;
  11. namespace Cozmo
  12. {
  13. public class CozmoAcademy : Academy
  14. {
  15. [Tooltip("Reference to the cozmo gameobject in the scene.")]
  16. public GameObject cozmo;
  17. [Tooltip("Reference to the transform which represents the starting position for cozmo.")]
  18. public Transform startPoint;
  19. public override void AcademyReset()
  20. {
  21. SetCozmoBackToStartingPosition();
  22. }
  23. // Resets Cozmos position and rotation to match its starting position
  24. private void SetCozmoBackToStartingPosition()
  25. {
  26. cozmo.transform.position = startPoint.position;
  27. cozmo.transform.rotation = startPoint.rotation;
  28. }
  29. }
  30. }