Beispiel #1
0
 public void EndMouse(Transform user, Vector3 targetPoint, Transform handSpot, int useType)
 {
     if (timeUntilUse <= 0 && useType < data.useTypes.Length)
     {
         if (useCount < data.useTypes[useType].uses.Length)
         {
             if (data.useTypes[useType].uses[useCount].canBeHeld)
             {
                 if (Time.time - beginUseTime > data.useTypes[useType].uses[useCount].minHoldTime)
                 {
                     Use(user, targetPoint, handSpot, useType, data.useTypes[useType].uses[useCount],
                         data.useTypes[useType].uses[useCount].holdScaling.Evaluate((Time.time - beginUseTime) / data.useTypes[useType].uses[useCount].maxHoldTime));
                     isCharging = false;
                 }
                 else if (data.useTypes[useType].uses[useCount].notEnoughHold.effects.Length > 0)
                 {
                     Use(user, targetPoint, handSpot, useType, data.useTypes[useType].uses[useCount].notEnoughHold, 0f);
                     isCharging = false;
                 }
                 else
                 {
                     isCharging = false;
                     AnimationEventManager.ItemAnimationStop(this, data.itemSprites);
                 }
             }
         }
     }
 }
Beispiel #2
0
    void ItemUseAnimation(Object returnToSender, Triggers currentUse, ItemSprites spriteInfo)
    {
        Sprite[] leftAnim;
        Sprite[] rightAnim;

        leftAnim  = currentUse.leftHandSprites;
        rightAnim = currentUse.rightHandSprites;

        leftHandAnim.PlayAnimation(leftAnim, attackFrameRate, currentUse.keyFrame, (() =>
        {
        }), (() =>
        {
            leftHandSpriteRenderer.sprite = spriteInfo.leftHandSprite;
        }));
        rightHandAnim.PlayAnimation(rightAnim, attackFrameRate, currentUse.keyFrame, (() =>
        {
            if (spriteInfo.wrapSwing)
            {
                if (rightHandSpriteRenderer.transform.position.x < transform.position.x && rightHandSpriteRenderer.transform.position.z > transform.position.z)
                {
                    rightHandSpriteRenderer.sortingOrder = 3;
                }
            }

            AnimationEventManager.ItemUseTrigger(returnToSender, currentUse);
        }), (() =>
        {
            rightHandSpriteRenderer.sortingOrder = 1;
            AnimationEventManager.ItemUseCompletion(transform);
            rightHandSpriteRenderer.sprite = spriteInfo.rightHandSprite;
        }));
    }
Beispiel #3
0
    public void Use(Transform user, Vector3 targetPoint, Transform handSpot, int useType, Triggers trigger, float holdFactor)
    {
        AnimationEventManager.ItemUseStart(this);

        /*Debug.DrawRay(userPos, (targetPoint - userPos), Color.gray, 0.4f);
         * Debug.Log("Target Point: " + targetPoint);
         * Debug.Log("User Position: " + userPos);
         * Debug.Log("Use Vector: " + (targetPoint - userPos));   */
        chargePercent = holdFactor;
        target        = targetPoint;
        userPosition  = user.position;
        useLocation   = Vector3.ClampMagnitude((target - userPosition), trigger.range);
        useLocation   = new Vector3(useLocation.x, 0f, useLocation.z);

        /*Debug.DrawRay(userPos, useLocation, Color.black, 0.4f);
         * Debug.Log("Clamped Use Vector: " + useLocation);
         * Debug.Log("Actual Target Point: " + (userPos + useLocation));*/

        AnimationEventManager.ItemUse(this, trigger, data.itemSprites);
        timeUntilUse = trigger.cooldown;
        ++useCount;
        if (useCount >= data.useTypes[useType].uses.Length)
        {
            useCount = 0;
        }
        lastMouseButton = useType;
    }
Beispiel #4
0
    public void Damage(int damageToTake)
    {
        if (damageCooldown <= 0)
        {
            // animation, particles, etc
            // damage events here
            Decrease(damageToTake);
            //Debug.Log("Ouch! " + gameObject.name + " took " + damageToTake + " damage, and has " + currentValue + " health left.");
            if (GetComponent <PlayerCharacter_Animator>() != null || GetComponent <NPC_Animator>() != null)
            {
                AnimationEventManager.FloatingText(this, damageToTake.ToString());
            }

            // check for death, etc
            if (currentValue <= 0)
            {
                AnimationEventManager.Death(this);
            }
            else
            {
                AnimationEventManager.DamageTaken(this);
            }
            damageCooldown = 0.4f;
        }
    }
Beispiel #5
0
    public virtual void SetAnimationEvents(AnimationClip dstClip)
    {
        AnimationEventManager animationEventManager = new AnimationEventManager(dstClip);

        animationEventManager.AddAnimationEvent(dstClip.length, "AnimationEventEnd");
        animationEventManager.SaveAnimationEvent();
    }
Beispiel #6
0
 private void StartCharge(Transform user, int useType, ItemSprites spriteInfo)
 {
     isCharging      = true;
     beginUseTime    = Time.time;
     lastMouseButton = useType;
     AnimationEventManager.ItemChargeStart(user, data.useTypes[useType].uses[useCount], data.itemSprites);
 }
