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.

34 lines
612 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace TFHC_Shader_Samples
  5. {
  6. public class highlightAnimated : MonoBehaviour
  7. {
  8. private Material mat;
  9. void Start()
  10. {
  11. mat = GetComponent<Renderer>().material;
  12. }
  13. void OnMouseEnter()
  14. {
  15. switchhighlighted(true);
  16. }
  17. void OnMouseExit()
  18. {
  19. switchhighlighted(false);
  20. }
  21. void switchhighlighted(bool highlighted)
  22. {
  23. mat.SetFloat("_Highlighted", (highlighted ? 1.0f : 0.0f));
  24. }
  25. }
  26. }