前言
这一篇讲讲流程中的第二步,PartyAI到RoleAI传递的过程中,可以执行技能特效,比如摄像机动画和全屏特效
步骤
1 执行技能特效,肯定需要一个协程,看伪代码
public void InputSkilButton(int playerindex, int skillindex)//角色索引,索引
{
//程序健壮性判断
if (Time.timeScale < 0.5f) return;//如果正在播放技能特效,则不能释放招数
if (playerindex >= playerParty.Count) return;
if (playerParty[playerindex].CanInputSkill(skillindex))
{
//处理对释放技能后的变化
GameObject fxscrIns = 根据技能索引得到技能信息,再根据信息取到 镜头特效(释放大招时才有哦)
if (fxscrIns == null)//不是大招
{
if (逻辑判断)
{
StartCoroutine(PlaySwordArt(playerindex, skillindex, null));//执行特效的协程
//继续执行逻辑处理
}
}
else
{
GameObject tempFXscr = Instantiate(fxscrIns) as GameObject;//实例化镜头特效
if (逻辑判断)
{
StartCoroutine(PlaySwordArt(playerindex, skillindex, tempFXscr));
}
}
}
}
/// <summary> 释放技能时的特效,屏幕变暗,全屏动画等</summary>
IEnumerator PlaySwordArt(int playerindex, int skillindex, GameObject tempFXscr)//角色索引