Ejemplo n.º 1
0
        private void LoadLocomotionAnimation(
            PlayerActor player,
            out PlayState info,
            ref EquipEventItemInfo itemInfo)
        {
            Resources         instance          = Singleton <Resources> .Instance;
            LocomotionProfile locomotionProfile = instance.LocomotionProfile;
            PlayerProfile     playerProfile     = instance.PlayerProfile;
            StuffItem         equipedLampItem   = player.PlayerData.EquipedLampItem;

            CommonDefine.ItemIDDefines itemIdDefine = instance.CommonDefine.ItemIDDefine;
            if (equipedLampItem != null)
            {
                ItemIDKeyPair torchId      = itemIdDefine.TorchID;
                ItemIDKeyPair flashlightId = itemIdDefine.FlashlightID;
                ItemIDKeyPair maleLampId   = itemIdDefine.MaleLampID;
                if (equipedLampItem.CategoryID == torchId.categoryID && equipedLampItem.ID == torchId.itemID)
                {
                    info                = instance.Animation.PlayerLocomotionStateTable[(int)player.ChaControl.sex][playerProfile.PoseIDData.TorchOnbuLocoID];
                    itemInfo            = instance.GameInfo.CommonEquipEventItemTable[torchId.categoryID][torchId.itemID];
                    itemInfo.ParentName = instance.LocomotionProfile.PlayerLocoItemParentName;
                    return;
                }
                if (equipedLampItem.CategoryID == maleLampId.categoryID && equipedLampItem.ID == maleLampId.itemID)
                {
                    info                = instance.Animation.PlayerLocomotionStateTable[(int)player.ChaControl.sex][playerProfile.PoseIDData.LampOnbuLocoID];
                    itemInfo            = instance.GameInfo.CommonEquipEventItemTable[maleLampId.categoryID][maleLampId.itemID];
                    itemInfo.ParentName = instance.LocomotionProfile.PlayerLocoItemParentName;
                    return;
                }
                if (equipedLampItem.CategoryID == flashlightId.categoryID && equipedLampItem.ID == flashlightId.itemID)
                {
                    info                = instance.Animation.PlayerLocomotionStateTable[(int)player.ChaControl.sex][playerProfile.PoseIDData.TorchOnbuLocoID];
                    itemInfo            = instance.GameInfo.CommonEquipEventItemTable[flashlightId.categoryID][flashlightId.itemID];
                    itemInfo.ParentName = instance.LocomotionProfile.PlayerLocoItemParentName;
                    return;
                }
            }
            info = (PlayState)null;
        }
