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


C# Character.Idle方法代码示例

本文整理汇总了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;
        });
    }
开发者ID:wenhu2010,项目名称:mygame,代码行数:52,代码来源:NfThrowBack.cs

示例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);
                    });
                });
            }
        });
    }
开发者ID:wenhu2010,项目名称:mygame,代码行数:38,代码来源:NfJiTui.cs

示例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();
        });
    }
开发者ID:wenhu2010,项目名称:mygame,代码行数:13,代码来源:NfSkill.cs


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