Exemplo n.º 1
0
    void SetUpGame()
    {
        GameRandom = new System.Random();

        RealDate = new Date();

        RealDate.Day   = 1;
        RealDate.Month = 1;
        RealDate.Year  = 1;

        FightManager    = new FightManager();
        ActivityManager = new ActivityManager();
        CurrentLeagueFighterDatabase = new FighterDatabase();
        TeamManager       = new TeamManager();
        BookingManager    = new BookingManager();
        PlayerManager     = new PlayerManager();
        CharacterDatabase = new CharacterDatabase();

        WorldMethods.SetUpWorld();

        GameObject.Find("FighterListContent").GetComponent <FighterListContent> ().SetUp(CurrentLeagueFighterDatabase.AllFighters);
        GameObject.Find("TeamListContent").GetComponent <TeamListContent> ().SetUp(TeamManager.TeamsInLeague);
        GameObject.Find("FightsPlannedListContent").GetComponent <FightPlanListContent> ().SetUp(BookingManager.Calendar);

        CharacterDatabase.SetUpCharacterDatabase();
        //Check whether the ID assignment has occurred properly
        print("Total Characters: " + CharacterDatabase.AllCharacters.Count);
        print("Highest ID: " + CharacterDatabase.UsedIDs + " (Should be the same as Total Characters)");

        OpinionManager = new Opinion();
    }
Exemplo n.º 2
0
    void SetUpGame()
    {
        //Set up Random and Date
        GameRandom = new System.Random();
        RealDate   = new Date();

        //Give Date starting values
        RealDate.Day   = 1;
        RealDate.Month = 1;
        RealDate.Year  = 1;

        //Generating the world will be done here
        WorldMethods.SetUpWorld();

        //Find all Locations
        allLocations = GameObject.FindGameObjectsWithTag("Location");

        //Set the correct connections and starting resource values
        playerResourceManager.SetUpResources();

        seasonManager.SetUpSeasons();

        UIController.UpdateCalendarDisplay();
        UIController.UpdateResourceDisplay();
    }
Exemplo n.º 3
0
        public override void ModifyWorldGenTasks(List <GenPass> tasks, ref float totalWeight)
        {
            int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies"));

            if (ShiniesIndex == -1)
            {
                // Shinies pass removed by some other mod.
                return;
            }
            tasks.Insert(ShiniesIndex + 1, new PassLegacy("CrystalBiomeGen", delegate(GenerationProgress progress)
            {
                progress.Message = "Growing Crystals";
                for (int num = 0; num < 12; num++)
                {
                    int xAxis = WorldGen.genRand.Next(200, Main.maxTilesX - 200);
                    int yAxis = WorldGen.genRand.Next((int)WorldGen.rockLayer + 200, Main.maxTilesY - 300);
                    WorldMethods.RoundHill(xAxis, yAxis, 100, 100, 45, true, (ushort)mod.TileType("CrystalBlock"));
                    for (int C = 0; C < 60; C++)
                    {
                        int E = xAxis + Main.rand.Next(-115, 115);
                        int F = yAxis + Main.rand.Next(-115, 115);
                        WorldGen.PlaceTile(E, F, mod.TileType("GlowingCrystal2"));
                    }
                    for (int D = 0; D < 60; D++)
                    {
                        int E = xAxis + Main.rand.Next(-115, 115);
                        int F = yAxis + Main.rand.Next(-115, 115);

                        WorldGen.PlaceTile(E, F, mod.TileType("GlowingCrystal"));
                    }
                }
            }));
        }
Exemplo n.º 4
0
        // Note that this item does not work in Multiplayer, but serves as a learning tool for other things.
        public override bool UseItem(Player player)
        {
            int x = (int)(player.position.X / 16);
            int y = (int)(player.position.Y / 16) + 3;

            WorldMethods.TileRunner(x, y, (double)200, 1, mod.TileType("CanyonRock"), false, 0f, 0f, true, true);             //improve basic shape later

            WorldMethods.RoundHole(x, y - 20, 60, 30, 10, true);
            for (int i = 0; i < 3; i++)
            {
                int Ex        = Main.rand.Next(-35, 35);
                int height    = Main.rand.Next(30, 80);
                int BaseWidth = Main.rand.Next(60, 80);
                int Sway      = 0;
                for (int j = 15; j < height; j++)
                {
                    if (Main.rand.Next(4) == 0)
                    {
                        if (Main.rand.Next(2) == 0)
                        {
                            Sway -= 1;
                        }
                        else
                        {
                            Sway += 1;
                        }
                    }
                    WorldMethods.TileRunner((x + Ex) + Sway, (y + 10) + j, (double)25 + (BaseWidth / Math.Sqrt(j)), 1, mod.TileType("CanyonRock"), false, 0f, 0f, true, true);                    //improve basic shape later
                    WorldGen.digTunnel((x + Ex) + Sway, (y + 10) + j, 0, 0, 3, (int)(BaseWidth / Math.Sqrt(j)), false);
                }
            }
            return(true);
        }
Exemplo n.º 5
0
 // Start is called before the first frame update
 void Start()
 {
     characterNeeds  = character.GetComponent <CharacterNeeds>();
     gameController  = WorldMethods.GetGameController();
     politicsManager = WorldMethods.GetPoliticsManager();
     warningSign     = transform.Find("WarningSign").gameObject;
     warningSign.SetActive(false);
 }
Exemplo n.º 6
0
 void Start()
 {
     poopHealth                  = startingPoopHealth;
     cursor                      = WorldMethods.GetCursor();
     startScale                  = transform.localScale;
     politicsManager             = WorldMethods.GetPoliticsManager();
     politicsManager.numOfPoops += 1;
 }
Exemplo n.º 7
0
 void Start()
 {
     gameController  = WorldMethods.GetGameController();
     characterSpeech = gameObject.GetComponent <CharacterSpeech>();
     cursor          = WorldMethods.GetCursor();
     politicsManager = WorldMethods.GetPoliticsManager();
     rb = gameObject.GetComponent <Rigidbody>();
     interactionSounds = GameObject.Find("Main Camera").GetComponent <InteractionSounds>();
 }
Exemplo n.º 8
0
    public void Lose()
    {
        gameDone = true;
        GameController gameController = WorldMethods.GetGameController();

        gameController.gameFrozen = true;
        lost = true;
        failurePanel.SetActive(true);
        GameObject.Find("Main Camera").GetComponent <InteractionSounds>().PlayGasps();
    }
