private tileType[,] genTiles() { tileType[,] tiles = new tileType[size.x, size.y]; Simplex.Noise.Seed = rngSeed; float scale = 0.005f; float[,] noiseMap = Simplex.Noise.Calc2D(size.x, size.y, scale); vector2f range = getRange(noiseMap); for (int x = 0; x < size.x; x++) { for (int y = 0; y < size.y; y++) { tiles[x, y] = tileType.water; if (isInHeight(noiseMap[x, y], range.y, 0.75f)) { tiles[x, y] = tileType.sand; } if (isInHeight(noiseMap[x, y], range.y, 0.65f)) { tiles[x, y] = tileType.grass; } if (isInHeight(noiseMap[x, y], range.y, 0.05f)) { tiles[x, y] = tileType.stone; } } } return(tiles); }
public override bool Update(float delta) { if (!isAlive) { return(false); } if (IsTaken) { vector2f dv = owner.Position - pos; Direction = dv; speed = Math.Max(0f, (dv.Length - 5) * 1.5f); pos.X += speed * direction.X * delta; pos.Y += speed * direction.Y * delta; } return(isAlive); }
public static void Write(this BinaryWriter writer, vector2f vec2) { writer.Write(vec2.x); writer.Write(vec2.y); }
public MoveableGameObject(vector2f ps) : base(ps) { }
public GameObject(vector2f ps) { pos = ps; }
public RawMeat(vector2f ps) : base(ps) { }
public Item(vector2f ps) : base(ps) { }
public CookedMeat(vector2f ps) : base(ps) { }
public CookFactory(vector2f ps) : base(ps) { }
public Factory(vector2f ps) : base(ps) { }
public Buildings(vector2f ps) : base(ps) { }
/// <summary> /// Конструктор задачи. В качестве параметров передается сущность, выполняющая задачу и позиция, куда она должна прибыть. /// </summary> /// <param name="ex">юнит, выполняющий данную задачу</param> /// <param name="tar">вектор с координатами целевой позиции</param> public GoToTask(vector2f tar) : base() { TARGET_POS = tar; tasks = null; }