Inheritance: MonoBehaviour
Example #1
0
        public override void OnStart()
        {
            this.prevEventKey      = this.Merchant.EventKey;
            this.Merchant.EventKey = EventType.DoorOpen;
            OffMeshLinkData currentOffMeshLinkData = this.Merchant.NavMeshAgent.get_currentOffMeshLinkData();
            DoorPoint       component1             = (DoorPoint)((Component)((OffMeshLinkData) ref currentOffMeshLinkData).get_offMeshLink()).GetComponent <DoorPoint>();

            this.isDoorOpen   = !((OffMeshLinkData) ref currentOffMeshLinkData).get_activated() || Object.op_Equality((Object)component1, (Object)null) || component1.IsOpen;
            this.CurrentPoint = !this.isDoorOpen ? (ActionPoint)component1 : (ActionPoint)null;
            if (this.isDoorOpen)
            {
                this.Merchant.EventKey = this.prevEventKey;
            }
            base.OnStart();
            if (!Object.op_Inequality((Object)this.CurrentPoint, (Object)null))
            {
                return;
            }
            DoorAnimation component2 = (DoorAnimation)((Component)this.CurrentPoint).GetComponent <DoorAnimation>();

            if (!Object.op_Inequality((Object)component2, (Object)null))
            {
                return;
            }
            ActionPointInfo outInfo;

            this.CurrentPoint.TryGetAgentActionPointInfo(EventType.DoorOpen, out outInfo);
            PlayState playState = Singleton <Resources> .Instance.Animation.MerchantCommonActionAnimStateTable[outInfo.eventID][outInfo.poseID];

            component2.Load(playState.MainStateInfo.InStateInfo.StateInfos);
            component2.PlayAnimation(this.animInfo.inEnableBlend, this.animInfo.inBlendSec, this.animInfo.inFadeOutTime, this.animInfo.layer);
        }
Example #2
0
        protected override void OnAwake(PlayerActor player)
        {
            player.EventKey = AIProject.EventType.DoorOpen;
            player.SetActiveOnEquipedItem(false);
            player.ChaControl.setAllLayerWeight(0.0f);
            ValueTuple <int, string> valueTuple;

            AIProject.Definitions.Action.NameTable.TryGetValue(AIProject.EventType.DoorOpen, out valueTuple);
            int             index1 = (int)valueTuple.Item1;
            ActionPointInfo outInfo;

            player.CurrentPoint.TryGetPlayerActionPointInfo(AIProject.EventType.DoorOpen, out outInfo);
            player.CurrentPoint.SetBookingUser((Actor)player);
            int poseId = outInfo.poseID;

            player.PoseID = poseId;
            int           index2        = poseId;
            PlayState     info          = Singleton <Resources> .Instance.Animation.PlayerActionAnimTable[(int)player.ChaControl.sex][index1][index2];
            ActorAnimInfo actorAnimInfo = new ActorAnimInfo()
            {
                layer          = info.Layer,
                inEnableBlend  = info.MainStateInfo.InStateInfo.EnableFade,
                inBlendSec     = info.MainStateInfo.InStateInfo.FadeSecond,
                outEnableBlend = info.MainStateInfo.OutStateInfo.EnableFade,
                outBlendSec    = info.MainStateInfo.OutStateInfo.FadeSecond,
                directionType  = info.DirectionType,
                endEnableBlend = info.EndEnableBlend,
                endBlendSec    = info.EndBlendRate
            };

            player.Animation.AnimInfo = actorAnimInfo;
            ActorAnimInfo animInfo = actorAnimInfo;

            if (player.PlayerController.PrevStateName != "Onbu")
            {
                Transform  t    = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.baseNullName)?.get_transform() ?? ((Component)player.CurrentPoint).get_transform();
                GameObject loop = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.recoveryNullName);
                player.Animation.RecoveryPoint = loop?.get_transform();
                player.Animation.InitializeStates(info.MainStateInfo.InStateInfo.StateInfos, info.MainStateInfo.OutStateInfo.StateInfos, info.MainStateInfo.AssetBundleInfo);
                player.Animation.LoadAnimatorIfNotEquals(info);
                player.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, info.MainStateInfo.FadeOutTime, animInfo.layer);
                ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndAction, 1), (System.Action <M0>)(_ => player.Animation.PlayOutAnimation(animInfo.outEnableBlend, animInfo.outBlendSec, animInfo.layer)));
                player.SetStand(t, info.MainStateInfo.InStateInfo.EnableFade, info.MainStateInfo.InStateInfo.FadeSecond, info.DirectionType);
            }
            player.Animation.LoadSEEventKeyTable(outInfo.eventID, outInfo.poseID);
            if (!Object.op_Inequality((Object)player.CurrentPoint, (Object)null))
            {
                return;
            }
            this._doorAnimation = (DoorAnimation)((Component)player.CurrentPoint).GetComponent <DoorAnimation>();
            if (!Object.op_Inequality((Object)this._doorAnimation, (Object)null))
            {
                return;
            }
            this._doorAnimation.Load(info.MainStateInfo.InStateInfo.StateInfos);
            this._doorAnimation.PlayAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, info.MainStateInfo.FadeOutTime, animInfo.layer);
        }