Exemplo n.º 9
0
    // Start is called before the first frame update
    void Awake()
    {
        gameController  = WorldMethods.GetGameController();
        inputController = WorldMethods.GetInputController();
        unitManager     = WorldMethods.GetUnitManager();
        seasonManager   = WorldMethods.GetSeasonManager();

        //Reduce the speed to an appropriate level for the engine
        realUnitSpeed = unitSpeed * gameController.realUnitSpeedFactor;
    }
Exemplo n.º 10
0
    void Start()
    {
        InputController       = WorldMethods.GetInputController();
        UIController          = WorldMethods.GetUIController();
        playerResourceManager = WorldMethods.GetPlayerResourceManager();
        seasonManager         = WorldMethods.GetSeasonManager();
        waitPerTick           = waitPerTickSpeedThree; //Set the game speed to default
        UIController.UIControllerSetup();

        SetUpGame();
    }
Exemplo n.º 11
0
    // Start is called before the first frame update
    public void SetUpSeasons()
    {
        gameController = WorldMethods.GetGameController();
        uiController   = WorldMethods.GetUIController();

        winter         = true;
        winterProgress = 40;
        winterDuration = 30;

        uiController.UpdateWinterBar();
    }
Exemplo n.º 12
0
        public static void Asteroid(int X, int Y, int size, ushort type)
        {
            //Main.NewText("asteroid", 100, 220, 100);
            WorldMethods.TileRunner(X, Y, (double)size * 2f, 1, type, true, 0f, 0f, true, true);

            for (int rotation2 = 0; rotation2 < 350; rotation2++)
            {
                int DistX = (int)(0 - (Math.Sin(rotation2) * size));
                int DistY = (int)(0 - (Math.Cos(rotation2) * size));
                WorldMethods.TileRunner(X + DistX, Y + DistY, (double)size * 0.75f, 1, type, true, 0f, 0f, true, true);
            }
        }
Exemplo n.º 13
0
    // Start is called before the first frame update
    public void SetUpResources()
    {
        gameController = WorldMethods.GetGameController();
        uiController   = WorldMethods.GetUIController();

        authority  = startingAuthority;
        population = startingPopulation;
        food       = startingFood;
        wood       = startingWood;
        silver     = startingSilver;

        uiController.UpdateResourceDisplay();
    }
Exemplo n.º 14
0
 void Update()
 {
     if (InputController.gamePaused == false && TimeForTick == true && GameplayTickPause == false)
     {
         WorldMethods.DailyTick();
         TimeForTick = false;
     }
     if (TimeForTick == false)
     {
         timeWaitedForTick += Time.deltaTime;
         if (timeWaitedForTick > waitPerTick)
         {
             TimeForTick       = true;
             timeWaitedForTick = 0;
         }
     }
 }
Exemplo n.º 15
0
    /*---------- ---------- ---------- ---------- ----------*/
    // game related
    // create & get worlds
    public async Task <World[]> CreateWorlds()
    {
        List <World> list   = new List <World>();
        WorldMethods worlds = new WorldMethods();

        var ruins  = worlds.CreateWorldRuins();
        var jungle = worlds.CreateWorldJungle();
        var desert = worlds.CreateWorldDesert();
        var lake   = worlds.CreateWorldLake();

        list.Add(ruins);
        list.Add(jungle);
        list.Add(desert);
        list.Add(lake);
        await _worldCollection.InsertManyAsync(list);

        return(list.ToArray());
    }
Exemplo n.º 16
0
        public void PlaceCanyon(int x, int y)
        {
            int canyonRockTile = mod.TileType <Tiles.CanyonRock>();

            WorldMethods.TileRunner(x, y, (double)200, 1, mod.TileType("CanyonRock"), false, 0f, 0f, true, true); //improve basic shape later

            WorldMethods.RoundHole(x, y - 20, 60, 30, 10, true);

            for (int i = 0; i < 3; i++)
            {
                int Ex        = Main.rand.Next(-35, 35);
                int height    = Main.rand.Next(30, 80);
                int BaseWidth = Main.rand.Next(60, 80);
                int Sway      = 0;
                for (int j = 15; j < height; j++)
                {
                    if (Main.rand.Next(4) == 0)
                    {
                        if (Main.rand.Next(2) == 0)
                        {
                            Sway -= 1;
                        }
                        else
                        {
                            Sway += 1;
                        }
                    }
                    WorldMethods.TileRunner((x + Ex) + Sway, (y + 10) + j, (double)25 + (BaseWidth / Math.Sqrt(j)), 1, mod.TileType("CanyonRock"), false, 0f, 0f, true, true); //improve basic shape later
                    WorldGen.digTunnel((x + Ex) + Sway, (y + 10) + j, 0, 0, 3, (int)(BaseWidth / Math.Sqrt(j)), false);

                    /*for (int h = -10; h < 10; h++)
                     *                  {
                     *                          WorldGen.KillWall((x + Ex) + Sway + h, (y + 10) + j);
                     *
                     *                  }*/
                }
            }
        }
Exemplo n.º 17
0
    public void UIControllerSetup()
    {
        GameController        = GameObject.Find("GameController").GetComponent <GameController> ();
        inputController       = GameObject.Find("InputController").GetComponent <InputController>();
        playerResourceManager = WorldMethods.GetPlayerResourceManager();

        pauseBoard = GameObject.Find("PauseBoard");

        GameSpeedDisplay = GameObject.Find("GameSpeedDisplay").GetComponent <TextMeshProUGUI> ();
        DaysCounter      = GameObject.Find("DaysCounter").GetComponent <TextMeshProUGUI>();
        MonthsCounter    = GameObject.Find("MonthsCounter").GetComponent <TextMeshProUGUI>();
        YearsCounter     = GameObject.Find("YearsCounter").GetComponent <TextMeshProUGUI>();

        authorityNumber  = GameObject.Find("AuthorityNumber").GetComponent <TextMeshProUGUI>();
        populationNumber = GameObject.Find("PopulationNumber").GetComponent <TextMeshProUGUI>();
        foodNumber       = GameObject.Find("FoodNumber").GetComponent <TextMeshProUGUI>();
        woodNumber       = GameObject.Find("WoodNumber").GetComponent <TextMeshProUGUI>();
        silverNumber     = GameObject.Find("SilverNumber").GetComponent <TextMeshProUGUI>();

        seasonManager = WorldMethods.GetSeasonManager();

        RealDate = GameController.RealDate;
    }
Exemplo n.º 18
0
 void Awake()
 {
     playerResourceManager = WorldMethods.GetPlayerResourceManager();
 }
Exemplo n.º 19
0
 // Start is called before the first frame update
 void Start()
 {
     gameController  = WorldMethods.GetGameController();
     characterSprite = gameObject.transform.parent.Find("CharacterSprite").gameObject;
 }
