| | | 1 | | using System.Collections; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using UnityEngine; |
| | | 4 | | |
| | | 5 | | public class PhoneRingScreen : MonoBehaviour |
| | | 6 | | { |
| | | 7 | | private AudioSource audioSource; |
| | | 8 | | private Material original_material; |
| | | 9 | | // private Renderer renderer; |
| | | 10 | | public Material calling_material; |
| | | 11 | | void Start() |
| | 2 | 12 | | { |
| | 2 | 13 | | audioSource = GetComponent<AudioSource>(); |
| | 2 | 14 | | original_material = GetComponent<Renderer>().material; |
| | 2 | 15 | | } |
| | | 16 | | |
| | | 17 | | void Update() |
| | 2748 | 18 | | { |
| | 2748 | 19 | | if(audioSource.isPlaying) |
| | 1570 | 20 | | { |
| | 1570 | 21 | | GetComponent<Renderer>().material = calling_material; |
| | 1570 | 22 | | } |
| | | 23 | | else |
| | 1178 | 24 | | { |
| | 1178 | 25 | | GetComponent<Renderer>().material = original_material; |
| | 1178 | 26 | | } |
| | 2748 | 27 | | } |
| | | 28 | | } |