var otherClip01 : AudioClip;
var otherClip02 : AudioClip;

function Start()

   var sound01:AnimationEvent = new AnimationEvent();
  sound01.time = animation["attack_1"].clip.length*0.5f;
  sound01.functionName = "soundTemp01";//回调函数名
  animation["attack_1"].clip.AddEvent(sound01);
 
  var sound02:AnimationEvent = new AnimationEvent();
  sound02.time = animation["attack_2"].clip.length*0.5f;
  sound02.functionName = "soundTemp02";//回调函数名
  animation["attack_2"].clip.AddEvent(sound02);
}

function soundTemp01()
{
  audio.clip = otherClip01;
  audio.Play();
}

function soundTemp02()
{
  audio.clip = otherClip02;
  audio.Play();
}

相关文章:

  • 2021-12-07
  • 2022-12-23
  • 2021-04-12
  • 2022-12-23
  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-13
  • 2021-06-22
  • 2022-12-23
  • 2021-04-11
  • 2021-06-22
  • 2022-03-03
相关资源
相似解决方案