Exemplo n.º 20
0
        public void PlaceCrystalForest(int x, int y)
        {
            //initial pit
            WorldMethods.TileRunner(x, y, (double)150, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, true, true); //improve basic shape later
            bool leftpit = false;
            int  PitX;
            int  PitY;

            if (Main.rand.Next(2) == 0)
            {
                leftpit = true;
            }
            if (leftpit)
            {
                PitX = x - Main.rand.Next(5, 15);
            }
            else
            {
                PitX = x + Main.rand.Next(5, 15);
            }
            for (PitY = y - 16; PitY < y + 25; PitY++)
            {
                WorldGen.digTunnel(PitX, PitY, 0, 0, 1, 4, false);
                WorldGen.TileRunner(PitX, PitY, 11, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, false, true);
            }
            //tunnel off of pit
            int tunnellength = Main.rand.Next(50, 110);
            int TunnelEndX   = 0;

            if (leftpit)
            {
                for (int TunnelX = PitX; TunnelX < PitX + tunnellength; TunnelX++)
                {
                    WorldGen.digTunnel(TunnelX, PitY, 0, 0, 1, 4, false);
                    WorldGen.TileRunner(TunnelX, PitY, 13, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, false, true);
                    TunnelEndX = TunnelX;
                }
            }
            else
            {
                for (int TunnelX = PitX; TunnelX > PitX - tunnellength; TunnelX--)
                {
                    WorldGen.digTunnel(TunnelX, PitY, 0, 0, 1, 4, false);
                    WorldGen.TileRunner(TunnelX, PitY, 13, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, false, true);
                    TunnelEndX = TunnelX;
                }
            }
            //More pits and spikes
            int TrapX;

            for (int TrapNum = 0; TrapNum < 10; TrapNum++)
            {
                if (leftpit)
                {
                    TrapX = Main.rand.Next(PitX, PitX + tunnellength);
                }
                else
                {
                    TrapX = Main.rand.Next(PitX - tunnellength, PitX);
                }
                for (int TrapY = PitY; TrapY < PitY + 15; TrapY++)
                {
                    WorldGen.digTunnel(TrapX, TrapY, 0, 0, 1, 3, false);
                    WorldGen.TileRunner(TrapX, TrapY, 11, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, false, true);
                }
                WorldGen.TileRunner(TrapX, PitY + 18, 9, 1, 48, false, 0f, 0f, false, true);
            }
            //Additional hole and tunnel
            int PittwoY = 0;

            for (PittwoY = PitY; PittwoY < PitY + 40; PittwoY++)
            {
                WorldGen.digTunnel(TunnelEndX, PittwoY, 0, 0, 1, 4, false);
                WorldGen.TileRunner(TunnelEndX, PittwoY, 11, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, false, true);
            }
            int PittwoX = 0;

            for (PittwoX = TunnelEndX - 50; PittwoX < TunnelEndX + 50; PittwoX++)
            {
                WorldGen.digTunnel(PittwoX, PittwoY, 0, 0, 1, 4, false);
                WorldGen.TileRunner(PittwoX, PittwoY, 13, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, false, true);
                WorldGen.PlaceChest(PittwoX, PittwoY, 21, false, 2);
                WorldGen.PlaceChest(PittwoX + 5, PittwoY + 3, 21, false, 2);
                WorldGen.PlaceChest(PittwoX + 1, PittwoY + 2, 21, false, 2);
            }
            //grass walls
            for (int wallx = x - 100; wallx < x + 100; wallx++)
            {
                for (int wally = y - 25; wally < y + 100; wally++)
                {
                    if (Main.tile[wallx, wally].wall != 0)
                    {
                        WorldGen.KillWall(wallx, wally);
                        WorldGen.PlaceWall(wallx, wally, 63);
                    }
                }
            }
            //campfires and shit
            int  SkullStickY = 0;
            Tile tile        = Main.tile[1, 1];

            for (int SkullStickX = x - 90; SkullStickX < x + 90; SkullStickX++)
            {
                if (Main.rand.Next(4) == 1)
                {
                    for (SkullStickY = y - 80; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0)
                        {
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 2, 215);//i dont know which of these is correct but i cant be bothered to test.
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 1, 215);
                            WorldGen.PlaceObject(SkullStickX, SkullStickY, 215);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 2, 215, 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 1, 215, 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY, 215, 0, 0, -1, -1);
                        }
                    }
                }
                if (Main.rand.Next(9) == 1)
                {
                    for (SkullStickY = y - 60; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0 || tile.type == mod.TileType("ReachGrassTile"))
                        {
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 3, mod.TileType("SkullStick")); //i dont know which of these is correct but i cant be bothered to test.
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 2, mod.TileType("SkullStick"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 1, mod.TileType("SkullStick"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY, mod.TileType("SkullStick"));
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 3, mod.TileType("SkullStick"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 2, mod.TileType("SkullStick"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 1, mod.TileType("SkullStick"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY, mod.TileType("SkullStick"), 0, 0, -1, -1);
                        }
                    }
                }
                if (Main.rand.Next(12) == 1)
                {
                    for (SkullStickY = y - 60; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0 || tile.type == mod.TileType("ReachGrassTile"))
                        {
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 3, mod.TileType("SkullStick2")); //i dont know which of these is correct but i cant be bothered to test.
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 2, mod.TileType("SkullStick2"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 1, mod.TileType("SkullStick2"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY, mod.TileType("SkullStick2"));
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 3, mod.TileType("SkullStick2"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 2, mod.TileType("SkullStick2"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 1, mod.TileType("SkullStick2"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY, mod.TileType("SkullStick2"), 0, 0, -1, -1);
                        }
                    }
                }
                if (Main.rand.Next(10) == 1)
                {
                    for (SkullStickY = y - 60; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0 || tile.type == mod.TileType("ReachGrassTile"))
                        {
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 3, mod.TileType("SkullStick3")); //i dont know which of these is correct but i cant be bothered to test.
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 2, mod.TileType("SkullStick3"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 1, mod.TileType("SkullStick3"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY, mod.TileType("SkullStick3"));
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 3, mod.TileType("SkullStick3"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 2, mod.TileType("SkullStick3"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 1, mod.TileType("SkullStick3"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY, mod.TileType("SkullStick3"), 0, 0, -1, -1);
                        }
                    }
                }
                if (Main.rand.Next(25) == 1)
                {
                    for (SkullStickY = y - 60; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0 || tile.type == mod.TileType("ReachGrassTile"))
                        {
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 3, mod.TileType("CreationAltarTile")); //i dont know which of these is correct but i cant be bothered to test.
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 2, mod.TileType("CreationAltarTile"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 1, mod.TileType("CreationAltarTile"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY, mod.TileType("CreationAltarTile"));
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 3, mod.TileType("CreationAltarTile"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 2, mod.TileType("CreationAltarTile"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 1, mod.TileType("CreationAltarTile"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY, mod.TileType("CreationAltarTile"), 0, 0, -1, -1);
                        }
                    }
                }
                if (Main.rand.Next(10) == 1)
                {
                    for (SkullStickY = y - 60; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0 || tile.type == mod.TileType("ReachGrassTile"))
                        {
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 3, mod.TileType("ReachGrass1")); //i dont know which of these is correct but i cant be bothered to test.
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 2, mod.TileType("ReachGrass1"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 1, mod.TileType("ReachGrass1"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY, mod.TileType("ReachGrass1"));
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 3, mod.TileType("ReachGrass1"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 2, mod.TileType("ReachGrass1"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 1, mod.TileType("ReachGrass1"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY, mod.TileType("ReachGrass1"), 0, 0, -1, -1);
                        }
                    }
                }
                if (Main.rand.Next(16) == 1)
                {
                    for (SkullStickY = y - 60; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0 || tile.type == mod.TileType("ReachGrassTile"))
                        {
                            WorldGen.PlaceChest(SkullStickX, SkullStickY - 3, (ushort)mod.TileType("ReachChest"), false, 0);
                            WorldGen.PlaceChest(SkullStickX, SkullStickY - 2, (ushort)mod.TileType("ReachChest"), false, 0);
                            WorldGen.PlaceChest(SkullStickX, SkullStickY - 1, (ushort)mod.TileType("ReachChest"), false, 0);
                        }
                    }
                }
            }
            //loot placement
            for (PittwoX = TunnelEndX - 20; PittwoX < TunnelEndX + 20; PittwoX++)
            {
                if (Main.rand.Next(30) == 1)
                {
                    Main.tile[PittwoX, PittwoY + 1].active(true);
                    Main.tile[PittwoX + 1, PittwoY + 1].active(true);
                    Main.tile[PittwoX, PittwoY + 1].type     = 1;
                    Main.tile[PittwoX + 1, PittwoY + 1].type = 1;
                    WorldGen.AddLifeCrystal(PittwoX + 1, PittwoY);
                    WorldGen.AddLifeCrystal(PittwoX + 1, PittwoY + 1);
                    break;
                }
            }
            for (int trees = 0; trees < 5000; trees++)
            {
                int E = x + Main.rand.Next(-200, 200);
                int F = y + Main.rand.Next(-30, 30);
                tile = Framing.GetTileSafely(E, F);
                if (tile.type == mod.TileType("ReachGrassTile"))
                {
                    WorldGen.GrowTree(E, F);
                }
            }
        }
Exemplo n.º 21
0
        public override bool UseItem(Player player)
        {
            #region SpiritBiome
            Main.NewText("The Spirits spread through the Land...", Color.Orange.R, Color.Orange.G, Color.Orange.B);
            Random rand = new Random();
            int    XTILE;
            if (Terraria.Main.dungeonX > Main.maxTilesX / 2)         //rightside dungeon
            {
                XTILE = WorldGen.genRand.Next(Main.maxTilesX / 2, Main.maxTilesX - 500);
            }
            else         //leftside dungeon
            {
                XTILE = WorldGen.genRand.Next(75, Main.maxTilesX / 2);
            }
            int xAxis     = XTILE;
            int xAxisMid  = xAxis + 70;
            int xAxisEdge = xAxis + 380;
            int yAxis     = 0;
            for (int y = 0; y < Main.maxTilesY; y++)
            {
                yAxis++;
                xAxis = XTILE;

                for (int i = 0; i < 450; i++)
                {
                    xAxis++;
                    #region islands
                    if (Main.rand.Next(21000) == 1)
                    {
                        WorldMethods.Island(xAxis, Main.rand.Next(100, 275), Main.rand.Next(10, 16), (float)(Main.rand.Next(11, 25) / 10), (ushort)mod.TileType("SpiritGrass"));
                    }
                    #endregion

                    if (Main.tile[xAxis, yAxis] != null)
                    {
                        if (Main.tile[xAxis, yAxis].active())
                        {
                            int[] TileArray = { 0 };
                            if (TileArray.Contains(Main.tile[xAxis, yAxis].type))
                            {
                                if (Main.tile[xAxis, yAxis + 1] == null)
                                {
                                    if (Main.rand.Next(0, 50) == 1)
                                    {
                                        WillGenn = 0;
                                        if (xAxis < xAxisMid - 1)
                                        {
                                            Meme     = xAxisMid - xAxis;
                                            WillGenn = Main.rand.Next(Meme);
                                        }
                                        if (xAxis > xAxisEdge + 1)
                                        {
                                            Meme     = xAxis - xAxisEdge;
                                            WillGenn = Main.rand.Next(Meme);
                                        }
                                        if (WillGenn < 10)
                                        {
                                            Main.tile[xAxis, yAxis].type = (ushort)mod.TileType("SpiritDirt");
                                        }
                                    }
                                }
                                else
                                {
                                    WillGenn = 0;
                                    if (xAxis < xAxisMid - 1)
                                    {
                                        Meme     = xAxisMid - xAxis;
                                        WillGenn = Main.rand.Next(Meme);
                                    }
                                    if (xAxis > xAxisEdge + 1)
                                    {
                                        Meme     = xAxis - xAxisEdge;
                                        WillGenn = Main.rand.Next(Meme);
                                    }
                                    if (WillGenn < 10)
                                    {
                                        Main.tile[xAxis, yAxis].type = (ushort)mod.TileType("SpiritDirt");
                                    }
                                }
                            }
                            int[] TileArray89 = { 3, 24, 110, 113, 115, 201, 205, 52, 62, 32, 165 };
                            if (TileArray89.Contains(Main.tile[xAxis, yAxis].type))
                            {
                                if (Main.tile[xAxis, yAxis + 1] == null)
                                {
                                    if (rand.Next(0, 50) == 1)
                                    {
                                        WillGenn = 0;
                                        if (xAxis < xAxisMid - 1)
                                        {
                                            Meme     = xAxisMid - xAxis;
                                            WillGenn = Main.rand.Next(Meme);
                                        }
                                        if (xAxis > xAxisEdge + 1)
                                        {
                                            Meme     = xAxis - xAxisEdge;
                                            WillGenn = Main.rand.Next(Meme);
                                        }
                                        if (WillGenn < 18)
                                        {
                                            Main.tile[xAxis, yAxis].active(false);
                                        }
                                    }
                                }
                                else
                                {
                                    WillGenn = 0;
                                    if (xAxis < xAxisMid - 1)
                                    {
                                        Meme     = xAxisMid - xAxis;
                                        WillGenn = Main.rand.Next(Meme);
                                    }
                                    if (xAxis > xAxisEdge + 1)
                                    {
                                        Meme     = xAxis - xAxisEdge;
                                        WillGenn = Main.rand.Next(Meme);
                                    }
                                    if (WillGenn < 18)
                                    {
                                        Main.tile[xAxis, yAxis].active(false);
                                    }
                                }
                            }
                            int[] TileArray1 = { 2, 23, 109, 199 };
                            if (TileArray1.Contains(Main.tile[xAxis, yAxis].type))
                            {
                                if (Main.tile[xAxis, yAxis + 1] == null)
                                {
                                    if (rand.Next(0, 50) == 1)
                                    {
                                        WillGenn = 0;
                                        if (xAxis < xAxisMid - 1)
                                        {
                                            Meme     = xAxisMid - xAxis;
                                            WillGenn = Main.rand.Next(Meme);
                                        }
                                        if (xAxis > xAxisEdge + 1)
                                        {
                                            Meme     = xAxis - xAxisEdge;
                                            WillGenn = Main.rand.Next(Meme);
                                        }
                                        if (WillGenn < 18)
                                        {
                                            Main.tile[xAxis, yAxis].type = (ushort)mod.TileType("SpiritGrass");
                                        }
                                    }
                                }
                                else
                                {
                                    WillGenn = 0;
                                    if (xAxis < xAxisMid - 1)
                                    {
                                        Meme     = xAxisMid - xAxis;
                                        WillGenn = Main.rand.Next(Meme);
                                    }
                                    if (xAxis > xAxisEdge + 1)
                                    {
                                        Meme     = xAxis - xAxisEdge;
                                        WillGenn = Main.rand.Next(Meme);
                                    }
                                    if (WillGenn < 18)
                                    {
                                        Main.tile[xAxis, yAxis].type = (ushort)mod.TileType("SpiritGrass");
                                    }
                                }
                            }

                            int[] TileArray2 = { 1, 25, 117, 203 };
                            if (TileArray2.Contains(Main.tile[xAxis, yAxis].type))
                            {
                                if (Main.tile[xAxis, yAxis + 1] == null)
                                {
                                    if (rand.Next(0, 50) == 1)
                                    {
                                        WillGenn = 0;
                                        if (xAxis < xAxisMid - 1)
                                        {
                                            Meme     = xAxisMid - xAxis;
                                            WillGenn = Main.rand.Next(Meme);
                                        }
                                        if (xAxis > xAxisEdge + 1)
                                        {
                                            Meme     = xAxis - xAxisEdge;
                                            WillGenn = Main.rand.Next(Meme);
                                        }
                                        if (WillGenn < 18)
                                        {
                                            Main.tile[xAxis, yAxis].type = (ushort)mod.TileType("SpiritStone");
                                        }
                                    }
                                }
                                else
                                {
                                    WillGenn = 0;
                                    if (xAxis < xAxisMid - 1)
                                    {
                                        Meme     = xAxisMid - xAxis;
                                        WillGenn = Main.rand.Next(Meme);
                                    }
                                    if (xAxis > xAxisEdge + 1)
                                    {
                                        Meme     = xAxis - xAxisEdge;
                                        WillGenn = Main.rand.Next(Meme);
                                    }
                                    if (WillGenn < 18)
                                    {
                                        Main.tile[xAxis, yAxis].type = (ushort)mod.TileType("SpiritStone");
                                    }
                                }
                            }

                            int[] TileArray3 = { 53, 116, 112, 234 };
                            if (TileArray3.Contains(Main.tile[xAxis, yAxis].type))
                            {
                                if (Main.tile[xAxis, yAxis + 1] == null)
                                {
                                    if (rand.Next(0, 50) == 1)
                                    {
                                        WillGenn = 0;
                                        if (xAxis < xAxisMid - 1)
                                        {
                                            Meme     = xAxisMid - xAxis;
                                            WillGenn = Main.rand.Next(Meme);
                                        }
                                        if (xAxis > xAxisEdge + 1)
                                        {
                                            Meme     = xAxis - xAxisEdge;
                                            WillGenn = Main.rand.Next(Meme);
                                        }
                                        if (WillGenn < 18)
                                        {
                                            Main.tile[xAxis, yAxis].type = (ushort)mod.TileType("Spiritsand");
                                        }
                                    }
                                }
                                else
                                {
                                    WillGenn = 0;
                                    if (xAxis < xAxisMid - 1)
                                    {
                                        Meme     = xAxisMid - xAxis;
                                        WillGenn = Main.rand.Next(Meme);
                                    }
                                    if (xAxis > xAxisEdge + 1)
                                    {
                                        Meme     = xAxis - xAxisEdge;
                                        WillGenn = Main.rand.Next(Meme);
                                    }
                                    if (WillGenn < 18)
                                    {
                                        Main.tile[xAxis, yAxis].type = (ushort)mod.TileType("Spiritsand");
                                    }
                                }
                            }

                            int[] TileArray4 = { 161, 163, 200, 164 };
                            if (TileArray4.Contains(Main.tile[xAxis, yAxis].type))
                            {
                                if (Main.tile[xAxis, yAxis + 1] == null)
                                {
                                    if (rand.Next(0, 50) == 1)
                                    {
                                        WillGenn = 0;
                                        if (xAxis < xAxisMid - 1)
                                        {
                                            Meme     = xAxisMid - xAxis;
                                            WillGenn = Main.rand.Next(Meme);
                                        }
                                        if (xAxis > xAxisEdge + 1)
                                        {
                                            Meme     = xAxis - xAxisEdge;
                                            WillGenn = Main.rand.Next(Meme);
                                        }
                                        if (WillGenn < 18)
                                        {
                                            Main.tile[xAxis, yAxis].type = (ushort)mod.TileType("SpiritIce");
                                        }
                                    }
                                }
                                else
                                {
                                    WillGenn = 0;
                                    if (xAxis < xAxisMid - 1)
                                    {
                                        Meme     = xAxisMid - xAxis;
                                        WillGenn = Main.rand.Next(Meme);
                                    }
                                    if (xAxis > xAxisEdge + 1)
                                    {
                                        Meme     = xAxis - xAxisEdge;
                                        WillGenn = Main.rand.Next(Meme);
                                    }
                                    if (WillGenn < 18)
                                    {
                                        Main.tile[xAxis, yAxis].type = (ushort)mod.TileType("SpiritIce");
                                    }
                                }
                            }
                        }
                        if (Main.tile[xAxis, yAxis].type == mod.TileType("SpiritStone") && yAxis > WorldGen.rockLayer + 100 && Main.rand.Next(1500) == 6)
                        {
                            WorldGen.TileRunner(xAxis, yAxis, (double)WorldGen.genRand.Next(5, 7), 1, mod.TileType("SpiritOreTile"), false, 0f, 0f, true, true);
                        }
                    }
                }
            }
            int chests = 0;
            for (int r = 0; r < 380000; r++)
            {
                int success = WorldGen.PlaceChest(xAxis - Main.rand.Next(450), Main.rand.Next(100, 275), (ushort)mod.TileType("SpiritChestLocked"), false, 2);
                if (success > -1)
                {
                    string[] lootTable = { "GhastKnife", "GhastStaff", "GhastStaffMage", "GhastSword", "GhastBeam", };
                    Main.chest[success].item[0].SetDefaults(mod.ItemType(lootTable[chests]), false);

                    int[] lootTable2 = { 499, 1508, mod.ItemType("SpiritBar"), };

                    Main.chest[success].item[1].SetDefaults(lootTable2[Main.rand.Next(3)], false);
                    Main.chest[success].item[1].stack = WorldGen.genRand.Next(3, 8);
                    Main.chest[success].item[2].SetDefaults(lootTable2[Main.rand.Next(3)], false);
                    Main.chest[success].item[2].stack = WorldGen.genRand.Next(3, 8);
                    Main.chest[success].item[3].SetDefaults(lootTable2[Main.rand.Next(3)], false);
                    Main.chest[success].item[3].stack = WorldGen.genRand.Next(3, 8);
                    chests++;
                    if (chests >= 5)
                    {
                        break;
                    }
                }
            }
            #endregion
            return(true);
        }
Exemplo n.º 22
0
        public void PlaceVolcano(int x, int y)
        {
            //some notes:
            //It is the same on every worldsize. This will be fixed.
            //It doesn't merge with the ground well AT ALL. This will also be fixed.
            //The elevation is kinda f****d.
            //Most of the values are arbituary.
            //The code does need to be cleaned up. I'll do that in the final version.
            //Most of the methods I use are in WorldMethods. Its a file i copypaste in any worldgen project I do, so it may have some unused methods.


            //basic land of the area.

            for (int depth = 0; depth < 100; depth++)
            {
                if (Main.rand.Next(6) == 1)
                {
                    WorldMethods.TileRunner(x, y + depth, (double)125 + Main.rand.Next(75), 1, mod.TileType("VolcanoTile"), false, 0f, 0f, true, true);             //improve basic shape later
                }
            }

            //random bits of lava above ground, that fall. Despite not being the "prettiest" method, it probably looks and works the best.
            for (int r = 0; r < 250; r++)
            {
                Tile tile = Main.tile[x + Main.rand.Next(-75, 75), y - Main.rand.Next(10, 85)];
                tile.liquid = 255;
                tile.lava(true);
            }
            //A line of consecutive "spikes" along the ground.
            for (int k = x - 85; k < x + 85; k++)
            {
                WorldMethods.CragSpike(k, (int)(y - Main.rand.Next(10, 28)), 1, 30, (ushort)mod.TileType("VolcanoStone"), (float)Main.rand.Next(2, 6), (float)Main.rand.Next(2, 6));
            }

            //the main volcano
            WorldMethods.MainVolcano(x, (int)(y - Main.rand.Next(70, 90)), 3, 130, (ushort)mod.TileType("VolcanoStone"), (float)(Main.rand.Next(400, 600) / 100), (float)(Main.rand.Next(400, 600) / 100));

            //digs the tunnel down the middle
            for (int j = y - 100; j < y + 20; j++)
            {
                WorldGen.digTunnel(x, j, 0, 0, 8, (int)(5 + (Math.Sqrt((j + 100) - y) / 1.5f)), false);
            }
            //giant gaping hole you see at the bottom.
            WorldMethods.RoundHole(x, y + 30, 17, 7, 10, true);

            //more random lava bits.
            for (int r = 0; r < 2000; r++)
            {
                Tile tile = Main.tile[x + Main.rand.Next(-30, 30), y + Main.rand.Next(-20, 45)];
                tile.liquid = 255;
                tile.lava(true);
            }

            //generates the ore
            for (int OreGen = 0; OreGen < 100; OreGen++)
            {
                int orex = x + Main.rand.Next(-75, 75);
                int orey = y + Main.rand.Next(-20, 300);
                if (Main.tile[orex, orey].type == mod.TileType("VolcanoStone"))
                {
                    WorldGen.TileRunner(orex, orey, (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(3, 6), mod.TileType("MoltenOre"), false, 0f, 0f, false, true);
                }                                                          // A = x, B = y.
            }

            //Turns nearby water into lava.
            for (int LiquidX = -110; LiquidX < 110; LiquidX++)
            {
                for (int LiquidY = -20; LiquidY < 150; LiquidY++)
                {
                    Tile tile = Main.tile[x + LiquidX, y + LiquidY];
                    if (tile.liquid > 0)
                    {
                        tile.lava(true);
                    }
                }
            }
        }
Exemplo n.º 23
0
        public override void ModifyWorldGenTasks(List <GenPass> tasks, ref float totalWeight)
        {
            int genIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup"));

            tasks.Insert(genIndex + 1, new PassLegacy("Twilight Forest", delegate(GenerationProgress progress)
            {
                progress.Message = "Twilight Forest";
                int XTILE        = WorldGen.genRand.Next(125, Main.maxTilesX - 350);
                int yAxis        = Main.maxTilesY / 13;
                int num          = Main.rand.Next(20, 30);
                for (int g = 0; g <= num; g++)
                {
                    WorldMethods.Island(XTILE + Main.rand.Next(-350, 350), yAxis + Main.rand.Next(-20, 55), Main.rand.Next(26, 35), (float)(Main.rand.Next(11, 25) / 10), (ushort)mod.TileType("TwilightGrass"));
                }

                WorldMethods.Island(XTILE, yAxis, Main.rand.Next(60, 75), (float)(Main.rand.Next(6, 17) / 10), (ushort)mod.TileType("TwilightGrass"));
                for (int trees = 0; trees < 5000; trees++)
                {
                    int E     = XTILE + Main.rand.Next(-350, 350);
                    int F     = yAxis + Main.rand.Next(-20, 55);
                    Tile tile = Framing.GetTileSafely(E, F);
                    if (tile.type == mod.TileType("TwilightGrass"))
                    {
                        WorldGen.GrowTree(E, F);
                    }
                }

                int x;
                int y;
                int maxTries  = 20000;
                int tries     = 0;
                int successes = 0;


                while (tries < maxTries && successes < 10)
                {
                    x = XTILE + Main.rand.Next(-350, 350);
                    y = yAxis + Main.rand.Next(-20, 55);
                    if (WorldGen.PlaceChest(x, y, (ushort)mod.TileType <Tiles.TwiChest>(), false, 0) != -1)
                    {
                        successes++;
                    }
                    tries++;
                }
            }));

            int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes"));

            if (ShiniesIndex == -1)
            {
                // Shinies pass removed by some other mod.
                return;
            }

            tasks.Insert(ShiniesIndex + 1, new PassLegacy("Canyon", delegate(GenerationProgress progress)
            {
                progress.Message     = "Carving canyons";
                int X                = 1;
                int Y                = 1;
                float widthScale     = (Main.maxTilesX / 4200f);
                int numberToGenerate = 2;
                for (int k = 0; k < numberToGenerate; k++)
                {
                    bool placement = false;
                    bool placed    = false;
                    while (!placed)
                    {
                        bool success = false;
                        int attempts = 0;
                        while (!success)
                        {
                            attempts++;
                            if (attempts > 1000)
                            {
                                success = true;
                                continue;
                            }
                            int i = WorldGen.genRand.Next(200, Main.maxTilesX - 200);
                            if (i <= Main.maxTilesX / 2 - 50 || i >= Main.maxTilesX / 2 + 50)
                            {
                                int j = 0;
                                while (!Main.tile[i, j].active() && (double)j < Main.worldSurface)
                                {
                                    j++;
                                }
                                if (Main.tile[i, j].type == 53 || Main.tile[i, j].type == 0)
                                {
                                    j--;
                                    if (j > 150)
                                    {
                                        placement = CanGenerateCanyon(i, j);
                                        if (placement)
                                        {
                                            X = i;
                                            //	progress.Message = "BAZINGA";
                                            Y = j;
                                            PlaceCanyon(i, j);
                                            success = true;
                                            placed  = true;
                                            continue;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }));
        }
Exemplo n.º 24
0
 // Start is called before the first frame update
 void Start()
 {
     unitManager           = GameObject.Find("UnitManager").GetComponent <UnitManager>();
     playerResourceManager = WorldMethods.GetPlayerResourceManager();
 }
Exemplo n.º 25
0
        public void PlaceReachs(int x, int y)
        {
            Tile tile   = Main.tile[1, 1];
            int  startx = x; //keep track of starting position
            int  starty = y;
            int  x1213  = 300;
            int  z1592  = 147;

            if (Main.maxTilesX == 4200)
            {
                x1213 = 300;
            }
            else if (Main.maxTilesX == 6400)
            {
                x1213 = 400;
            }
            else if (Main.maxTilesX == 8400)
            {
                x1213 = 520;
            }
            if (Main.maxTilesX == 4200)
            {
                z1592 = 147;
            }
            else if (Main.maxTilesX == 6400)
            {
                z1592 = 196;
            }
            else if (Main.maxTilesX == 8400)
            {
                z1592 = 263;
            }
            for (int z = 0; z < z1592; z++)
            {
                if (Main.rand.Next(2) == 1)
                {
                    WorldMethods.TileRunner(x, y + z, (double)x1213, 1, ModContent.TileType <ReachGrassTile>(), false, 0f, 0f, true, true); //Basic grass shape. Will be improved later. Specifically, make it only override certain tiles, and make it fill in random holes in the ground.
                }
            }
            int E = Main.maxTilesX;
            int F = (int)Main.maxTilesY;

            tile = Framing.GetTileSafely(E, F);
            if (tile.type == ModContent.TileType <ReachGrassTile>())
            {
                WorldGen.GrowTree(E, F);
            }
            //temporary wall placement until i get a better method
            for (int A = x - (int)x1213 / 2; A < x + (int)x1213 / 2; A++)
            {
                for (int B = y + 10; B < y + 1000; B++)
                {
                    if (Main.tile[A, B] != null)
                    {
                        int Wal = (int)Main.tile[A, B].wall;
                        if (Main.tile[A, B].type == ModContent.TileType <ReachGrassTile>() && ((Wal == 2 || Wal == 54 || Wal == 55 || Wal == 56 || Wal == 57 || Wal == 58 || Wal == 59 || Wal == 0 && B >= WorldGen.rockLayer - 10))) // A = x, B = y.
                        {
                            if (WorldGen.genRand.Next(2) == 0)
                            {
                                WorldGen.KillWall(A, B);
                                WorldGen.PlaceWall(A, B, ModContent.WallType <ReachWallNatural>());
                            }
                            else if (WorldGen.genRand.Next(2) == 0 && B > WorldGen.rockLayer - 20)
                            {
                                WorldGen.KillWall(A, B);
                                WorldGen.PlaceWall(A, B, ModContent.WallType <ReachStoneWall>());
                            }
                            else
                            {
                                WorldGen.KillWall(A, B);
                                WorldGen.PlaceWall(A, B, 15);
                            }
                        }
                    }
                }
            }

            int smoothness      = 3;                      //how smooth the tunnels are
            int chestrarity     = 7;                      //how rare chests are
            int depth           = 50;                     //how many vertical tunnels deep the initial goes.
            int tunnelheight    = Main.rand.Next(65, 80); //how high the first tunnel is
            int tunnelthickness = 5;

            for (int q = 0; q < 10; q++) //make 2 tunnels to overlap
            {
                if (startx == x && starty == y)
                {
                    if (Main.maxTilesX == 4200)
                    {
                        tunnelheight = Main.rand.Next(30, 50);
                    }
                    else if (Main.maxTilesX == 6400)
                    {
                        tunnelheight = Main.rand.Next(80, 100);
                    }
                    else if (Main.maxTilesX == 8400)
                    {
                        tunnelheight = Main.rand.Next(90, 120);
                    }
                    tunnelthickness = 5;
                }
                int jt      = 0; //j placeholder to use out of loop
                int newx    = startx;
                int newy    = starty - 40;
                int tunnelX = Main.rand.Next(-55, 55); //how far away on the x axis each tunnel starts
                for (int p = 0; p < depth; p++)
                {
                    int k = 0;       //placeholder
                    if (tunnelX > 0) //if tunnel leads right
                    {
                        for (k = newx; k < newx + tunnelX; k++)
                        {
                            for (int e = 0; e < smoothness; e++)
                            {
                                WorldGen.digTunnel(k, newy, 0, 0, 1, tunnelthickness, false); //horizontal tunneling
                                if (Main.rand.Next(5) == 0)
                                {
                                    WorldGen.TileRunner(k, newy, 9, 1, 48, false, 0f, 0f, false, true);
                                    WorldGen.TileRunner(k, newy, 9, 1, 48, false, 0f, 0f, false, true);
                                }
                            }

                            if (Main.rand.Next(20) == 1) //make a full branch
                            {
                                startx = k;
                                starty = newy;
                                depth  = (depth - p) + 1;
                            }
                        }
                    }
                    else if (tunnelX < 0)  //if tunnel should lead left
                    {
                        for (k = newx; k > newx + tunnelX; k--)
                        {
                            for (int e = 0; e < smoothness; e++)
                            {
                                WorldGen.digTunnel(k, newy, 0, 0, 1, tunnelthickness, false); //horizontal tunneling
                            }
                            if (Main.rand.Next(18) == 1)                                      //make a full branch
                            {
                                startx = k;
                                starty = newy;
                                depth  = (depth - p) + 1;
                            }
                        }
                    }
                    tunnelthickness = Main.rand.Next(3, 7);
                    for (int j = 0; j < tunnelheight; j++) //go down the tunnel
                    {
                        for (int e = 0; e < smoothness; e++)
                        {
                            WorldGen.digTunnel(newx + tunnelX, newy + j, 0, 0, 1, tunnelthickness, false); //vertical tunneling
                            if (Main.rand.Next(2) == 0)
                            {
                                WorldGen.TileRunner(newx + tunnelX, newy + j, 9, 1, 48, false, 0f, 0f, false, true);
                            }
                            WorldGen.TileRunner(newx + tunnelX, newy + j, 9, 1, 48, false, 0f, 0f, false, true);
                        }
                        jt = j;
                    }
                    tunnelheight    = Main.rand.Next(20, 40); //how high the first tunnel is
                    tunnelthickness = Main.rand.Next(3, 7);
                    newx            = newx + tunnelX;         //setting values to new places
                    newy            = newy + jt;
                    if (Main.rand.Next(2) == 1)
                    {
                        tunnelX = Main.rand.Next(15, 50); //how far the horizontal tunnel goes
                    }
                    else
                    {
                        tunnelX = Main.rand.Next(-50, -15); //how far the horizontal tunnel goes
                    }

                    if (newx > x + 70) //if it strays too far on the x axis
                    {
                        tunnelX = Main.rand.Next(-75, -55);
                    }
                    if (newx < x - 70)
                    {
                        tunnelX = Main.rand.Next(55, 75);
                    }
                }
            }
            for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY * 27) * 15E-05); k++)
            {
                int zx = WorldGen.genRand.Next(0, Main.maxTilesX);
                int zy = WorldGen.genRand.Next(0, Main.maxTilesY);
                if (Main.tile[zx, zy] != null)
                {
                    if (Main.tile[zx, zy].active())
                    {
                        if (Main.tile[zx, zy].type == ModContent.TileType <ReachGrassTile>())
                        {
                            WorldGen.TileRunner(zx, zy, (double)WorldGen.genRand.Next(5, 12), WorldGen.genRand.Next(5, 12), ModContent.TileType <MossyStone>(), false, 0f, 0f, false, true);
                        }
                    }
                }
            }
            for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY * 9) * 15E-05); k++)
            {
                int zx = WorldGen.genRand.Next(0, Main.maxTilesX);
                int zy = WorldGen.genRand.Next(0, Main.maxTilesY);
                if (Main.tile[zx, zy] != null)
                {
                    if (Main.tile[zx, zy].active())
                    {
                        if (Main.tile[zx, zy].type == ModContent.TileType <ReachGrassTile>())
                        {
                            WorldGen.TileRunner(zx, zy, (double)WorldGen.genRand.Next(4, 6), WorldGen.genRand.Next(4, 6), WorldGen.CopperTierOre, false, 0f, 0f, false, true);
                        }
                    }
                }
            }
            for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY * 8) * 15E-05); k++)
            {
                int zx = WorldGen.genRand.Next(0, Main.maxTilesX);
                int zy = WorldGen.genRand.Next(0, Main.maxTilesY);
                if (Main.tile[zx, zy] != null)
                {
                    if (Main.tile[zx, zy].active())
                    {
                        if (Main.tile[zx, zy].type == ModContent.TileType <ReachGrassTile>())
                        {
                            WorldGen.TileRunner(zx, zy, (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(3, 6), WorldGen.IronTierOre, false, 0f, 0f, false, true);
                        }
                    }
                }
            }
            for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY * 4) * 15E-05); k++)
            {
                int zx = WorldGen.genRand.Next(0, Main.maxTilesX);
                int zy = WorldGen.genRand.Next((int)Main.worldSurface + 10, Main.maxTilesY);
                if (Main.tile[zx, zy] != null)
                {
                    if (Main.tile[zx, zy].active())
                    {
                        if (Main.tile[zx, zy].type == ModContent.TileType <ReachGrassTile>())
                        {
                            WorldGen.TileRunner(zx, zy, (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(3, 6), WorldGen.SilverTierOre, false, 0f, 0f, false, true);
                        }
                    }
                }
            }
            for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY * 2) * 15E-05); k++)
            {
                int zx = WorldGen.genRand.Next(0, Main.maxTilesX);
                int zy = WorldGen.genRand.Next((int)Main.worldSurface + 20, Main.maxTilesY);
                if (Main.tile[zx, zy] != null)
                {
                    if (Main.tile[zx, zy].active())
                    {
                        if (Main.tile[zx, zy].type == ModContent.TileType <ReachGrassTile>())
                        {
                            WorldGen.TileRunner(zx, zy, (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(3, 6), WorldGen.GoldTierOre, false, 0f, 0f, false, true);
                        }
                    }
                }
            }
        }
Exemplo n.º 26
0
 void Start()
 {
     gameController = WorldMethods.GetGameController();
     allCharacters  = GameObject.FindGameObjectsWithTag("Character");
 }
Exemplo n.º 27
0
 void Start()
 {
     gameController = WorldMethods.GetGameController();
 }
Exemplo n.º 28
0
 public void StartOver()
 {
     SceneManager.LoadScene(0);
     WorldMethods.GetGameController().gameFrozen = false;
 }
Exemplo n.º 29
0
 void Start()
 {
     GameController = GameObject.Find("GameController").GetComponent <GameController> ();
     UIController   = GameObject.Find("UIController").GetComponent <UIController>();
     unitManager    = WorldMethods.GetUnitManager();
 }
Exemplo n.º 30
0
 // Start is called before the first frame update
 void Start()
 {
     characterNeeds  = character.GetComponent <CharacterNeeds>();
     gameController  = WorldMethods.GetGameController();
     politicsManager = WorldMethods.GetPoliticsManager();
 }