1
This commit is contained in:
@@ -8,6 +8,8 @@ public class TouchPlayAnimatior : MonoBehaviour
|
||||
public GrabItem grabItem;
|
||||
Animator animator;
|
||||
AudioSource audioSource;
|
||||
//clips<70><73><EFBFBD><EFBFBD>
|
||||
public AudioClip[] audioClips;
|
||||
//<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
||||
bool isRun = false;
|
||||
float waitTime = 2f;
|
||||
@@ -41,7 +43,11 @@ public class TouchPlayAnimatior : MonoBehaviour
|
||||
if (runTime >= showGrabItem) //<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͭ<EFBFBD><CDAD>
|
||||
{
|
||||
if (grabItem != null && grabItem.gameObject.activeSelf == false)
|
||||
{
|
||||
grabItem.gameObject.SetActive(true);
|
||||
PlayAudioByIndex(1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +60,7 @@ public class TouchPlayAnimatior : MonoBehaviour
|
||||
animator.Play("Touch");
|
||||
isRun = true;
|
||||
if (audioSource != null)
|
||||
audioSource.Play();
|
||||
PlayAudioByIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,4 +69,20 @@ public class TouchPlayAnimatior : MonoBehaviour
|
||||
if (showSelfFont != null)
|
||||
showSelfFont.PlayShowJGWFont();
|
||||
}
|
||||
public void PlayAudioByIndex(int index)
|
||||
{
|
||||
if (audioClips != null && index >= 0 && index < audioClips.Length)
|
||||
{
|
||||
if (audioClips[index] != null)
|
||||
{
|
||||
audioSource.clip = audioClips[index];
|
||||
audioSource.Play();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("<22><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user