Ejemplo n.º 2
0
        private void ActivateTransferImmediate(PlayerActor player, Actor partner)
        {
            EquipEventItemInfo itemInfo = (EquipEventItemInfo)null;
            PlayState          info;

            this.LoadLocomotionAnimation(player, out info, ref itemInfo);
            player.ResetEquipEventItem(itemInfo);
            partner.Position = player.Position;
            partner.Rotation = player.Rotation;
            int            onbuStateId = Singleton <Resources> .Instance.DefinePack.AnimatorState.OnbuStateID;
            PlayState      playState   = Singleton <Resources> .Instance.Animation.PlayerLocomotionStateTable[(int)player.ChaControl.sex][onbuStateId];
            ActorAnimation animation1  = player.Animation;
            ActorAnimation animation2  = partner.Animation;

            animation1.InStates.Clear();
            animation1.OutStates.Clear();
            animation1.ActionStates.Clear();
            partner.Animation.InStates.Clear();
            partner.Animation.OutStates.Clear();
            partner.Animation.ActionStates.Clear();
            PlayState.Info element1 = playState.MainStateInfo.InStateInfo.StateInfos.GetElement <PlayState.Info>(playState.MainStateInfo.InStateInfo.StateInfos.Length - 1);
            if (info != null)
            {
                PlayState.Info element2 = info.MainStateInfo.InStateInfo.StateInfos.GetElement <PlayState.Info>(info.MainStateInfo.InStateInfo.StateInfos.Length - 1);
                player.Animation.InStates.Enqueue(element2);
                if (!info.MainStateInfo.OutStateInfo.StateInfos.IsNullOrEmpty <PlayState.Info>())
                {
                    foreach (PlayState.Info stateInfo in info.MainStateInfo.OutStateInfo.StateInfos)
                    {
                        player.Animation.OutStates.Enqueue(stateInfo);
                    }
                }
                partner.Animation.InStates.Enqueue(element1);
                if (!playState.MainStateInfo.OutStateInfo.StateInfos.IsNullOrEmpty <PlayState.Info>())
                {
                    foreach (PlayState.Info stateInfo in playState.MainStateInfo.OutStateInfo.StateInfos)
                    {
                        partner.Animation.OutStates.Enqueue(stateInfo);
                    }
                }
                ActorAnimInfo animInfo = player.Animation.AnimInfo;
                int           layer    = info.Layer;
                player.Animation.StopAllAnimCoroutine();
                player.Animation.PlayInLocoAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, layer);
                partner.Animation.StopAllAnimCoroutine();
                partner.Animation.PlayInLocoAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, layer);
            }
            else
            {
                for (int index = 1; index < animation1.Animator.get_layerCount(); ++index)
                {
                    animation1.Animator.SetLayerWeight(index, 0.0f);
                }
                player.Animation.InStates.Enqueue(element1);
                if (!playState.MainStateInfo.OutStateInfo.StateInfos.IsNullOrEmpty <PlayState.Info>())
                {
                    foreach (PlayState.Info stateInfo in playState.MainStateInfo.OutStateInfo.StateInfos)
                    {
                        player.Animation.OutStates.Enqueue(stateInfo);
                    }
                }
                partner.Animation.InStates.Enqueue(element1);
                if (!playState.MainStateInfo.OutStateInfo.StateInfos.IsNullOrEmpty <PlayState.Info>())
                {
                    foreach (PlayState.Info stateInfo in playState.MainStateInfo.OutStateInfo.StateInfos)
                    {
                        partner.Animation.OutStates.Enqueue(stateInfo);
                    }
                }
                ActorAnimInfo animInfo = player.Animation.AnimInfo;
                int           layer    = playState.Layer;
                player.Animation.StopAllAnimCoroutine();
                player.Animation.PlayInLocoAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, layer);
                partner.Animation.StopAllAnimCoroutine();
                partner.Animation.PlayInLocoAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, layer);
            }
            if (player.NavMeshAgent.get_isStopped())
            {
                player.NavMeshAgent.set_isStopped(false);
            }
            if (!player.IsKinematic)
            {
                return;
            }
            player.IsKinematic = false;
        }
