Exemple #1
0
    public float perlinAtPoint(MocVector3int point)
    {
        float xF = (((float)point.x + seed) / (float)chunkSize * scale);
        float yF = ((float)point.y / (float)chunkSize * scale);

        return(Mathf.PerlinNoise(xF, yF));
    }
Exemple #2
0
    public TileInfo GetTileInfoAtPoint(MocVector2int chunk, MocVector3int point)
    {
        float perlin = perlinAtPoint(point);

        if (!tileInfo[chunk].ContainsKey(point))
        {
            if (perlin < 0.35f)
            {
                TileInfo ti = new TileInfo
                {
                    isWater = true
                };
                tileInfo[chunk].Add(point, ti);
            }
            else if (perlin > 0.35f && perlin <= 0.4f)
            {
                TileInfo ti = new TileInfo
                {
                    isWalkableWater = true
                };
                tileInfo[chunk].Add(point, ti);
            }
            else if (perlin > 0.4f && perlin <= 0.8f)
            {
                TileInfo ti = new TileInfo
                {
                    isGrass = true
                };
                tileInfo[chunk].Add(point, ti);
            }
        }
        return(tileInfo[chunk][point]);
    }
Exemple #3
0
 void PlacePlayer()
 {
     playerPlacedDict = PersistentData.Instance.CurrentWorld.CharacterToWorldPos.ToDictionary(x => x.Key, x => x.Value);
     playerPlaced     = playerPlacedDict.ContainsKey(PersistentData.Instance.CurrentSave.saveObject.guid);
     if (playerPlaced)
     {
         MocVector3int temp = playerPlacedDict[PersistentData.Instance.CurrentSave.saveObject.guid];
         Vector3       pos  = new Vector3((float)temp.x, (float)temp.y, (float)temp.z);
         player.transform.position = pos;
     }
 }