Пример #1
0
        public void NewSession()
        {
            EnvironmentPreset _temporaryPreset = new EnvironmentPreset("Sad Day", 3);

            _temporaryPreset.ParallaxBgCoef  = new float[] { 0.70f, 0.65f, 0.55f };
            _temporaryPreset.ParallaxBgColor = new Color[] { SwinGame.RGBAFloatColor(0f, 0.2f, 0f, 1),
                                                             SwinGame.RGBAFloatColor(0.1f, 0.3f, 0.1f, 1),
                                                             SwinGame.RGBAFloatColor(0.2f, 0.4f, 0.2f, 1) };
            _temporaryPreset.BgColor    = Color.CadetBlue;
            _temporaryPreset.CloudColor = Color.Gray;

            _turnCount = 0;


            GenerateEnvironment(_temporaryPreset);


            foreach (Player p in _players)
            {
                p.SetXPosition((int)RandBetween(Constants.CameraPadding, _logicalTerrain.Map.Length - 1 - Constants.CameraPadding));
            }

            PhysicsEngine.Instance.Settle();
            SwitchCameraFocus(_selectedPlayer.Character as ICameraCanFocus);
        }
Пример #2
0
        public void GenerateEnvironment(EnvironmentPreset preset)
        {
            //Generates the terrain + sky

            _environment.Initialise(preset);
            _logicalTerrain = _environment.Generate();
            PhysicsEngine.Instance.Terrain = _logicalTerrain;
        }
Пример #3
0
        public override void EnterState()
        {
            A3RData.Camera.FocusLock = false;
            _inputHandler.Enabled    = true;
            _state.Switch(CombatState.TrackingPlayer);

            Artillery3R.Services.PhysicsEngine.Clear();
            Artillery3R.Services.ParticleEngine.Clear();

            SwinGame.StopMusic();
            SwinGame.PlayMusic("generalBg");
            SwinGame.PlaySoundEffect("entryboomCombat");

            EnvironmentPreset _temporaryPreset = new EnvironmentPreset("Snowy Day", 3);

            _temporaryPreset.ParallaxBgCoef  = new float[] { 0.70f, 0.65f, 0.55f };
            _temporaryPreset.ParallaxBgColor = new Color[] { SwinGame.RGBAColor(3, 21, 46, 255),
                                                             SwinGame.RGBAColor(52, 51, 50, 255),
                                                             SwinGame.RGBAColor(188, 195, 210, 255) };
            _temporaryPreset.BgColor    = SwinGame.RGBAColor(229, 218, 248, 1);
            _temporaryPreset.CloudColor = Color.Gray;

            A3RData.Environment = new Environment(_windowRect, A3RData.Camera);
            A3RData.Environment.Initialise(_temporaryPreset);
            A3RData.Terrain = A3RData.Environment.Generate();

            foreach (Player p in A3RData.Players)
            {
                Artillery3R.Services.PhysicsEngine.AddComponent(p.Character as IPhysicsComponent);
                p.LinkCombatState(this);
                p.SetXPosition((int)RandDoubleBetween(Constants.CameraPadding, A3RData.Terrain.Map.Length - 1 - Constants.CameraPadding));
                p.Initiallise();
            }

            A3RData.SelectedPlayer = A3RData.Players[0];
            A3RData.SelectedPlayer.NewTurn();

            Artillery3R.Services.PhysicsEngine.Settle();
            SwitchCameraFocus(A3RData.SelectedPlayer.Character as ICameraCanFocus);

            _winCounterTimer         = new Timer(200, NotifyCombatEndedGame);
            _winCounterTimer.Enabled = false;

            _turnCount = 0;
            base.EnterState();
        }
Пример #4
0
        public void Initialise(EnvironmentPreset preset)
        {
            _backgroundObjects.Add(_moon);

            _preset = preset;

            _terrainFactory = new TerrainFactoryMidpoint(
                _windowRect, Constants.TerrainWidth,
                Constants.TerrainDepth, _camera);

            for (int i = 0; i < Constants.NumberParallaxBackgrounds; i++)
            {
                Terrain _generatedTerrain = _terrainFactory.Generate(_preset.ParallaxBgColor[i],
                                                                     Constants.AverageTerrainHeight + i * 50 - 400, _preset.ParallaxBgCoef[i]);

                _generatedTerrain.TerrainDistance = Constants.DistFromInfinity / Constants.NumberParallaxBackgrounds * (Constants.NumberParallaxBackgrounds - i);

                _backgroundTerrain.Add(_generatedTerrain);
            }

            _weatherDelayCount = 0;
        }