Esempio n. 1
0
    private void Start()
    {
        playerEntity = FindObjectOfType <PlayerController>();
        playerT      = playerEntity.transform;

        nextCampCheckTime     = timeBetweenCampingChecks + Time.time;
        campPositionOld       = playerT.position;
        playerEntity.OnDeath += OnPlayerDeath;

        map = FindObjectOfType <Mapgenerator>();
        NextWave();
    }
Esempio n. 2
0
        protected override void Initialize()
        {
            gamestate         = Vars_Func.GameState.StartMenu;
            hexagonSideLength = 1;               //dont change
            mapDrawWidth      = 10;              //dont go over 15
            planeLength       = 50;              //need an even number!
            minimapSize       = 5 * planeLength; //in pixel
            frameTimeCounter  = 0;
            frames            = 0;
            drawFrame         = 0;
            updateTimeCounter = 0;
            updates           = 0;
            drawUpdates       = 0;
            showIngameMenu    = false;
            buttonIsPressed   = false;
            reinitializeDone  = false;
            timeCounter       = 0.0f;
            minDelayTime      = 100.0f;

            Vars_Func.loadContent(Content);
            map = new Map(planeLength, Logic.Vars_Func.HexTyp.Sand, true, hexagonSideLength);
            Mapgenerator.generateMap(map, planeLength, (int)(planeLength / 10), (int)(planeLength / 5), false);

            //cameraposition HQ.X * 1.5, HQ.Y * 1.75
            camera = new Camera(new Vector3((map.HQPosition.X * 1.5f) + 1, (map.HQPosition.Y * 1.75f) - 10 + 0.875f, 11), new Vector3((map.HQPosition.X * 1.5f) + 1, (map.HQPosition.Y * 1.75f) + 0.875f, 0),
                                Vector3.UnitZ, GraphicsDevice.Viewport.AspectRatio, 0.5f, 1000.0f, planeLength, hexagonSideLength);
            view          = camera.View;
            projection    = camera.Projection;
            keyboard      = Keyboard.GetState();
            mouseState    = Mouse.GetState();
            mousePosition = Vars_Func.mousepos(GraphicsDevice, mouseState, projection, view);


            minimap = new Minimap(map, new Vector2(graphics.PreferredBackBufferWidth - minimapSize, 0), new Vector2(minimapSize, minimapSize));
            BasicGUI.createGUI();
            StartMenu_GUI.createGUI();
            MainMenu_GUI.createGUI();
            Highscore_GUI.createGUI();
            Setting_GUI.createGUI();
            IngameMenu_GUI.createGUI();
            Confirm_GUI.createGUI();
            GameOver_GUI.createGUI();
            IntroMenu_GUI.createGUI();
            //InsertNameGUI.createGUI();

            base.Initialize();
            Interaction.Game = this;
            reinitializeDone = true;
        }
Esempio n. 3
0
    public override void OnInspectorGUI()
    {
        //base.OnInspectorGUI();
        Mapgenerator map = target as Mapgenerator;

        if (DrawDefaultInspector())
        {
            map.GenerateMap();
        }

        if (GUILayout.Button("Generate Map"))
        {
            map.GenerateMap();
        }
    }
Esempio n. 4
0
    public override void OnInspectorGUI()
    {
        Mapgenerator mapGen = (Mapgenerator)target;

        if (DrawDefaultInspector())
        {
            if (mapGen.autoUpdate)
            {
                mapGen.GenerateMap();
            }
        }
        if (GUILayout.Button("Generator"))
        {
            mapGen.GenerateMap();
        }
    }
Esempio n. 5
0
        public void reinitialize()
        {
            Player.Gold               = 1000;
            Player.Mana               = 2000;
            Player.Food               = 200;
            Player.Score              = 0;
            Spells.SummonImpCost      = 0;
            BasicGUI.SelectedThingTyp = Vars_Func.ThingTyp.length;
            hexagonSideLength         = 1;               //dont change
            mapDrawWidth              = 10;              //dont go over 15
            planeLength               = 50;              //need an even number!
            minimapSize               = 5 * planeLength; //in pixel
            frameTimeCounter          = 0;
            frames            = 0;
            drawFrame         = 0;
            updateTimeCounter = 0;
            updates           = 0;
            drawUpdates       = 0;
            timeCounter       = 0.0f;
            WaveController.restart();

            map = new Map(planeLength, Logic.Vars_Func.HexTyp.Sand, true, hexagonSideLength);
            Mapgenerator.generateMap(map, planeLength, (int)(planeLength / 10), (int)(planeLength / 5), false);

            camera = new Camera(new Vector3((map.HQPosition.X * 1.5f) + 1, (map.HQPosition.Y * 1.75f) - 10 + 0.875f, 11), new Vector3((map.HQPosition.X * 1.5f) + 1, (map.HQPosition.Y * 1.75f) + 0.875f, 0),
                                Vector3.UnitZ, GraphicsDevice.Viewport.AspectRatio, 0.5f, 1000.0f, planeLength, hexagonSideLength);
            view          = camera.View;
            projection    = camera.Projection;
            keyboard      = Keyboard.GetState();
            mouseState    = Mouse.GetState();
            mousePosition = Vars_Func.mousepos(GraphicsDevice, mouseState, projection, view);
            minimap       = new Minimap(map, new Vector2(graphics.PreferredBackBufferWidth - minimapSize, 0), new Vector2(minimapSize, minimapSize));


            base.Initialize();
            Interaction.Game = this;
            GC.Collect();
        }