Beispiel #7
0
    private void OnJumpMovement(Transform transform, AnimationEventManager animationEventManager, Animator animator, Rigidbody rigidbody, Entity entity, Actor actor, ref ActorInput actorInput, ActorCharacter actorCharacter)
    {
        //Save Jump Data
        if (!jumpIntervals.ContainsKey(entity.Index))
        {
            jumpIntervals.Add(entity.Index, jumpInterval);
        }

        //Decrease jump interval if goruned
        if (isGrounded && rigidbody.velocity.y <= 0)
        {
            jumpIntervals[entity.Index] -= 1 * dt;
            actorInput.isJumping         = 0;
        }

        //If were not grounded reset jump interval
        else
        {
            jumpIntervals[entity.Index] = jumpInterval;
        }

        //Do Jump
        if (actorInput.action == 0 && actorInput.actionToDo == 2 && isGrounded && actorCharacter.jumpForce != 0 && isHeadFree && jumpIntervals[entity.Index] <= 0)
        {
            var velocity = rigidbody.velocity;
            velocity.y         = actorCharacter.jumpForce;
            rigidbody.velocity = velocity;

            animator.SetTrigger("jump");

            actorInput.isJumping = 1;

            if (actorInput.crouch == 1)
            {
                ActorUtilities.UpdateCollider(actor, transform, "standing");
            }

            if (actorInput.movement.magnitude != 0)
            {
                transform.forward = actorInput.movement;
            }
        }

        //Sound
        {
            if (animationEventManager.RequestEvent("jumpGrunt") && actorCharacter.jumpGruntAudioEvent != null)
            {
                actorCharacter.jumpGruntAudioEvent.Play(transform.position);
            }
            else if (animationEventManager.RequestEvent("jumpStart") && actorCharacter.jumpStartAudioEvent != null)
            {
                actorCharacter.jumpStartAudioEvent.Play(transform.position);
            }
            else if (animationEventManager.RequestEvent("jumpLand") && actorCharacter.jumpLandAudioEvent != null)
            {
                actorCharacter.jumpLandAudioEvent.Play(transform.position);
            }
        }
    }
 private void CallSkippedAnimationEvent()
 {
     animationEventManager = gameObject.GetComponent <AnimationEventManager>();
     for (int i = 0; i < skippedAnimationEventIDs.Length; i++)
     {
         animationEventManager.ActivateGameObjects(i);
     }
 }
    public static void ExportYuLuoCha()
    {
        UnityEngine.Object    obj     = Selection.activeObject;
        string                path    = AssetDatabase.GetAssetPath(obj);
        AnimationClip         clip    = AssetDatabase.LoadMainAssetAtPath(path) as AnimationClip;
        AnimationEventManager manager = new AnimationEventManager(clip);

        manager.AddAnimationEvent(4.3f, "OnBgFadeOutFinished");
        manager.SaveAnimationEvent();
    }
Beispiel #10
0
    static void ExportYuLuoChaSkillEffect()
    {
        if (Selection.objects != null && Selection.objects.Length > 0)
        {
            foreach (UnityEngine.Object o in Selection.objects)
            {
                AnimationClip clip = o as AnimationClip;
                switch (clip.name)
                {
                case "skill01":
                {
                    AnimationEventManager mgr = new AnimationEventManager(clip);
                    clip.frameRate = 30;

                    mgr.AddAnimationEvent(4 / clip.frameRate, "AnimationEventBoxIn");
                    mgr.AddAnimationEvent(5 / clip.frameRate, "AnimationEventBoxOut");

                    mgr.AddAnimationEvent(7 / clip.frameRate, "AnimationEventBoxIn");
                    mgr.AddAnimationEvent(8 / clip.frameRate, "AnimationEventBoxOut");

                    mgr.AddAnimationEvent(10 / clip.frameRate, "AnimationEventBoxIn");
                    mgr.AddAnimationEvent(11 / clip.frameRate, "AnimationEventBoxOut");

                    mgr.AddAnimationEvent(13 / clip.frameRate, "AnimationEventBoxIn");
                    mgr.AddAnimationEvent(14 / clip.frameRate, "AnimationEventBoxOut");

                    mgr.AddAnimationEvent(16 / clip.frameRate, "AnimationEventBoxIn");
                    mgr.AddAnimationEvent(18 / clip.frameRate, "AnimationEventBoxOut");

                    mgr.AddAnimationEvent(22 / clip.frameRate, "AnimationEventBoxIn");
                    mgr.AddAnimationEvent(23 / clip.frameRate, "AnimationEventBoxOut");

                    mgr.AddAnimationEvent(26 / clip.frameRate, "AnimationEventBoxIn");
                    mgr.AddAnimationEvent(27 / clip.frameRate, "AnimationEventBoxOut");

                    mgr.AddAnimationEvent(31 / clip.frameRate, "AnimationEventBoxIn");

                    mgr.AddAnimationEvent(31 / clip.frameRate, "AnimationEventBoxIn1");        //动作的最后一次//

                    mgr.AddAnimationEvent(32 / clip.frameRate, "AnimationEventBoxOut");

                    mgr.AddAnimationEvent(clip.length, "AnimationEventEnd");
                    mgr.SaveAnimationEvent();
                }
                break;
                }
            }
        }
    }
 static void ExportYuLuoChaSkillEffect()
 {
     if (Selection.objects != null && Selection.objects.Length > 0)
     {
         foreach (UnityEngine.Object o in Selection.objects)
         {
             AnimationClip clip = o as AnimationClip;
             switch (clip.name)
             {
             case "SYdimianyanchen01":
                 AnimationEventManager mgr = new AnimationEventManager(clip);
                 clip.frameRate = 30f;
                 mgr.AddAnimationEvent(4 / clip.frameRate, "AnimationEventBoxIn");
                 mgr.AddAnimationEvent(5 / clip.frameRate, "AnimationEventBoxOut");
                 mgr.AddAnimationEvent(clip.length, "AnimationEventEnd");
                 mgr.SaveAnimationEvent();
                 break;
             }
         }
     }
 }
    protected void Death(Object sender)
    {
        if (this != null && sender.GetType() == typeof(Health) && sender == GetComponent <Health>())
        {
            Sprite[]    arrayToPlay;
            WorldObject wObj = GetComponent <WorldObject>();
            if (wObj.IsPostDeath || (isDeathAnim && !wObj.IsPostDeath))
            {
                arrayToPlay = postDeathFrameArray;
            }
            else
            {
                arrayToPlay = deathFrameArray;
            }

            if (!isDeathAnim || wObj.IsPostDeath)
            {
                if (!isDeathAnim)
                {
                    isDeathAnim = true;
                }
                anim.PlayAnimation(arrayToPlay, frameRate, shadowTrigger, () =>
                {
                    if (shadow != null && shadow.enabled)
                    {
                        shadow.enabled = false;
                    }
                }, (() =>
                {
                    isDeathAnim = false;
                    AnimationEventManager.DeathAnimComplete(this.gameObject);
                    DeathAnimComplete();
                }));
            }
        }
    }
