当前位置: 首页>>代码示例>>C#>>正文


C# Fighter.StartHitstunTimer方法代码示例

本文整理汇总了C#中Fighter.StartHitstunTimer方法的典型用法代码示例。如果您正苦于以下问题:C# Fighter.StartHitstunTimer方法的具体用法?C# Fighter.StartHitstunTimer怎么用?C# Fighter.StartHitstunTimer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fighter的用法示例。


在下文中一共展示了Fighter.StartHitstunTimer方法的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;
    }
开发者ID:chozoace,项目名称:ProjectAnubis,代码行数:43,代码来源:Attack.cs


注:本文中的Fighter.StartHitstunTimer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。