Ejemplo n.º 3
0
        private void ActivateTransfer(PlayerActor player, Actor partner)
        {
            EquipEventItemInfo itemInfo = (EquipEventItemInfo)null;
            PlayState          info1;

            this.LoadLocomotionAnimation(player, out info1, ref itemInfo);
            player.ResetEquipEventItem(itemInfo);
            partner.Position = player.Position;
            partner.Rotation = player.Rotation;
            int               onbuStateId       = Singleton <Resources> .Instance.DefinePack.AnimatorState.OnbuStateID;
            PlayState         info2             = Singleton <Resources> .Instance.Animation.PlayerLocomotionStateTable[(int)player.ChaControl.sex][onbuStateId];
            ActorAnimation    animation1        = player.Animation;
            ActorAnimation    animation2        = partner.Animation;
            AnimatorStateInfo animatorStateInfo = animation1.Animator.GetCurrentAnimatorStateInfo(0);

            if (info1 != null)
            {
                animation1.InitializeStates(info1);
                animation2.InitializeStates(info2);
                bool flag = false;
                foreach (PlayState.Info stateInfo in info1.MainStateInfo.InStateInfo.StateInfos)
                {
                    if (((AnimatorStateInfo) ref animatorStateInfo).get_shortNameHash() == stateInfo.ShortNameStateHash)
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    if (info1.MaskStateInfo.layer > 0)
                    {
                        if ((double)animation1.Animator.GetLayerWeight(info1.MaskStateInfo.layer) == 0.0)
                        {
                            flag = false;
                        }
                    }
                    else
                    {
                        for (int index = 1; index < animation1.Animator.get_layerCount(); ++index)
                        {
                            if ((double)animation1.Animator.GetLayerWeight(index) > 0.0)
                            {
                                flag = false;
                                break;
                            }
                        }
                    }
                }
                if (flag)
                {
                    animation1.InStates.Clear();
                    animation1.OutStates.Clear();
                    animation1.ActionStates.Clear();
                    animation2.InStates.Clear();
                    animation2.OutStates.Clear();
                    animation2.ActionStates.Clear();
                }
                else
                {
                    int layer = info1.Layer;
                    if (animation1.RefsActAnimInfo)
                    {
                        animation1.StopAllAnimCoroutine();
                        animation1.PlayInLocoAnimation(animation1.AnimInfo.outEnableBlend, animation1.AnimInfo.outBlendSec, layer);
                        animation2.StopAllAnimCoroutine();
                        animation2.PlayInLocoAnimation(animation1.AnimInfo.outEnableBlend, animation1.AnimInfo.outBlendSec, layer);
                        animation1.RefsActAnimInfo = false;
                    }
                    else
                    {
                        bool  enableFade = info1.MainStateInfo.InStateInfo.EnableFade;
                        float fadeSecond = info1.MainStateInfo.InStateInfo.FadeSecond;
                        animation1.StopAllAnimCoroutine();
                        animation1.PlayInLocoAnimation(enableFade, fadeSecond, layer);
                        animation2.StopAllAnimCoroutine();
                        animation2.PlayInLocoAnimation(enableFade, fadeSecond, layer);
                    }
                }
            }
            else
            {
                for (int index = 1; index < animation1.Animator.get_layerCount(); ++index)
                {
                    animation1.Animator.SetLayerWeight(index, 0.0f);
                }
                animation1.InitializeStates(info2);
                animation2.InitializeStates(info2);
                int layer = info2.Layer;
                if (animation1.RefsActAnimInfo)
                {
                    animation1.StopAllAnimCoroutine();
                    animation1.PlayInLocoAnimation(animation1.AnimInfo.endEnableBlend, animation1.AnimInfo.endBlendSec, layer);
                    animation2.StopAllAnimCoroutine();
                    animation2.PlayInLocoAnimation(animation1.AnimInfo.inEnableBlend, animation1.AnimInfo.inBlendSec, layer);
                    animation1.RefsActAnimInfo = false;
                }
                else
                {
                    ActorAnimInfo actorAnimInfo1 = new ActorAnimInfo()
                    {
                        layer         = info2.Layer,
                        inEnableBlend = info2.MainStateInfo.InStateInfo.EnableFade,
                        inBlendSec    = info2.MainStateInfo.InStateInfo.FadeSecond
                    };
                    player.Animation.AnimInfo = actorAnimInfo1;
                    ActorAnimInfo actorAnimInfo2 = actorAnimInfo1;
                    bool          inEnableBlend  = actorAnimInfo2.inEnableBlend;
                    float         inBlendSec     = actorAnimInfo2.inBlendSec;
                    animation1.StopAllAnimCoroutine();
                    animation1.PlayInLocoAnimation(inEnableBlend, inBlendSec, layer);
                    animation2.StopAllAnimCoroutine();
                    animation2.PlayInLocoAnimation(inEnableBlend, inBlendSec, layer);
                }
            }
            if (player.NavMeshAgent.get_isStopped())
            {
                player.NavMeshAgent.set_isStopped(false);
            }
            if (!player.IsKinematic)
            {
                return;
            }
            player.IsKinematic = false;
        }