protected void SetClipBasedOnWeapon(EquipWeapons equipWeapons)
        {
            Item weaponItem = GameInstance.Singleton.DefaultWeaponItem;

            if (equipWeapons.rightHand.NotEmptySlot() && equipWeapons.rightHand.GetWeaponItem() != null)
            {
                weaponItem = equipWeapons.rightHand.GetWeaponItem();
            }
            WeaponAnimations weaponAnimations = default(WeaponAnimations);

            CacheWeaponAnimations.TryGetValue(weaponItem.WeaponType.DataId, out weaponAnimations);
            // Set override animator clips
            CacheAnimatorController[CLIP_IDLE]                = weaponAnimations.idleClip != null ? weaponAnimations.idleClip : defaultAnimations.idleClip;
            CacheAnimatorController[CLIP_MOVE]                = weaponAnimations.moveClip != null ? weaponAnimations.moveClip : defaultAnimations.moveClip;
            CacheAnimatorController[CLIP_MOVE_BACKWARD]       = weaponAnimations.moveBackwardClip != null ? weaponAnimations.moveBackwardClip : defaultAnimations.moveBackwardClip;
            CacheAnimatorController[CLIP_MOVE_LEFT]           = weaponAnimations.moveLeftClip != null ? weaponAnimations.moveLeftClip : defaultAnimations.moveLeftClip;
            CacheAnimatorController[CLIP_MOVE_RIGHT]          = weaponAnimations.moveRightClip != null ? weaponAnimations.moveRightClip : defaultAnimations.moveRightClip;
            CacheAnimatorController[CLIP_MOVE_FORWARD_LEFT]   = weaponAnimations.moveForwardLeftClip != null ? weaponAnimations.moveForwardLeftClip : defaultAnimations.moveForwardLeftClip;
            CacheAnimatorController[CLIP_MOVE_FORWARD_RIGHT]  = weaponAnimations.moveForwardRightClip != null ? weaponAnimations.moveForwardRightClip : defaultAnimations.moveForwardRightClip;
            CacheAnimatorController[CLIP_MOVE_BACKWARD_LEFT]  = weaponAnimations.moveBackwardLeftClip != null ? weaponAnimations.moveBackwardLeftClip : defaultAnimations.moveBackwardLeftClip;
            CacheAnimatorController[CLIP_MOVE_BACKWARD_RIGHT] = weaponAnimations.moveBackwardRightClip != null ? weaponAnimations.moveBackwardRightClip : defaultAnimations.moveBackwardRightClip;
            CacheAnimatorController[CLIP_JUMP]                = weaponAnimations.jumpClip != null ? weaponAnimations.jumpClip : defaultAnimations.jumpClip;
            CacheAnimatorController[CLIP_FALL]                = weaponAnimations.fallClip != null ? weaponAnimations.fallClip : defaultAnimations.fallClip;
            CacheAnimatorController[CLIP_HURT]                = weaponAnimations.hurtClip != null ? weaponAnimations.hurtClip : defaultAnimations.hurtClip;
            CacheAnimatorController[CLIP_DEAD]                = weaponAnimations.deadClip != null ? weaponAnimations.deadClip : defaultAnimations.deadClip;
        }
Exemplo n.º 2
0
 public ActionAnimation GetLeftHandReloadAnimation(int dataId)
 {
     if (CacheWeaponAnimations.ContainsKey(dataId))
     {
         return(CacheWeaponAnimations[dataId].leftHandReloadAnimation);
     }
     return(defaultAnimations.leftHandReloadAnimation);
 }