Beispiel #13
0
    private void OnFallMovement(Transform transform, AnimationEventManager animationEventManager, Animator animator, Rigidbody rigidbody, Entity entity, Actor actor, ref ActorInput actorInput, ActorCharacter actorCharacter)
    {
        //set Animators in air previoius
        animator.SetBool("inAirPrevious", animator.GetBool("inAir"));

        if (!isGrounded)
        {
            var newMovement = rigidbody.velocity;
            newMovement.y     -= actorCharacter.fallForce * dt;
            rigidbody.velocity = newMovement;

            if (actorInput.crouch == 1)
            {
                ActorUtilities.UpdateCollider(actor, transform, "Standing");
                actorInput.crouch = 0;
            }

            animator.SetBool("inAir", true);
        }
        else
        {
            animator.SetBool("inAir", false);
        }
    }
Beispiel #14
0
    public override void SetAnimationEvents(AnimationClip dstClip)
    {
        AnimationEventManager animationEventManager = new AnimationEventManager(dstClip);

        dstClip.frameRate = 30.0f;
        switch (dstClip.name)
        {
        case "ProvocationR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "WinR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "ShakeR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "DieR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "IdleR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "BlockR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "SquatBlockR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitBackR":
        {
            animationEventManager.AddAnimationEvent(20 / dstClip.frameRate, "AnimationEventBoxIn3");        // 落地烟尘激活 //
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HoverR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(30 / dstClip.frameRate, "AnimationEventBoxIn");
            animationEventManager.AddAnimationEvent(21 / dstClip.frameRate, "AnimationEventBoxIn3");        // 落地烟尘激活 //
            animationEventManager.AddAnimationEvent(45 / dstClip.frameRate, "AnimationEventBoxIn4");        //死亡使用//
        }
        break;

        case "LieDownR":
        {
            animationEventManager.AddAnimationEvent(26 / dstClip.frameRate, "AnimationEventBoxIn");         // 启动无敌 //
            animationEventManager.AddAnimationEvent(37 / dstClip.frameRate, "AnimationEventBoxIn3");        // 落地烟尘激活 //
            animationEventManager.AddAnimationEvent(51 / dstClip.frameRate, "AnimationEventBoxIn4");        //死亡使用//
            animationEventManager.AddAnimationEvent(40 / dstClip.frameRate, "AnimationEventLieDownBegin");  //躺地开始//
            animationEventManager.AddAnimationEvent(60 / dstClip.frameRate, "AnimationEventLieDownEnd");    //躺地结束//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "AirHitIdleR":
        {
            animationEventManager.AddAnimationEvent(0 / dstClip.frameRate, "AnimationEventBoxIn3");        // 落地烟尘激活 //
            animationEventManager.AddAnimationEvent(19 / dstClip.frameRate, "AnimationEventBoxIn4");       //死亡使用//
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventLieDownBegin");  //躺地开始//
            animationEventManager.AddAnimationEvent(25 / dstClip.frameRate, "AnimationEventLieDownEnd");   //躺地结束//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "AirRollR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "AirRollLoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "ChargeStartR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "ChargeLoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "ChargeAttackR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(8 / dstClip.frameRate, "AnimationEventBoxIn");              // 激活碰撞体 //
            animationEventManager.AddAnimationEvent(16 / dstClip.frameRate, "AnimationEventBoxIn1");            // 关闭碰撞体//
            animationEventManager.AddAnimationEvent(3 / dstClip.frameRate, "AnimationEventMovePlay");           //人物位移
            animationEventManager.AddAnimationEvent(8 / dstClip.frameRate, "AnimationEventMoveStop");           //人物位移停止
            animationEventManager.AddAnimationEvent(20 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
        }
        break;

        case "JumpBackR":
        case "JumpR":
        {
            animationEventManager.AddAnimationEvent(3 / dstClip.frameRate, "AnimationEventBoxIn");        //触发跳跃//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Attack1R":
        {
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventBoxIn");         //激活碰撞体//
            animationEventManager.AddAnimationEvent(9 / dstClip.frameRate, "AnimationEventBoxIn1");        //关闭碰撞体//
            //animationEventManager.AddAnimationEvent(2 / dstClip.frameRate, "AnimationEventMovePlay");//人物位移
            //animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventMoveStop");//人物位移停止
            animationEventManager.AddAnimationEvent(9 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown");        //cooldown帧限制//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Attack2R":
        {
            animationEventManager.AddAnimationEvent(7 / dstClip.frameRate, "AnimationEventBoxIn");              //激活碰撞体//
            animationEventManager.AddAnimationEvent(13 / dstClip.frameRate, "AnimationEventBoxIn1");            //关闭碰撞体//
            animationEventManager.AddAnimationEvent(4 / dstClip.frameRate, "AnimationEventMovePlay");           //人物位移
            animationEventManager.AddAnimationEvent(12 / dstClip.frameRate, "AnimationEventMoveStop");          //人物位移停止
            animationEventManager.AddAnimationEvent(13 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Attack3R":
        {
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventBoxIn");              //激活碰撞体//
            animationEventManager.AddAnimationEvent(7 / dstClip.frameRate, "AnimationEventBoxIn1");             //关闭碰撞体//
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventMovePlay");           //人物位移
            animationEventManager.AddAnimationEvent(7 / dstClip.frameRate, "AnimationEventMoveStop");           //人物位移停止
            animationEventManager.AddAnimationEvent(20 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

//             case "Attack4R":
//                 {
//                     animationEventManager.AddAnimationEvent(7 / dstClip.frameRate, "AnimationEventBoxIn");//激活碰撞体//
//                     animationEventManager.AddAnimationEvent(12 / dstClip.frameRate, "AnimationEventBoxIn1");//激活碰撞体//
//                     animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationEventMovePlay");//人物位移
//                     animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventMoveStop");//人物位移停止
//                     animationEventManager.AddAnimationEvent(14 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown");//cooldown帧限制//
//                     dstClip.wrapMode = WrapMode.ClampForever;
//                 }
//                 break;
        case "Hit1R":
        case "Hit2R":
        case "Hit3R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "PassiveAttack3R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "PassiveAttack2R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "PassiveAttack1R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "ChantR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "WalkR":
        {
            dstClip.wrapMode = WrapMode.Loop;
            animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationMoveWardEventL");
            animationEventManager.AddAnimationEvent(9 / dstClip.frameRate, "AnimationMoveWardEventR");
            animationEventManager.AddAnimationEvent(13 / dstClip.frameRate, "AnimationMoveWardEventL");
        }
        break;

        case "WalkBackR":
        {
            dstClip.wrapMode = WrapMode.Loop;
            animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationMoveBackWardEventL");
            animationEventManager.AddAnimationEvent(9 / dstClip.frameRate, "AnimationMoveBackWardEventR");
            animationEventManager.AddAnimationEvent(15 / dstClip.frameRate, "AnimationMoveBackWardEventL");
        }
        break;

        case "JumpLoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "ZhuanShenL":
        case "ZhuanShenR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Skill1R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventBoxIn");              //开始攻击判定//
            animationEventManager.AddAnimationEvent(13 / dstClip.frameRate, "AnimationEventBoxIn1");            //播放技能特效, 攻击判定结束//
            animationEventManager.AddAnimationEvent(4 / dstClip.frameRate, "AnimationEventMovePlay");           //人物位移
            animationEventManager.AddAnimationEvent(12 / dstClip.frameRate, "AnimationEventMoveStop");          //人物位移停止
            animationEventManager.AddAnimationEvent(15 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
        }
        break;

        case "Skill2R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(11 / dstClip.frameRate, "AnimationEventBoxIn");             //第一脚//
            //animationEventManager.AddAnimationEvent(16 / dstClip.frameRate, "AnimationEventBoxIn1"); //第一脚结束//
            animationEventManager.AddAnimationEvent(19 / dstClip.frameRate, "AnimationEventBoxIn2");            //第二脚//
            animationEventManager.AddAnimationEvent(27 / dstClip.frameRate, "AnimationEventBoxIn3");            //第三脚//
            animationEventManager.AddAnimationEvent(30 / dstClip.frameRate, "AnimationEventBoxIn4");            //攻击结束//
            animationEventManager.AddAnimationEvent(3 / dstClip.frameRate, "AnimationEventMovePlay");           //人物位移
            animationEventManager.AddAnimationEvent(11 / dstClip.frameRate, "AnimationEventMoveStop");          //人物位移停止
            animationEventManager.AddAnimationEvent(45 / dstClip.frameRate, "AnimationEventBoxIn5");            //攻击结束完位移结束//
            animationEventManager.AddAnimationEvent(50 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
        }
        break;

        case "Skill3R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(4 / dstClip.frameRate, "AnimationEventBoxIn");              //开始攻击判定//
            animationEventManager.AddAnimationEvent(10 / dstClip.frameRate, "AnimationEventBoxIn1");            //播放技能特效, 攻击判定结束//
            animationEventManager.AddAnimationEvent(3 / dstClip.frameRate, "AnimationEventMovePlay");           //人物位移
            animationEventManager.AddAnimationEvent(11 / dstClip.frameRate, "AnimationEventMoveStop");          //人物位移停止
            animationEventManager.AddAnimationEvent(17 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
        }
        break;

//             case "Skill4R":
//                 {
//                     dstClip.wrapMode = WrapMode.ClampForever;
//                     animationEventManager.AddAnimationEvent(6 / dstClip.frameRate, "AnimationEventBoxIn"); //开始攻击判定//
//                     animationEventManager.AddAnimationEvent(22 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
//                 }
//                 break;
        case "Attack99R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationEventBoxIn");         //触发碰撞体碰撞//
        }
        break;

        case "Attack99LoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "AttackSquat1R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(2 / dstClip.frameRate, "AnimationEventBoxIn");         //触发碰撞体碰撞//
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventBoxIn1");        //换下一个动作//
//                     animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationEventMovePlay");//人物位移
//                     animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventMoveStop");//人物位移停止
            animationEventManager.AddAnimationEvent(7f / dstClip.frameRate, "AnimationEventCanRemoveCoolDown");         //cooldown帧限制//
        }
        break;

        case "AttackSquat2R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(4f / dstClip.frameRate, "AnimationEventBoxIn");             //触发碰撞体碰撞//
            animationEventManager.AddAnimationEvent(8f / dstClip.frameRate, "AnimationEventBoxIn1");            //触发碰撞体碰撞//
            animationEventManager.AddAnimationEvent(2 / dstClip.frameRate, "AnimationEventMovePlay");           //人物位移
            animationEventManager.AddAnimationEvent(8 / dstClip.frameRate, "AnimationEventMoveStop");           //人物位移停止
            animationEventManager.AddAnimationEvent(13 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
        }
        break;

        case "SquatR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "SquatHitR":
        {
            animationEventManager.AddAnimationEvent(6 / dstClip.frameRate, "AnimationEventBoxIn3");        // 落地烟尘激活 //
            animationEventManager.AddAnimationEvent(22 / dstClip.frameRate, "AnimationEventBoxIn4");       //死亡使用//
            animationEventManager.AddAnimationEvent(10 / dstClip.frameRate, "AnimationEventLieDownBegin"); //躺地开始//
            animationEventManager.AddAnimationEvent(30 / dstClip.frameRate, "AnimationEventLieDownEnd");   //躺地结束//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "SquatLoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "AirAttackR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(4 / dstClip.frameRate, "AnimationEventBoxIn");              //触发碰撞体碰撞//
            animationEventManager.AddAnimationEvent(9 / dstClip.frameRate, "AnimationEventBoxIn1");             //触发碰撞体碰撞//
            animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationEventMovePlay");           //人物位移
            animationEventManager.AddAnimationEvent(8 / dstClip.frameRate, "AnimationEventMoveStop");           //人物位移停止
            animationEventManager.AddAnimationEvent(15 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
        }
        break;

        case "QuickRunningR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            //                     animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationMoveWardEventL");
            //                     animationEventManager.AddAnimationEvent(9 / dstClip.frameRate, "AnimationMoveWardEventR");
            //                     animationEventManager.AddAnimationEvent(23 / dstClip.frameRate, "AnimationMoveWardEventL");
        }
        break;

        case "QuickRunningBackR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            //                     animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationMoveBackWardEventL");
            //                     animationEventManager.AddAnimationEvent(18 / dstClip.frameRate, "AnimationMoveBackWardEventR");
            //                     animationEventManager.AddAnimationEvent(28 / dstClip.frameRate, "AnimationMoveBackWardEventL");
        }
        break;

        case "Hit3LoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "BounceR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitSpinStartR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitSpinLoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "HitSpinEndR":
        {
            animationEventManager.AddAnimationEvent(20 / dstClip.frameRate, "AnimationEventBoxIn");        // 死亡停止 //
            animationEventManager.AddAnimationEvent(15 / dstClip.frameRate, "AnimationEventLieDownBegin"); //躺地开始//
            animationEventManager.AddAnimationEvent(30 / dstClip.frameRate, "AnimationEventLieDownEnd");   //躺地结束//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitbackStartR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitbackLoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "HitbackEndR":
        {
            animationEventManager.AddAnimationEvent(15 / dstClip.frameRate, "AnimationEventBoxIn");        // 死亡停止 //
            animationEventManager.AddAnimationEvent(10 / dstClip.frameRate, "AnimationEventLieDownBegin"); //躺地开始//
            animationEventManager.AddAnimationEvent(25 / dstClip.frameRate, "AnimationEventLieDownEnd");   //躺地结束//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitHardR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitBellyR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;
        }

        animationEventManager.AddAnimationEvent(dstClip.length, "AnimationEventEnd");
        animationEventManager.SaveAnimationEvent();
    }
Beispiel #15
0
    private void OnGroundMovement(Transform transform, AnimationEventManager animationEventManager, Animator animator, Rigidbody rigidbody, Entity entity, Actor actor, ref ActorInput actorInput, ActorCharacter actorCharacter)
    {
        //Return if doing diffrent action | Not Grounded
        if (actorInput.action != 0 || !isGrounded || actorInput.isJumping == 1)
        {
            return;
        }



        //Get movement type
        {
            if (!isHeadFree && actorInput.crouchPreviousFrame == 1)
            {
                actorInput.crouch = 1;
            }

            if (actorInput.movement.magnitude == 0 || actorInput.crouch == 1 && !isHeadFree)
            {
                actorInput.sprint = 0;
            }

            if (actorInput.sprint == 1)
            {
                actorInput.crouch = 0;
            }

            if (actorInput.walk == 1 && actorInput.sprint == 0 && actorInput.crouch == 0)
            {
                actorInput.movement *= deadPoint;
            }
        }

        //Move
        {
            //Set Velocity
            var velocity = actorInput.movement;
            velocity          *= actorInput.sprint == 1 ? actorCharacter.sprintSpeed : actorInput.crouch == 1 ? actorCharacter.crouchSpeed : actorCharacter.runSpeed;
            velocity.y         = -1;
            rigidbody.velocity = velocity;
        }

        //Collider
        {
            //Set Collider
            if (actorInput.crouch == 1 && actorInput.crouchPreviousFrame == 0)
            {
                ActorUtilities.UpdateCollider(actor, transform, "Crouching");
            }
            else if (actorInput.crouch == 0 && actorInput.crouchPreviousFrame == 1)
            {
                ActorUtilities.UpdateCollider(actor, transform, "Standing");
            }
        }

        //Rotate
        {
            if (actorInput.movement.magnitude != 0 && actorInput.strafe == 0 || actorInput.movement.magnitude != 0 && actorInput.sprint == 1)
            {
                var lookRotation = Quaternion.LookRotation(actorInput.movement);
                transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, dt * actorCharacter.rotationSpeed);
            }
        }

        //Animate
        {
            //Is Sprinting
            if (actorInput.sprint == 1)
            {
                actorInput.movement = new float3(0, 0, 2f);
            }

            //Strafing
            else if (actorInput.strafe == 1)
            {
                actorInput.movement = transform.InverseTransformDirection(actorInput.movement);
            }

            //Not Strafing
            else
            {
                actorInput.movement = new float3(0, 0, Mathf.Abs(actorInput.movement.magnitude));
            }

            //Set Animator Properties
            animator.SetBool("crouch", actorInput.crouch == 1 && actorInput.sprint == 0);
            animator.SetFloat("movementX", actorInput.movement.x, animationTransitionRate, dt);
            animator.SetFloat("movementY", actorInput.movement.z, animationTransitionRate, dt);
            animator.SetFloat("movementAmount", actorInput.movement.magnitude, animationTransitionRate, dt);
        }

        //Sound
        if (animationEventManager.RequestEvent("footStep") && actorCharacter.footStepAudioEvent != null && actorInput.movement.magnitude != 0)
        {
            actorCharacter.footStepAudioEvent.Play(transform.position);
        }
    }
    private void OnWallHugMovement(Transform transform, AnimationEventManager animationEventManager, Animator animator, Rigidbody rigidbody, Entity entity, Actor actor, ref ActorInput actorInput, ActorCharacterWallHug actorCharacterWallHug)
    {
        // start wall hugging
        if (actorInput.actionToDo == 1 && actorInput.crouch == 0 && actorInput.action == 0)
        {
            // get all surrounding walls  | Get first hit as our main hit
            var hits = Physics.SphereCastAll(transform.position, 0.5f, Vector3.one * 0.5f, 0.5f, actorCharacterWallHug.wallHugMask);

            if (hits.Length >= 1)
            {
                var        hit             = hits[0];
                var        directionToWall = (hit.transform.position - transform.position).normalized;
                var        distanceToWall  = Vector3.Distance(hit.transform.position, transform.position);
                RaycastHit wallHit;

                if (Physics.Raycast(transform.position + new Vector3(0, 0.5f, 0), directionToWall, out wallHit, distanceToWall, actorCharacterWallHug.wallHugMask))
                {
                    wallHuggingDirections[entity.Index] = Quaternion.LookRotation(GetMeshColliderNormal(wallHit)).eulerAngles;

                    Debug.DrawLine(transform.position + new Vector3(0, 0.5f, 0), wallHit.point, Color.red, 1);
                    Debug.DrawRay(wallHit.point, GetMeshColliderNormal(wallHit) * 5, Color.red, 1);

                    actorInput.actionToDo = 0;
                    actorInput.action     = 99;
                }
            }
        }

        //Stop wall hugging
        if (actorInput.actionToDo == 1 && actorInput.action == 99)
        {
            actorInput.actionToDo = 0;
            actorInput.action     = 0;
        }

        //Update Wall hugging
        if (actorInput.action == 99)
        {
            bool forceStop = false;

            //Move
            if (actorInput.movement.magnitude >= deadPoint)
            {
                //Movement
                var movement = actorInput.movement;
                var movementToRightDotProduct = Vector3.Dot(movement, transform.right);
                rigidbody.velocity = transform.right * movementToRightDotProduct * actorCharacterWallHug.speed;

                //Check if there is wall ahead of where we are going if not than force a stop
                {
                    //Do it
                    var raycastPoint = transform.position;
                    raycastPoint += Vector3.up * 0.1f;
                    raycastPoint += (transform.right * movementToRightDotProduct).normalized * 0.5f;
                    forceStop     = !Physics.Raycast(raycastPoint, -transform.forward, 0.5f, actorCharacterWallHug.wallHugMask);

                    //Debug
                    Debug.DrawRay(raycastPoint, -transform.forward * 0.5f, forceStop ? Color.red : Color.green, 0);
                }

                //Animation
                if (!forceStop)
                {
                    animator.SetFloat("movementX", movementToRightDotProduct * deadPoint, animationTransitionRate, dt);
                    animator.SetFloat("movementY", 0, animationTransitionRate, dt);
                }
            }

            //Stop Move
            if (actorInput.movement.magnitude <= deadPoint || forceStop)
            {
                //Movement
                rigidbody.velocity = Vector3.zero;

                //Animation
                animator.SetFloat("movementX", 0, animationTransitionRate, dt);
                animator.SetFloat("movementY", 0, animationTransitionRate, dt);
            }

            //Rotate to face wall normal
            transform.eulerAngles = Vector3.Slerp(transform.eulerAngles, wallHuggingDirections[entity.Index], Time.deltaTime * 6);

            //Sound
            if (animationEventManager.RequestEvent("footStep") && actorCharacterWallHug.footStepAudioEvent != null && actorInput.movement.magnitude != 0)
            {
                actorCharacterWallHug.footStepAudioEvent.Play(transform.position);
            }
        }
    }
    public override void SetAnimationEvents(AnimationClip dstClip)
    {
        AnimationEventManager animationEventManager = new AnimationEventManager(dstClip);

        dstClip.frameRate = 30.0f;
        switch (dstClip.name)
        {
        case "ProvocationR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "ShakeR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "WinR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "IdleR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "BlockR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitBackR":
        {
            animationEventManager.AddAnimationEvent(31 / dstClip.frameRate, "AnimationEventBoxIn");
            animationEventManager.AddAnimationEvent(10 / dstClip.frameRate, "AnimationEventBoxIn1");
            animationEventManager.AddAnimationEvent(20 / dstClip.frameRate, "AnimationEventBoxIn3");         // 落地烟尘激活 //
            animationEventManager.AddAnimationEvent(45 / dstClip.frameRate, "AnimationEventBoxIn4");         //死亡使用//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "SquatR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "SquatLoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "SquatHitR":
        {
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventBoxIn3");         // 落地烟尘激活 //
            animationEventManager.AddAnimationEvent(22 / dstClip.frameRate, "AnimationEventBoxIn4");        //死亡使用//
            animationEventManager.AddAnimationEvent(10 / dstClip.frameRate, "AnimationEventLieDownBegin");  //躺地开始//
            animationEventManager.AddAnimationEvent(30 / dstClip.frameRate, "AnimationEventLieDownEnd");    //躺地结束//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HoverR":
        {
            animationEventManager.AddAnimationEvent(30 / dstClip.frameRate, "AnimationEventBoxIn");
            animationEventManager.AddAnimationEvent(21 / dstClip.frameRate, "AnimationEventBoxIn3");        // 落地烟尘激活 //
            animationEventManager.AddAnimationEvent(45 / dstClip.frameRate, "AnimationEventBoxIn4");        //死亡使用//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "LieDownR":
        {
            animationEventManager.AddAnimationEvent(35 / dstClip.frameRate, "AnimationEventBoxIn");
            animationEventManager.AddAnimationEvent(21 / dstClip.frameRate, "AnimationEventBoxIn3");        // 落地烟尘激活 //
            animationEventManager.AddAnimationEvent(45 / dstClip.frameRate, "AnimationEventBoxIn4");        //死亡使用//
            animationEventManager.AddAnimationEvent(40 / dstClip.frameRate, "AnimationEventLieDownBegin");  //躺地开始//
            animationEventManager.AddAnimationEvent(55 / dstClip.frameRate, "AnimationEventLieDownEnd");    //躺地结束//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "JumpBackR":
        case "JumpR":
        {
            animationEventManager.AddAnimationEvent(3 / dstClip.frameRate, "AnimationEventBoxIn");        //触发跳跃//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Attack1R":
        {
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventBoxIn");
            animationEventManager.AddAnimationEvent(13 / dstClip.frameRate, "AnimationEventBoxIn1");
            animationEventManager.AddAnimationEvent(14 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown");        //cooldown帧限制//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Attack2R":
        {
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventBoxIn");
            animationEventManager.AddAnimationEvent(7 / dstClip.frameRate, "AnimationEventBoxIn1");
            animationEventManager.AddAnimationEvent(2 / dstClip.frameRate, "AnimationEventMovePlay");          //人物位移
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventMoveStop");          //人物位移停止
            animationEventManager.AddAnimationEvent(8 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Attack3R":
        {
            animationEventManager.AddAnimationEvent(7 / dstClip.frameRate, "AnimationEventBoxIn");
            animationEventManager.AddAnimationEvent(12 / dstClip.frameRate, "AnimationEventBoxIn1");
            animationEventManager.AddAnimationEvent(9 / dstClip.frameRate, "AnimationEventBoxIn2");
            animationEventManager.AddAnimationEvent(14 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
            animationEventManager.AddAnimationEvent(3 / dstClip.frameRate, "AnimationEventMovePlay");           //人物位移
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventMoveStop");           //人物位移停止
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Attack4R":
        {
            animationEventManager.AddAnimationEvent(2 / dstClip.frameRate, "AnimationEventBoxIn");              //激活碰撞体//

            animationEventManager.AddAnimationEvent(6 / dstClip.frameRate, "AnimationEventBoxIn1");             //激活碰撞体//

            animationEventManager.AddAnimationEvent(7 / dstClip.frameRate, "AnimationEventBoxIn2");             //关闭碰撞体//
            animationEventManager.AddAnimationEvent(12 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
            animationEventManager.AddAnimationEvent(2 / dstClip.frameRate, "AnimationEventMovePlay");           //人物位移
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventMoveStop");           //人物位移停止
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "AttackSquat1R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventBoxIn");             //触发碰撞体碰撞//
            animationEventManager.AddAnimationEvent(8 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
            animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationEventMovePlay");          //人物位移
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventMoveStop");          //人物位移停止
            animationEventManager.AddAnimationEvent(9 / dstClip.frameRate, "AnimationEventBoxIn1");            //换下一个动作//
        }
        break;

        case "AttackSquat2R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(2f / dstClip.frameRate, "AnimationEventBoxIn");         //触发碰撞体碰撞//
            animationEventManager.AddAnimationEvent(4f / dstClip.frameRate, "AnimationEventBoxIn1");        //触发碰撞体碰撞//
            animationEventManager.AddAnimationEvent(0 / dstClip.frameRate, "AnimationEventMovePlay");       //人物位移
            animationEventManager.AddAnimationEvent(3 / dstClip.frameRate, "AnimationEventMoveStop");       //人物位移停止
            //animationEventManager.AddAnimationEvent(14 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown");//cooldown帧限制//
        }
        break;

        case "Skill1R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(12 / dstClip.frameRate, "AnimationEventBoxIn");             //开启特效//
            animationEventManager.AddAnimationEvent(24 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
        }
        break;

        case "Skill2R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventBoxIn");              //打开碰撞//
            animationEventManager.AddAnimationEvent(14 / dstClip.frameRate, "AnimationEventBoxIn1");            //开始攻击判定//
            animationEventManager.AddAnimationEvent(16 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
        }
        break;

        case "Skill3R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;

            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventBoxIn");              //开始攻击判定//
            animationEventManager.AddAnimationEvent(8 / dstClip.frameRate, "AnimationEventBoxIn1");             //不能攻击//
            animationEventManager.AddAnimationEvent(4 / dstClip.frameRate, "AnimationEventMovePlay");           //人物位移
            animationEventManager.AddAnimationEvent(7 / dstClip.frameRate, "AnimationEventMoveStop");           //人物位移停止
            animationEventManager.AddAnimationEvent(20 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
            /*animationEventManager.AddAnimationEvent(20 / dstClip.frameRate, "AnimationEventBoxIn1"); //倒地标示//*/
            /*animationEventManager.AddAnimationEvent(21 / dstClip.frameRate, "AnimationEventBoxIn1"); //播放技能特效, 攻击判定结束//*/
        }
        break;

        case "Attack99R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(0 / dstClip.frameRate, "AnimationEventBoxIn");         //触发碰撞体碰撞//
        }
        break;

        case "Attack99LoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "AirAttackR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(4 / dstClip.frameRate, "AnimationEventBoxIn");              //触发碰撞体碰撞//
            animationEventManager.AddAnimationEvent(8 / dstClip.frameRate, "AnimationEventBoxIn1");             //触发碰撞体碰撞//
            animationEventManager.AddAnimationEvent(10 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
            animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationEventMovePlay");           //人物位移
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventMoveStop");           //人物位移停止
        }
        break;

        case "AirHitIdleR":
        {
            animationEventManager.AddAnimationEvent(0 / dstClip.frameRate, "AnimationEventBoxIn3");        // 落地烟尘激活 //
            animationEventManager.AddAnimationEvent(19 / dstClip.frameRate, "AnimationEventBoxIn4");       //死亡使用//
            animationEventManager.AddAnimationEvent(10 / dstClip.frameRate, "AnimationEventLieDownBegin"); //躺地开始//
            animationEventManager.AddAnimationEvent(25 / dstClip.frameRate, "AnimationEventLieDownEnd");   //躺地结束//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "AirRollR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "AirRollLoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "ChargeStartR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "ChargeLoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "ChargeAttackR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            animationEventManager.AddAnimationEvent(4 / dstClip.frameRate, "AnimationEventBoxIn");              // 激活碰撞体 //
            animationEventManager.AddAnimationEvent(6 / dstClip.frameRate, "AnimationEventBoxIn1");             //触发碰撞关闭//
            animationEventManager.AddAnimationEvent(0 / dstClip.frameRate, "AnimationEventMovePlay");           //人物位移
            animationEventManager.AddAnimationEvent(3 / dstClip.frameRate, "AnimationEventMoveStop");           //人物位移停止
            animationEventManager.AddAnimationEvent(15 / dstClip.frameRate, "AnimationEventCanRemoveCoolDown"); //cooldown帧限制//
        }
        break;

        case "Hit1R":
        case "Hit2R":
        case "Hit3R":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Jneng3HeJiuR":
        case "Jneng3QingXingR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Jneng1HeJiuR":
        {
            animationEventManager.AddAnimationEvent(7 / dstClip.frameRate, "AnimationEventBoxIn");
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Jneng1QingXingR":
        {
            animationEventManager.AddAnimationEvent(10 / dstClip.frameRate, "AnimationEventBoxIn");
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Jneng2HeJiuR":
        {
            animationEventManager.AddAnimationEvent(7 / dstClip.frameRate, "AnimationEventBoxIn");
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Jneng2QingxingR":
        {
            animationEventManager.AddAnimationEvent(11 / dstClip.frameRate, "AnimationEventBoxIn");
            animationEventManager.AddAnimationEvent(15 / dstClip.frameRate, "AnimationEventBoxIn1");
            animationEventManager.AddAnimationEvent(19 / dstClip.frameRate, "AnimationEventBoxIn2");
            animationEventManager.AddAnimationEvent(22 / dstClip.frameRate, "AnimationEventBoxIn3");
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "PassiveAttack3R":
        {
            animationEventManager.AddAnimationEvent(6 / dstClip.frameRate, "AnimationEventBoxIn");
            animationEventManager.AddAnimationEvent(22 / dstClip.frameRate, "AnimationEventBoxIn1");
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "PassiveAttack2R":
        {
            animationEventManager.AddAnimationEvent(6 / dstClip.frameRate, "AnimationEventBoxIn");
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "PassiveAttack1R":
        {
            animationEventManager.AddAnimationEvent(6 / dstClip.frameRate, "AnimationEventBoxIn");
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "ChantR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "WalkR":
        {
            dstClip.wrapMode = WrapMode.Loop;
            animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationMoveWardEventL");
            animationEventManager.AddAnimationEvent(9 / dstClip.frameRate, "AnimationMoveWardEventR");
            animationEventManager.AddAnimationEvent(23 / dstClip.frameRate, "AnimationMoveWardEventL");
        }
        break;

        case "WalkBackR":
        {
            dstClip.wrapMode = WrapMode.Loop;
            animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationMoveBackWardEventL");
            animationEventManager.AddAnimationEvent(18 / dstClip.frameRate, "AnimationMoveBackWardEventR");
            animationEventManager.AddAnimationEvent(20 / dstClip.frameRate, "AnimationMoveBackWardEventL");
        }
        break;

        case "QuickRunningR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            //                     animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationMoveWardEventL");
            //                     animationEventManager.AddAnimationEvent(9 / dstClip.frameRate, "AnimationMoveWardEventR");
            //                     animationEventManager.AddAnimationEvent(23 / dstClip.frameRate, "AnimationMoveWardEventL");
        }
        break;

        case "QuickRunningBackR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
            //                     animationEventManager.AddAnimationEvent(1 / dstClip.frameRate, "AnimationMoveBackWardEventL");
            //                     animationEventManager.AddAnimationEvent(18 / dstClip.frameRate, "AnimationMoveBackWardEventR");
            //                     animationEventManager.AddAnimationEvent(28 / dstClip.frameRate, "AnimationMoveBackWardEventL");
        }
        break;

        case "ZhuanShenL":
        case "ZhuanShenR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "Hit3LoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "BounceR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitSpinStartR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitSpinLoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "HitSpinEndR":
        {
            animationEventManager.AddAnimationEvent(24 / dstClip.frameRate, "AnimationEventBoxIn");        // 死亡停止 //
            animationEventManager.AddAnimationEvent(16 / dstClip.frameRate, "AnimationEventLieDownBegin"); //躺地开始//
            animationEventManager.AddAnimationEvent(25 / dstClip.frameRate, "AnimationEventLieDownEnd");   //躺地结束//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitbackStartR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitbackLoopR":
        {
            dstClip.wrapMode = WrapMode.Loop;
        }
        break;

        case "HitbackEndR":
        {
            animationEventManager.AddAnimationEvent(16 / dstClip.frameRate, "AnimationEventBoxIn");        // 死亡停止 //
            animationEventManager.AddAnimationEvent(5 / dstClip.frameRate, "AnimationEventLieDownBegin");  //躺地开始//
            animationEventManager.AddAnimationEvent(20 / dstClip.frameRate, "AnimationEventLieDownEnd");   //躺地结束//
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitHardR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;

        case "HitBellyR":
        {
            dstClip.wrapMode = WrapMode.ClampForever;
        }
        break;
        }
        //             AnimationEvent endEvent = new AnimationEvent();
        //             endEvent.time = dstClip.length; // -0.0016f;
        //             endEvent.stringParameter = dstClip.name;
        //             endEvent.functionName = "AnimationEventEnd";

        animationEventManager.AddAnimationEvent(dstClip.length, "AnimationEventEnd");
        animationEventManager.SaveAnimationEvent();
    }
Beispiel #18
0
 void ItemAnimStop(Object sender, ItemSprites spriteInfo)
 {
     leftHandAnim.SetSprite(transform, spriteInfo.leftHandSprite);
     rightHandAnim.SetSprite(transform, spriteInfo.rightHandSprite);
     AnimationEventManager.ItemUseCompletion(transform);
 }