本文整理汇总了C#中Fighter.EnterHitstun方法的典型用法代码示例。如果您正苦于以下问题:C# Fighter.EnterHitstun方法的具体用法?C# Fighter.EnterHitstun怎么用?C# Fighter.EnterHitstun使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fighter
的用法示例。
在下文中一共展示了Fighter.EnterHitstun方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttackFreeze
//Currently only does air attack freeze ADD ONE FOR GROUND
IEnumerator AttackFreeze(Fighter enemyRef)
{
_fighterRef.InHitstunFreeze = true;
enemyRef.InHitstunFreeze = true;
//
enemyRef.EnterHitstun();
//Freeze both player and target for x time
Vector2 thisVelocity = _fighterRef.GetComponent<Rigidbody2D>().velocity;
Vector2 otherVelocity = enemyRef.GetComponent<Rigidbody2D>().velocity;
thisVelocity.y += 3;
if (_slamSpeed != 0)
{
otherVelocity.y = _slamSpeed;
thisVelocity.y = 4;
if (otherVelocity.x > 0)
otherVelocity.x += 4;
else
otherVelocity.x -= 4;
}
else
{
otherVelocity.y += 4f;
}
float thisGravity = _fighterRef.GetComponent<Rigidbody2D>().gravityScale;
float otherGravity = enemyRef.GetComponent<Rigidbody2D>().gravityScale;
_anim.speed = 0;
_fighterRef.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
_fighterRef.GetComponent<Rigidbody2D>().gravityScale = 0;
enemyRef.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
enemyRef.GetComponent<Rigidbody2D>().gravityScale = 0;
yield return new WaitForSeconds(_hitstunFreezeTime);
_anim.speed = 1;
_fighterRef.GetComponent<Rigidbody2D>().velocity = thisVelocity;
enemyRef.GetComponent<Rigidbody2D>().velocity = otherVelocity;
_fighterRef.GetComponent<Rigidbody2D>().gravityScale = thisGravity;
enemyRef.GetComponent<Rigidbody2D>().gravityScale = otherGravity;
enemyRef.StartHitstunTimer(_hitstunTime);
_fighterRef.InHitstunFreeze = false;
enemyRef.InHitstunFreeze = false;
}