Exemplo n.º 1
0
 public void GenerateRivers(int count)
 {
     for (int i = 0; i < count; i++)
     {
         int x = (int)GenRan.GaussianFloat(World.WorldSize / 2, World.WorldSize / 8);
         int z = (int)GenRan.GaussianFloat(World.WorldSize / 2, World.WorldSize / 8);
         GenerateRiver(new Vec2i(x, z));
     }
 }
    public CaveRoom GenerateRoom(Vec3i position, Vector3 size)
    {
        CaveRoom     cr        = new CaveRoom(position, size, new Vec3i(0, 0, 0), new Vec3i(0, 0, 0));
        List <Vec3i> points    = cr.AllPointsInside();
        float        perlinLim = Mathf.Clamp(GenRan.GaussianFloat(0.4f, 0.2f), 0.1f, 0.5f);

        foreach (Vec3i v in points)
        {
            float perlin = GenRan.PerlinNoise3D(v, 0.1f);
            if (perlin < 0.6f)
            {
                ClearVoxelNode(v.x, v.y, v.z);
            }
        }

        return(cr);
    }
Exemplo n.º 3
0
    private void GenerateNPCPersonalities(List <NPC> npcs)
    {
        //iterate all npcs
        foreach (NPC npc in npcs)
        {
            //Personality is random
            KingdomHierarchy rank    = npc.NPCKingdomData.Rank;
            float            loyalty = 1;
            float            wealth  = 0;
            if (rank == KingdomHierarchy.Monarch)
            {
                wealth  = 1;
                loyalty = 1;
            }
            else if (rank == KingdomHierarchy.Noble)
            {
                loyalty = Mathf.Clamp(GenerationRan.GaussianFloat(0.8f, 0.2f), 0, 1);
                wealth  = Mathf.Clamp(GenerationRan.GaussianFloat(0.8f, 0.2f), 0, 1);
            }
            else if (rank == KingdomHierarchy.LordLady)
            {
                loyalty = Mathf.Clamp(GenerationRan.GaussianFloat(0.7f, 0.3f), 0, 1);
                wealth  = Mathf.Clamp(GenerationRan.GaussianFloat(0.7f, 0.3f), 0, 1);
            }
            else if (rank == KingdomHierarchy.Knight || rank == KingdomHierarchy.Mayor)
            {
                loyalty = Mathf.Clamp(GenerationRan.GaussianFloat(0.7f, 0.4f), 0, 1);
                wealth  = Mathf.Clamp(GenerationRan.GaussianFloat(0.7f, 0.3f), 0, 1);
            }
            else if (rank == KingdomHierarchy.Citizen)
            {
                loyalty = Mathf.Clamp(GenerationRan.GaussianFloat(0.6f, 0.6f), 0, 1);
                wealth  = Mathf.Clamp(GenerationRan.GaussianFloat(0.5f, 0.3f), 0, 1);
            }
            else
            {
                loyalty = Mathf.Clamp(GenerationRan.GaussianFloat(0.5f, 0.5f), 0, 1);
                wealth  = Mathf.Clamp(GenerationRan.GaussianFloat(0.3f, 0.3f), 0, 1);
            }

            float kindness  = Mathf.Clamp(GenerationRan.GaussianFloat(0.6f, 0.4f), 0, 1);
            float agression = Mathf.Clamp(GenerationRan.GaussianFloat(0.6f, 0.4f), 0, 1);
            float greed     = Mathf.Clamp(GenerationRan.GaussianFloat(0.6f, 0.4f), 0, 1);

            EntityPersonality pers = new EntityPersonality(agression, kindness, loyalty, greed, wealth);
            npc.SetPersonality(pers);
        }
    }