Hi!
My characters has auto attack:
void Attack()
{
if (_target != null && IfTargetAlive())
{
if (_targetSelected && _target != null && networkView.isMine && IfTargetAlive() && _target.tag == "Creature" ||
(this.tag != _target.tag && _target.tag.Contains("Player")))
{
if (Vector3.Distance(_target.transform.position, this.transform.position) <= 1.6f &&
Mathf.Abs(Vector3.Angle(transform.forward, this.transform.position - _target.transform.position)) < 270)
{
attackable = true;
if (canAttack)
{
if (Input.GetKey(KeyCode.T))
{
animMainFlag = true;
}
if (animMainFlag)
{
if (!animChoosen)
{
curAnimNum = (int)UnityEngine.Random.Range(0, 3);
animChoosen = true;
}
if (animChoosen)
{
networkView.RPC("AnimNetwork", RPCMode.All, animationAttackList.ElementAt(curAnimNum));
}
}
}
else
{
attackable = false;
}
}
}
}
}
[RPC]
void AnimNetwork(string name)
{
curAnim = name;
if (networkView.isMine)
this.networkView.RPC("SendBool", RPCMode.All, animationAttackList.ElementAt(curAnimNum), true);
}
Characters also have skills, which start with animation:
public void CastSpell(int id)
{
if(IfTargetAlive())
networkView.RPC("SendTrigger", RPCMode.All, "s"+id);
}
When i start attacking (autoAttack mode is ON) should i use spell one moment, spell animation starts playing and it becomes being broken by next attack animation/ So suggest me please how to wait for spell animation ending if it has following structure:
[38420-безымянный.png|38420]