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


C# Character.FindBone方法代码示例

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


在下文中一共展示了Character.FindBone方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Fire

    protected void Fire(Character target, string fireBone, string bulletModel)
    {
        Transform bullet = null;
        GameObject hand = attacker.FindBone(fireBone);
        EffectObject effObj = PlayEffect(bulletModel, -1f);
        GameObject bulletObj = effObj.obj;
        bullet = bulletObj.transform;
        bullet.position = hand.transform.position;

        Vector3 destPos = target.position;
        GameObject bone = target.FindBone("Bip01");
        if (bone != null)
        {
            destPos.y = bone.transform.position.y;
        }

        Vector3 dir = new Vector3(destPos.x - bullet.position.x, destPos.y - bullet.position.y, destPos.z - bullet.position.z);
        dir.Normalize();
        bullet.rotation = Quaternion.FromToRotation(new Vector3(0f, 0f, 1f), new Vector3(dir.x, dir.y, dir.z));

        // 子弹碰撞检测
        float bulletSpeed = BulletSpeed;

        Move(bullet, destPos, bulletSpeed, delegate
        {
            OnCollision(target);

            DestroyEff(effObj);
            if (--bulletNum <= 0)
            {
                DoTskill();
                End();
            }
        });
    }
开发者ID:wenhu2010,项目名称:mygame,代码行数:35,代码来源:NfBullet.cs

示例2: LinkTarget

    public void LinkTarget(Character beLinker)
    {
        target = beLinker;

        string eff = Effect;

        if (buffdata.Bind == "di")
        {
            PlaySelfEffect();
            //ribbon = beLinker.PlayEffect(Effect, -1f);
        }
        else
        {
            ribbon = owner.PlayEffect(eff, -1, delegate(GameObject obj)
            {
                GameObject begin = Helper.FindObject(obj, "Begin_01");
                GameObject end = Helper.FindObject(obj, "End_01");
                GameObject bone1 = owner.FindBone("Bip01");//Helper.FindObject(self.gameObject, "Bip01", false);
                GameObject bone2 = beLinker.FindBone("Bip01");//Helper.FindObject(beLinker.gameObject, "Bip01", false);
                begin.transform.position = bone1.transform.position;
                begin.transform.parent = bone1.transform;
                end.transform.position = bone2.transform.position;
                end.transform.parent = bone2.transform;
            });
        }
    }
开发者ID:wenhu2010,项目名称:mygame,代码行数:26,代码来源:NfLinkBuff.cs

示例3: Fire

    protected IEnumerator Fire(Character target, string fireBone, string bulletModel)
    {
        attacker.LookAt(target);

        animation.Stop(FireAnim);
        PlayFireAnimAndEffect();
        yield return new WaitForSeconds(SingTime);

        Transform bullet = null;
        GameObject hand = attacker.FindBone(fireBone);//Helper.FindObject(gameObject, fireBone, false);
        EffectObject effObj = PlayEffect(bulletModel, -1f);
        GameObject bulletObj = effObj.obj;
        bullet = bulletObj.transform;
        bullet.position = new Vector3(hand.transform.position.x, hand.transform.position.y, hand.transform.position.z);

        Vector3 destPos = target.position;
        GameObject bone = target.FindBone("Bip01");//Helper.FindObject(gameObject, "Bip01", false);
        if (bone != null)
        {
            destPos.y = bone.transform.position.y;
        }

        Vector3 dir = new Vector3(destPos.x - bullet.position.x, destPos.y - bullet.position.y, destPos.z - bullet.position.z);
        dir.Normalize();
        bullet.rotation = Quaternion.FromToRotation(new Vector3(0f, 0f, 1f), new Vector3(dir.x, dir.y, dir.z));

        // 子弹碰撞检测
        float bulletSpeed = BulletSpeed;

        Move(bullet, destPos, bulletSpeed, delegate
        {
            // 目标伤害计算
            CalcDamage(attacker, target, Damage, 0f);

            DestroyEff(effObj);

            if (--fireNum > 0)
            {
                FindTarget(target, fireBone, bulletModel);
            }
            else
            {
                End();
            }
        });
    }
开发者ID:wenhu2010,项目名称:mygame,代码行数:46,代码来源:NfDartle.cs

示例4: Attack

    IEnumerator Attack()
    {
        // 播放动画和特效
        float animLen = attacker.GetAnimLength(SingAnim);
        PlaySingAnimAndEffect();

        yield return new WaitForSeconds(animLen);

        target = attacker.target;
        GameObject bone = attacker.FindBone(FireBone);//Helper.FindObject(gameObject, FireBone, false);
        GameObject destBone = target.FindBone("Bip01");//Helper.FindObject(target.gameObject, "Bip01", false);

        EffectObject effObj = PlayChainEff(BulletModel, -1f, bone.transform.position, bone.transform.position);
        GameObject begin = Helper.FindObject(effObj.obj, "Begin_01");
        begin.transform.parent = bone.transform;
        begin.transform.position = bone.transform.position;
        GameObject end = Helper.FindObject(effObj.obj, "End_01");

        string str = KeepAnim;
        JsonData jsd = JsonMapper.ToObject(str);

        attacker.PlayAnim((string)jsd[0]);

        float bulletSpeed = BulletSpeed;
        Move(end.transform, destBone.transform.position, bulletSpeed, delegate
        {
            float len = attacker.PlayAnim((string)jsd[1]);

            AddEvent(len, delegate
            {
                attacker.PlayAnim((string)jsd[2]);
            });

            Move(end.transform, begin.transform.position, bulletSpeed, delegate
            {
                DestroyEff(effObj);
            });

            GameObject bipBone = attacker.FindBone("Bip01");//Helper.FindObject(gameObject, "Bip01", false);
            Move(target, bipBone.transform.position, bulletSpeed, delegate
            {
                StartCoroutine(Explode(target));
            });
        });
    }
