示例#1
0
    private void Start()
    {
        ForestBuilder = GetComponent <ForestBuilder>();
        BuildAdjacentTiles(true);

        //Reposition controller above ground:
        Vector3 startPos = controller.transform.position;

        startPos.y = ForestBuilder.GetGroundHeight(0f, 0f) + 2f;
        controller.transform.position = startPos;
    }
示例#2
0
        public TestScene()
        {
            _random = new DotNetRandom();

            MapBuilder builder = new ForestBuilder(64, 64, 0, _random.Next());

            builder.Build();
            _map = builder.Map;
            _fov = new FieldOfView(_map);

            Race playerRace = Engine.Assets.GetAsset <Race>("player");

            _player = new Player(playerRace);
            _map.Add(_player, 32, 32);

            for (int i = 0; i < 10; i++)
            {
                Creature frog = CreatureGenerator.NewCreature("frog");
                _map.Add(frog, _map.RandomEmptyPoint(_random));
            }

            for (int i = 0; i < 10; i++)
            {
                Creature rat = CreatureGenerator.NewCreature("rat");
                _map.Add(rat, _map.RandomEmptyPoint(_random));
            }

            _turnManager = new TurnManager <Creature>(_map.Creatures);

            _tileSelection = Engine.Assets.GetAsset <Sprite>("tile_selection");

            _soundEffectManager.LoadSoundEffect("rain_looped");
            _soundEffectManager.LoadSoundEffect("thunder_01");

            _soundEffectManager.Play("rain_looped", 0.4f, loop: true);

            _camera      = new Camera();
            _camera.Zoom = 1f;

            int w = Engine.Width / 8;
            int h = Engine.Height / 8;

            _camera.Origin = new Vector2(Engine.Width / 2, Engine.Height / 2);
            _camera.X      = _player.RenderX;
            _camera.Y      = _player.RenderY;


            _mapRenderer       = new MapRenderer(_map, _lightingManager, _camera);
            _creatureRenderer  = new CreatureRenderer(_map.Creatures, _map, _lightingManager, _camera);
            _effectsRenderer   = new EffectsRenderer(_map, _lightingManager, _camera);
            _interfaceRenderer = new InterfaceRenderer(_map, _camera);
        }
示例#3
0
    void Start()
    {
        Instance = this;

        Builder = GetComponent <ForestBuilder>();
        BuildAdjacentTiles();

        // Reposition controller above ground
        Vector3 startPos = Controller.transform.position;

        startPos.y = Builder.GetGroundHeight(0, 0) + 2f;
        Controller.transform.position = startPos;
    }
示例#4
0
 void Start()
 {
     _builder    = GameManager.Instance.Builder;
     _controller = GameManager.Instance.Controller;
     _rigidbody  = GetComponent <Rigidbody>();
 }
示例#5
0
 private void Start()
 {
     forestBuilder = GameManager.Instance.ForestBuilder;
     controller    = GameManager.Instance.Controller;
     rigidBody     = GetComponent <Rigidbody>();
 }