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.

38 lines
1.0 KiB

  1. /************************************************************************************
  2. See SampleFramework license.txt for license terms. Unless required by applicable law
  3. or agreed to in writing, the sample code is provided AS IS WITHOUT WARRANTIES OR
  4. CONDITIONS OF ANY KIND, either express or implied. See the license for specific
  5. language governing permissions and limitations under the license.
  6. ************************************************************************************/
  7. using UnityEngine;
  8. using UnityEngine.Assertions;
  9. namespace OculusSampleFramework
  10. {
  11. public class CowController : MonoBehaviour
  12. {
  13. [SerializeField] private Animation _cowAnimation = null;
  14. [SerializeField] private AudioSource _mooCowAudioSource = null;
  15. private void Start()
  16. {
  17. Assert.IsNotNull(_cowAnimation);
  18. Assert.IsNotNull(_mooCowAudioSource);
  19. }
  20. public void PlayMooSound()
  21. {
  22. _mooCowAudioSource.timeSamples = 0;
  23. _mooCowAudioSource.Play();
  24. }
  25. public void GoMooCowGo()
  26. {
  27. _cowAnimation.Rewind();
  28. _cowAnimation.Play();
  29. }
  30. }
  31. }