本文整理汇总了C#中Character.Idle方法的典型用法代码示例。如果您正苦于以下问题:C# Character.Idle方法的具体用法?C# Character.Idle怎么用?C# Character.Idle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character
的用法示例。
在下文中一共展示了Character.Idle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThrowTarget
private IEnumerator ThrowTarget(Character target)
{
jituiTargets.Add(target);
yield return new WaitForSeconds(HitTime);
Vector3 srcPos = new Vector3(target.position.x, target.position.y, target.position.z);
Vector3 destPos = target.SrcPos;
target.BreakSkill();
target.position = srcPos;// BreakSkill 会回复位置
target.Idle();
Vector2 v2DestPos = new Vector2(destPos.x, destPos.z);
Vector2 v2SrcPos = new Vector2(target.position.x, target.position.z);
Vector2 dir = new Vector2(v2DestPos.x - v2SrcPos.x, v2DestPos.y - v2SrcPos.y);
dir.Normalize();
float g = 70f;
float speed = 15f;
float dist = Vector2.Distance(v2DestPos, v2SrcPos);
float total = dist / speed;
float h = destPos.y - target.position.y;
float v = 0f;
if (total > 0f) v = (h - 0.5f * (-g) * total * total) / total;
Vector3 vo = new Vector3(dir.x * speed, v, dir.y * speed);
Vector3 a = new Vector3(0f, -g, 0f);
float xAng = 0;
float time = 0;
AddEvent(delegate
{
time += Time.deltaTime;
Vector3 p = vo * time + 0.5f * a * time * time;
target.position = srcPos + p;
xAng += Time.deltaTime * 1000000;
target.rotation = Quaternion.Euler(new Vector3(0, xAng, 0));
if (time >= total)
{
// 目标伤害计算
CalcDamage(attacker, target, Damage, 0f);
target.position = target.SrcPos;
target.rotateBack();
EndJiTui(target);
return true;
}
return false;
});
}
示例2: JiTuiTarget
private IEnumerator JiTuiTarget(Character target)
{
float hitTime = HitTime;
yield return new WaitForSeconds(hitTime);
CalcDamage(attacker, target, Damage, 0f);
Vector3 srcPos = new Vector3(target.position.x, target.position.y, target.position.z);
Vector3 dir = target.position - attacker.position;
dir.Normalize();
Vector3 destPos = target.position + dir * 1.5f;
if (target.CurrSkill != null && target.CurrSkill.skilldata.Func != "NfThrowBack") {
target.BreakSkill();
}
target.position = srcPos;// BreakSkill 会回复位置
target.Idle();
MoveNoRotate(target, destPos, BulletSpeed, "idle", 1f, delegate
{
if (target.IsDead)
{
//target.PlayAnim("die");
target.Dead();
EndJiTui(target);
}
else
{
AddEvent(pauseTime, delegate
{
MoveSrcPos(target, delegate
{
EndJiTui(target);
});
});
}
});
}
示例3: MoveSrcPos
public void MoveSrcPos(Character chara, MoveCallback callback)
{
float moveSpeed = 50f;
float animSpeed = (moveSpeed / attacker.moveSpeed) * attacker.moveAnimSpeed;
Move(chara, chara.SrcPos, moveSpeed, "run", animSpeed, delegate
{
chara.position = new Vector3(chara.SrcPos.x, chara.SrcPos.y, chara.SrcPos.z);
chara.rotateBack();
chara.Idle();
callback();
});
}