Exemplo n.º 1
0
        private void Update()
        {
            if (!dfUnity.IsReady || !playerEnterExit || GameManager.IsGamePaused || DaggerfallUI.Instance.FadeBehaviour.FadeInProgress)
            {
                return;
            }

            if (transportManager.IsOnShip())
            {
                return;
            }

            if (NeedToGroundHorse && HorseDeployed)
            {
                PlaceHorseOnGround();
                Horse.transform.SetPositionAndRotation(HorsePosition, HorseRotation);
                NeedToGroundHorse = false;
            }

            if (NeedToGroundWagon && WagonDeployed)
            {
                PlaceWagonOnGround();
                Wagon.transform.SetPositionAndRotation(WagonPosition, WagonRotation);
                NeedToGroundWagon = false;
            }


            if ((HorseName == "" || HorseName == null) && transportManager.HasHorse())
            {
                NameHorse();
            }

            if (GameManager.Instance.PlayerController.isGrounded && !GameManager.Instance.IsPlayerInside)
            {
                if (playerEntity.IsInBeastForm && transportManager.HasHorse())
                {
                    transportManager.TransportMode = TransportModes.Foot;
                    LeaveHorse();
                    DaggerfallUI.MessageBox(HorseName + " bucks in fear, throwing you to the ground.");
                }
                //If you have a wagon but no horse, the wagon is dropped.
                else if (!transportManager.HasHorse() && GameManager.Instance.TransportManager.HasCart() && GameManager.Instance.TransportManager.TransportMode == TransportModes.Cart)
                {
                    transportManager.TransportMode = TransportModes.Foot;
                    PlaceWagon();
                }
                //If you have wagon and horse, but change to Foot, horse and wagon is dropped.
                else if (transportManager.HasHorse() && GameManager.Instance.TransportManager.HasCart() && GameManager.Instance.TransportManager.TransportMode == TransportModes.Foot)
                {
                    LeaveHorseWagon();
                    DaggerfallUI.MessageBox("You unhitch your wagon.");
                    DaggerfallUI.MessageBox("You dismount " + HorseName + ".");
                }
                //If you have wagon and horse, but change to Horse, wagon is dropped.
                else if (transportManager.HasCart() && GameManager.Instance.TransportManager.TransportMode == TransportModes.Horse)
                {
                    LeaveWagon();
                    DaggerfallUI.MessageBox("You unhitch your wagon.");
                }
                //If you have horse, but change to foot, horse is dropped.
                else if (transportManager.HasHorse() && GameManager.Instance.TransportManager.TransportMode == TransportModes.Foot)
                {
                    LeaveHorse();
                    DaggerfallUI.MessageBox("You dismount " + HorseName + ".");
                }
            }

            if (!GameManager.Instance.PlayerController.isGrounded && !GameManager.Instance.IsPlayerInside && transportManager.HasCart())
            {
                if (transportManager.HasCart())
                {
                    LeaveWagon();
                }
                if (transportManager.HasHorse())
                {
                    LeaveHorse();
                }
                transportManager.TransportMode = TransportModes.Foot;
            }


            if (transportManager.HasCart() && WagonDeployed && !playerEnterExit.IsPlayerInsideDungeon && !WagonClose)
            {
                NewWagonPopUp();
            }
            if (transportManager.HasHorse() && HorseDeployed)
            {
                DestroyHorse();
                HorseDeployed = false;
                HorseName     = "";
            }
        }