83 lines
1.7 KiB
C#
83 lines
1.7 KiB
C#
using System;
|
|
using System.Collections;
|
|
using UnityEngine;
|
|
using Animancer;
|
|
using DarkTonic.MasterAudio;
|
|
|
|
public class PlayerAIAnimator : MonoBehaviour
|
|
{
|
|
public PlayerAI playerAI;
|
|
|
|
private void Start()
|
|
{
|
|
playerAI = GetComponentInParent<PlayerAI>();
|
|
}
|
|
|
|
[Header("出生音效")]
|
|
[SoundGroup]
|
|
public string bothSound;
|
|
[Header("死亡音效")]
|
|
[SoundGroup]
|
|
public string dieSound;
|
|
|
|
[Header("移动音效")]
|
|
[SoundGroup]
|
|
public string moveSound;
|
|
|
|
|
|
[Header("攻击音效")]
|
|
[SoundGroup]
|
|
public string attackSound;
|
|
|
|
[Header("受击音效")]
|
|
[SoundGroup]
|
|
public string hitSound;
|
|
|
|
public void PlaySound(int id)
|
|
{
|
|
string curSound = "";
|
|
switch (id)
|
|
{
|
|
case 0:
|
|
curSound = bothSound;
|
|
break;
|
|
case 1:
|
|
curSound = moveSound;
|
|
break;
|
|
case 2:
|
|
curSound = attackSound;
|
|
break;
|
|
case 3:
|
|
curSound = dieSound;
|
|
break;
|
|
case 4:
|
|
curSound = hitSound;
|
|
break;
|
|
}
|
|
PlaySound3DRPC(curSound,transform,true);
|
|
}
|
|
|
|
public void PlaySound3DRPC(string sound,Transform tran,bool isStop)
|
|
{
|
|
if(isStop)
|
|
MasterAudio.StopAllSoundsOfTransform(tran);
|
|
MasterAudio.PlaySound3DAtTransform(sound, tran);
|
|
}
|
|
|
|
public void StopAttack()
|
|
{
|
|
playerAI.StopAttack();
|
|
}
|
|
|
|
public void SelfDie()
|
|
{
|
|
|
|
}
|
|
|
|
// public void Die()
|
|
// {
|
|
// if(playerAI.isServer)
|
|
// //GameManager.Ins.DeleteEnemy(playerAI.id,transform);
|
|
// }
|
|
}
|