开发者ID:wenhu2010,项目名称:mygame,代码行数:45,代码来源:NfGou.cs

示例5: PlayChainEff

    public EffectObject PlayChainEff(Character c1, Character c2, string eff, string boneName1, string boneName2)
    {
        ChainEffectObject ribbon = null;
        if (!string.IsNullOrEmpty(eff) && eff != "null")
        {
            try
            {
                GameObject obj = EffectMgr.Load(eff);
                ribbon = new ChainEffectObject(obj);
                effects.Add(ribbon);

                GameObject begin = Helper.FindObject(ribbon.obj, "Begin_01");
                GameObject end = Helper.FindObject(ribbon.obj, "End_01");
                GameObject bone1 = c1.FindBone(boneName1);//Helper.FindObject(c1.gameObject, boneName1, false);
                GameObject bone2 = c2.FindBone(boneName2);//Helper.FindObject(c2.gameObject, boneName2, false);
                begin.transform.position = bone1.transform.position;
                begin.transform.parent = bone1.transform;
                end.transform.position = bone2.transform.position;
                end.transform.parent = bone2.transform;
                ribbon.begin = begin;
                ribbon.end = end;

                Effect e = DataMgr.GetEffect(eff);
                if (e != null)
                {
                    if (e.time > 0f)
                        DestroyEff(ribbon, e.time);
                }
            }
            catch (UnityException e)
            {
                Debug.LogException(e);
            }
        }

        return ribbon;
    }
开发者ID:wenhu2010,项目名称:mygame,代码行数:37,代码来源:NfSkill.cs

示例6: FireCurveBullet

    public void FireCurveBullet(Character atk, Vector3 destPos, float dam, GameEvent.Func callback)
    {
        List<Character> targets = FindAllAttackTarget(attacker);

        float gravity = 45f;
        float speed = 15f;
        JsonData bulletJson = JsonMapper.ToObject(skilldata.BulletSpeed);
        if (bulletJson.IsArray)
        {
            gravity = (float)bulletJson[0];
            speed = (float)bulletJson[1];
        }

        Transform bullet = null;
        EffectObject effObj = PlayEffect(BulletModel, -1f);
        GameObject bulletObj = effObj.obj;
        bullet = bulletObj.transform;

        GameObject hand = atk.FindBone(FireBone);
        bullet.position = new Vector3(hand.transform.position.x, hand.transform.position.y, hand.transform.position.z);

        // 子弹碰撞检测
        Vector2 v2DestPos = new Vector2(destPos.x, destPos.z);
        Vector2 v2SrcPos = new Vector2(bullet.position.x, bullet.position.z);
        Vector2 dir = new Vector2(v2DestPos.x - v2SrcPos.x, v2DestPos.y - v2SrcPos.y);
        dir.Normalize();

        float dist = Vector2.Distance(v2DestPos, v2SrcPos);
        float total = dist / speed;
        float h = destPos.y - bullet.position.y;
        float v = (h - 0.5f * (-gravity) * total * total) / total;
        Vector3 vo = new Vector3(dir.x * speed, v, dir.y * speed);
        Vector3 a = new Vector3(0f, -gravity, 0f);
        Vector3 srcPos = new Vector3(bullet.position.x, bullet.position.y, bullet.position.z);

        float pictch = Mathf.Atan2(v, speed) * Mathf.Rad2Deg;
        bullet.rotation = Quaternion.FromToRotation(new Vector3(0f, 0f, 1f), new Vector3(dir.x, 0f, dir.y)) * Quaternion.Euler(-pictch, 0, 0);

        float time = 0;
        AddEvent(delegate
        {
            time += Time.deltaTime;
            Vector3 p = vo * time + 0.5f * a * time * time;
            bullet.position = srcPos + p;

            float vt = v + (-gravity) * time;
            pictch = Mathf.Atan2(vt, speed) * Mathf.Rad2Deg;
            bullet.rotation = Quaternion.FromToRotation(new Vector3(0f, 0f, 1f), new Vector3(dir.x, 0f, dir.y)) * Quaternion.Euler(-pictch, 0f, 0f);

            if (time >= total)
            {
                CalcCircalDamage(atk, targets, destPos, dam, 0f);

                DestroyEff(effObj);

                if (callback != null)
                {
                    callback();
                }
                return true;
            }

            return false;
        });
    }
开发者ID:wenhu2010,项目名称:mygame,代码行数:65,代码来源:NfSkill.cs


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