Exemplo n.º 1
0
        public void ShipView_Enter()
        {
            ComponentBody componentBody   = m_componentPlayer.Entity.FindComponent <ComponentBody>(throwOnError: true);
            Vector2       vector          = FindOceanDirection(m_subsystemTerrain.TerrainContentsGenerator, componentBody.Position.XZ);
            Vector2       vector2         = componentBody.Position.XZ + 25f * vector;
            bool          isPlayerMounted = m_componentPlayer.ComponentRider.Mount != null;
            Vector2       vector3         = vector2;
            float         num             = float.MinValue;

            for (int i = Terrain.ToCell(vector2.Y) - 15; i < Terrain.ToCell(vector2.Y) + 15; i++)
            {
                for (int j = Terrain.ToCell(vector2.X) - 15; j < Terrain.ToCell(vector2.X) + 15; j++)
                {
                    float num2 = ScoreShipPosition(componentBody.Position.XZ, j, i);
                    if (num2 > num)
                    {
                        num     = num2;
                        vector3 = new Vector2(j, i);
                    }
                }
            }
            DatabaseObject   databaseObject   = base.Project.GameDatabase.Database.FindDatabaseObject("IntroShip", base.Project.GameDatabase.EntityTemplateType, throwIfNotFound: true);
            ValuesDictionary valuesDictionary = new ValuesDictionary();

            valuesDictionary.PopulateFromDatabaseObject(databaseObject);
            Entity  entity  = base.Project.CreateEntity(valuesDictionary);
            Vector3 vector4 = new Vector3(vector3.X, (float)m_subsystemTerrain.TerrainContentsGenerator.OceanLevel + 0.5f, vector3.Y);

            entity.FindComponent <ComponentFrame>(throwOnError: true).Position    = vector4;
            entity.FindComponent <ComponentIntroShip>(throwOnError: true).Heading = Vector2.Angle(vector, -Vector2.UnitY);
            base.Project.AddEntity(entity);
            m_subsystemTime.QueueGameTimeDelayedExecution(2.0, delegate
            {
                m_componentPlayer.ComponentGui.DisplayLargeMessage(null, LanguageControl.Get(fName, 1), 5f, 0f);
            });
            m_subsystemTime.QueueGameTimeDelayedExecution(7.0, delegate
            {
                if (isPlayerMounted)
                {
                    m_componentPlayer.ComponentGui.DisplayLargeMessage(null, LanguageControl.Get(fName, 2), 5f, 0f);
                }
                else
                {
                    m_componentPlayer.ComponentGui.DisplayLargeMessage(null, LanguageControl.Get(fName, 3), 5f, 0f);
                }
            });
            m_subsystemTime.QueueGameTimeDelayedExecution(12.0, delegate
            {
                m_componentPlayer.ComponentGui.DisplayLargeMessage(null, LanguageControl.Get(fName, 4), 5f, 0f);
            });
            IntroCamera introCamera = m_componentPlayer.GameWidget.FindCamera <IntroCamera>();

            m_componentPlayer.GameWidget.ActiveCamera = introCamera;
            introCamera.CameraPosition       = vector4 + new Vector3(12f * vector.X, 8f, 12f * vector.Y) + new Vector3(-5f * vector.Y, 0f, 5f * vector.X);
            introCamera.TargetPosition       = m_componentPlayer.ComponentCreatureModel.EyePosition + 2.5f * new Vector3(vector.X, 0f, vector.Y);
            introCamera.Speed                = 0f;
            introCamera.TargetCameraPosition = m_componentPlayer.ComponentCreatureModel.EyePosition;
        }
Exemplo n.º 2
0
        public void ShipView_Update()
        {
            IntroCamera introCamera = m_componentPlayer.GameWidget.FindCamera <IntroCamera>();

            introCamera.Speed = MathUtils.Lerp(0f, 8f, MathUtils.Saturate(((float)m_subsystemGameInfo.TotalElapsedGameTime - 6f) / 3f));
            if (Vector3.Distance(introCamera.TargetCameraPosition, introCamera.CameraPosition) < 0.3f)
            {
                m_componentPlayer.GameWidget.ActiveCamera = m_componentPlayer.GameWidget.FindCamera <FppCamera>();
                m_stateMachine.TransitionTo(null);
            }
        }