Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        EntityFaction bandits = new EntityFaction("Bandits!");

        for (int i = 0; i < 5; i++)
        {
            Vector2 pos = GameManager.RNG.RandomVector2(15, 25);
            Bandit  b   = new Bandit();
            b.SetEntityFaction(bandits);
            b.MoveEntity(Vec2i.FromVector2(pos));
            EntityManager.Instance.LoadEntity(b);
        }
    }
Exemplo n.º 2
0
    public override void Generate(GenerationRandom ran)
    {
        GenRan = ran;
        BuildWallAndEntrance();
        GenerateSubworldCave(new Vec2i(TileSize.x - 10, TileSize.z - 10));
        DEBUG = false;
        EntityFaction bandits = new EntityFaction("Bandits");

        for (int i = 0; i < 10; i++)
        {
            Vector3 pos    = GenRan.RandomVector3(Boundry + 2, Mathf.Min(TileSize.x, TileSize.z) - Boundry - 2);
            Bandit  bandit = new Bandit();
            bandit.SetEntityFaction(bandits);
            bandit.MoveEntity(pos);
            AddEntity(bandit);
        }
    }
Exemplo n.º 3
0
    private Dungeon GenerateFireDungeon(DungeonEntrance entrance)
    {
        ChunkData[,] dungeonChunks = new ChunkData[5, 5];
        Dictionary <int, WorldObjectData>[,] chunkObjects = new Dictionary <int, WorldObjectData> [5, 5];


        for (int x = 0; x < 5; x++)
        {
            for (int z = 0; z < 5; z++)
            {
                chunkObjects[x, z] = new Dictionary <int, WorldObjectData>();


                dungeonChunks[x, z] = new ChunkData(x, z, (int[, ])BASE_DIRT.Clone(), true, chunkObjects[x, z]);
            }
        }
        Vec2i         chunkPos        = World.GetChunkPosition(entrance.WorldPosition);
        Vec2i         dungEntr        = new Vec2i(5, 5);
        EntityFaction dungFact        = new EntityFaction("Dungeon_faction");
        List <Entity> dungeonEntities = new List <Entity>();
        DungeonBoss   testBoss        = new DungeonBossTest(new BasicHumanoidCombatAI(), new CreatureTaskAI());

        testBoss.SetEntityFaction(dungFact);

        for (int i = 0; i < 25; i++)
        {
            Vec2i  randomPos = GenRan.RandomVec2i(World.ChunkSize, 5 * World.ChunkSize - 5);
            Entity newEnt    = new Bandit();
            newEnt.SetPosition(randomPos);
            newEnt.SetEntityFaction(dungFact);
            dungeonEntities.Add(newEnt);
        }
        Dungeon dungeon = new Dungeon(dungeonChunks, dungEntr, entrance.WorldPosition, dungeonEntities, testBoss);

        entrance.SetDungeon(dungeon);
        return(dungeon);
    }
Exemplo n.º 4
0
    public List <ChunkData> Generate(GenerationRandom genRan)
    {
        Vec2i tilebase = Shell.Position * World.ChunkSize;

        if (Shell.BanditCampLevel > 1 && Shell.Size.x > 3 && Shell.Size.z > 3)
        {
            //If this camp is large enough, generate a dungeon entrance.

            Vec2i localPos = new Vec2i(2, TileSize.z / 2 - 2);

            CaveDungeonEntrance entr = new CaveDungeonEntrance(tilebase + localPos, null, new WorldObjectMetaData(direction: new Vec2i(1, 0)));
            IMultiTileObjectChild[,] children = entr.GetChildren();
            Objects[localPos.x, localPos.z]   = entr;
            for (int x = 0; x < entr.Size.x; x++)
            {
                for (int z = 0; z < entr.Size.z; z++)
                {
                    if (x == 0 && z == 0)
                    {
                        continue;
                    }
                    Objects[localPos.x + x, localPos.z + z] = children[x, z] as WorldObjectData;
                }
            }
            Debug.Log("Generated Bandit Camp with Dungeon at " + this.Shell.Position, Debug.CHUNK_STRUCTURE_GENERATION);

            Shell.SetDungeonEntrance(entr);
            entr.SetChunkStructure(Shell);
        }
        else
        {
            Debug.Log("Generated Bandit Camp no Dungeon at " + this.Shell.Position, Debug.CHUNK_STRUCTURE_GENERATION);
        }

        Objects[11, 11] = new LootSack(tilebase + new Vec2i(11, 11));
        FinalLootChest  = Objects[11, 11] as IInventoryObject;

        for (int x = 0; x < TileSize.x; x++)
        {
            for (int z = 0; z < TileSize.z; z++)
            {
                if (x == 0)
                {
                    Objects[x, z] = new WoodSpikeWall(tilebase + new Vec2i(x, z));
                }
                if (z == 0)
                {
                    Objects[x, z] = new WoodSpikeWall(tilebase + new Vec2i(x, z));
                }
                if (x == TileSize.x - 1 && z < TileSize.z / 2 - 2 && z > TileSize.z / 2 + 2)
                {
                    Objects[x, z] = new WoodSpikeWall(tilebase + new Vec2i(x, z));
                }
                if (z == TileSize.z - 1)
                {
                    Objects[x, z] = new WoodSpikeWall(tilebase + new Vec2i(x, z));
                }
                Tiles[x, z] = Tile.DIRT.ID;
            }
        }

        EntityFaction banditFaction = new EntityFaction("Bandit_Camp");

        for (int x = 0; x < Shell.Size.x; x++)
        {
            for (int z = 0; z < Shell.Size.z; z++)
            {
                //Entity e = new Bandit();
                //e.SetPosition(tilebase + new Vec2i(x * World.ChunkSize + 5, z * World.ChunkSize + z + 3));
                //Shell.AddEntity(x, z, e);
                //e.SetEntityFaction(banditFaction);
            }
        }
        Entity e = new Bandit();

        e.SetPosition(tilebase + new Vec2i(2 * World.ChunkSize + 5, 2 * World.ChunkSize + 2 + 3));
        Shell.AddEntity(0, 0, e);
        e.SetEntityFaction(banditFaction);



        return(ToChunkData());
    }