Example #3
0
 void Start()
 {
     numberOfPassengers = 0;
     originPosition     = transform.localPosition;
     targetSpeed        = speed;
     if (pathCreator == null)
     {
         if (transform.parent != null && transform.parent.tag == Constants.fullTrain)
         {
             UpdateChildCart();
         }
     }
     if (pathCreator != null)
     {
         // Subscribed to the pathUpdated event so that we're notified if the path changes during the game
         distanceTravelled       += extraSpace;
         pathCreator.pathUpdated += OnPathChanged;
     }
     if (transform.tag == Constants.trainCart)
     {
         foreach (Transform child in gameObject.transform)
         {
             if (child.gameObject.CompareTag(Constants.doorAnchorTag))
             {
                 doorAnchor = child.gameObject;
                 //add doors
                 foreach (Transform grandChild in child.transform)
                 {
                     if (grandChild.gameObject.CompareTag(Constants.doorTag))
                     {
                         if (grandChild.name == ("Door"))
                         {
                             door = grandChild.GetComponent <DoorAnimation>();
                         }
                         else if (grandChild.name == ("Door (1)"))
                         {
                             door1 = grandChild.GetComponent <DoorAnimation1>();
                         }
                         else if (grandChild.name == ("Step"))
                         {
                             step = grandChild.GetComponent <StepAnimation>();
                         }
                     }
                 }
             }
         }
     }
 }
Example #4
0
 public void UpdateEnemyQuantity()
 {
     enemyQuantity--;
     if (this.enemyQuantity <= 0)
     {
         DeactivePortals();
         int randomDoor = Random.Range(0, 4);
         portals[randomDoor].SetActive(true);
         DoorAnimation doorAnim = portals[randomDoor].GetComponent <DoorAnimation>();
         doorAnim.SetDoorStatus(false);
         Debug.Log("next stage, door number " + doorAnim.name);
         doorAnim = portals[randomDoor].GetComponent <DoorAnimation>();
         doorAnim.SetDoorStatus(true);
         arrowUI[randomDoor].SetActive(true);
     }
 }
Example #5
0
        protected override void OnAwake(PlayerActor player)
        {
            DoorPoint currentPoint = player.CurrentPoint as DoorPoint;

            if (Object.op_Inequality((Object)currentPoint, (Object)null))
            {
                DoorPoint.OpenPattern openState = currentPoint.OpenState;
                currentPoint.SetOpenState(DoorPoint.OpenPattern.Close, true);
                this._doorAnimation = (DoorAnimation)((Component)currentPoint).GetComponent <DoorAnimation>();
                if (Object.op_Inequality((Object)this._doorAnimation, (Object)null))
                {
                    this._doorAnimation.PlayCloseAnimation(openState);
                }
                currentPoint.SetBookingUser((Actor)player);
            }
            ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndAction, 1), (Action <M0>)(_ => this.Elapsed(player)));
            ActorAnimInfo animInfo = player.Animation.AnimInfo;

            animInfo.outEnableBlend   = true;
            animInfo.outBlendSec      = 0.0f;
            player.Animation.AnimInfo = animInfo;
        }