Exemplo n.º 3
0
 public ActionAnimation[] GetLeftHandAttackAnimations(int dataId)
 {
     if (CacheWeaponAnimations.ContainsKey(dataId) &&
         CacheWeaponAnimations[dataId].leftHandAttackAnimations != null)
     {
         return(CacheWeaponAnimations[dataId].leftHandAttackAnimations);
     }
     return(defaultAnimations.leftHandAttackAnimations);
 }
        protected void SetClipBasedOnWeapon(EquipWeapons equipWeapons)
        {
            Item weaponItem = GameInstance.Singleton.DefaultWeaponItem;

            if (equipWeapons.rightHand.NotEmptySlot() && equipWeapons.rightHand.GetWeaponItem() != null)
            {
                weaponItem = equipWeapons.rightHand.GetWeaponItem();
            }
            WeaponAnimations weaponAnimations = default(WeaponAnimations);

            CacheWeaponAnimations.TryGetValue(weaponItem.WeaponType.DataId, out weaponAnimations);
            // Remove clips
            if (legacyAnimation.GetClip(CLIP_IDLE) != null)
            {
                legacyAnimation.RemoveClip(CLIP_IDLE);
            }
            if (legacyAnimation.GetClip(CLIP_MOVE) != null)
            {
                legacyAnimation.RemoveClip(CLIP_MOVE);
            }
            if (legacyAnimation.GetClip(CLIP_MOVE_BACKWARD) != null)
            {
                legacyAnimation.RemoveClip(CLIP_MOVE_BACKWARD);
            }
            if (legacyAnimation.GetClip(CLIP_MOVE_LEFT) != null)
            {
                legacyAnimation.RemoveClip(CLIP_MOVE_LEFT);
            }
            if (legacyAnimation.GetClip(CLIP_MOVE_RIGHT) != null)
            {
                legacyAnimation.RemoveClip(CLIP_MOVE_RIGHT);
            }
            if (legacyAnimation.GetClip(CLIP_MOVE_FORWARD_LEFT) != null)
            {
                legacyAnimation.RemoveClip(CLIP_MOVE_FORWARD_LEFT);
            }
            if (legacyAnimation.GetClip(CLIP_MOVE_FORWARD_RIGHT) != null)
            {
                legacyAnimation.RemoveClip(CLIP_MOVE_FORWARD_RIGHT);
            }
            if (legacyAnimation.GetClip(CLIP_MOVE_BACKWARD_LEFT) != null)
            {
                legacyAnimation.RemoveClip(CLIP_MOVE_BACKWARD_LEFT);
            }
            if (legacyAnimation.GetClip(CLIP_MOVE_BACKWARD_RIGHT) != null)
            {
                legacyAnimation.RemoveClip(CLIP_MOVE_BACKWARD_RIGHT);
            }
            if (legacyAnimation.GetClip(CLIP_JUMP) != null)
            {
                legacyAnimation.RemoveClip(CLIP_JUMP);
            }
            if (legacyAnimation.GetClip(CLIP_FALL) != null)
            {
                legacyAnimation.RemoveClip(CLIP_FALL);
            }
            if (legacyAnimation.GetClip(CLIP_HURT) != null)
            {
                legacyAnimation.RemoveClip(CLIP_HURT);
            }
            if (legacyAnimation.GetClip(CLIP_DEAD) != null)
            {
                legacyAnimation.RemoveClip(CLIP_DEAD);
            }
            // Setup generic clips
            legacyAnimation.AddClip(weaponAnimations.idleClip != null ? weaponAnimations.idleClip : defaultAnimations.idleClip, CLIP_IDLE);
            legacyAnimation.AddClip(weaponAnimations.moveClip != null ? weaponAnimations.moveClip : defaultAnimations.moveClip, CLIP_MOVE);
            legacyAnimation.AddClip(weaponAnimations.moveBackwardClip != null ? weaponAnimations.moveBackwardClip : defaultAnimations.moveBackwardClip, CLIP_MOVE_BACKWARD);
            legacyAnimation.AddClip(weaponAnimations.moveLeftClip != null ? weaponAnimations.moveLeftClip : defaultAnimations.moveLeftClip, CLIP_MOVE_LEFT);
            legacyAnimation.AddClip(weaponAnimations.moveRightClip != null ? weaponAnimations.moveRightClip : defaultAnimations.moveRightClip, CLIP_MOVE_RIGHT);
            legacyAnimation.AddClip(weaponAnimations.moveForwardLeftClip != null ? weaponAnimations.moveForwardLeftClip : defaultAnimations.moveForwardLeftClip, CLIP_MOVE_FORWARD_LEFT);
            legacyAnimation.AddClip(weaponAnimations.moveForwardRightClip != null ? weaponAnimations.moveForwardRightClip : defaultAnimations.moveForwardRightClip, CLIP_MOVE_FORWARD_RIGHT);
            legacyAnimation.AddClip(weaponAnimations.moveBackwardLeftClip != null ? weaponAnimations.moveBackwardLeftClip : defaultAnimations.moveBackwardLeftClip, CLIP_MOVE_BACKWARD_LEFT);
            legacyAnimation.AddClip(weaponAnimations.moveBackwardRightClip != null ? weaponAnimations.moveBackwardRightClip : defaultAnimations.moveBackwardRightClip, CLIP_MOVE_BACKWARD_RIGHT);
            legacyAnimation.AddClip(weaponAnimations.jumpClip != null ? weaponAnimations.jumpClip : defaultAnimations.jumpClip, CLIP_JUMP);
            legacyAnimation.AddClip(weaponAnimations.fallClip != null ? weaponAnimations.fallClip : defaultAnimations.fallClip, CLIP_FALL);
            legacyAnimation.AddClip(weaponAnimations.hurtClip != null ? weaponAnimations.hurtClip : defaultAnimations.hurtClip, CLIP_HURT);
            legacyAnimation.AddClip(weaponAnimations.deadClip != null ? weaponAnimations.deadClip : defaultAnimations.deadClip, CLIP_DEAD);
            CrossFadeLegacyAnimation(CLIP_IDLE, 0, WrapMode.Loop);
        }