當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。