Assignment for RMIT Mixed Reality in 2020
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.

40 lines
1.2 KiB

  1. /************************************************************************************
  2. Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
  3. See SampleFramework license.txt for license terms. Unless required by applicable law
  4. or agreed to in writing, the sample code is provided AS IS WITHOUT WARRANTIES OR
  5. CONDITIONS OF ANY KIND, either express or implied. See the license for specific
  6. language governing permissions and limitations under the license.
  7. ************************************************************************************/
  8. using UnityEngine;
  9. using UnityEngine.Assertions;
  10. namespace OculusSampleFramework
  11. {
  12. public class TrainCar : TrainCarBase
  13. {
  14. [SerializeField] private TrainCarBase _parentLocomotive = null;
  15. [SerializeField] protected float _distanceBehindParent = 0.1f;
  16. public float DistanceBehindParentScaled
  17. {
  18. get { return scale * _distanceBehindParent; }
  19. }
  20. protected override void Awake()
  21. {
  22. base.Awake();
  23. Assert.IsNotNull(_parentLocomotive);
  24. }
  25. public override void UpdatePosition()
  26. {
  27. Distance = _parentLocomotive.Distance - DistanceBehindParentScaled;
  28. UpdateCarPosition();
  29. RotateCarWheels();
  30. }
  31. }
  32. }