コード例 #1
0
ファイル: Road.cs プロジェクト: sleepy-monax/MakerRiseProjet
        public override void Apply(int[,] _Grid, System.Drawing.Bitmap _Bitmap, WorldScene _World)
        {
            foreach (KeyValuePair <int, World.Obj.ObjRegion> i in _World.Region)
            {
                foreach (KeyValuePair <int, World.Obj.ObjRegion> si in _World.Region)
                {
                    World.Obj.ObjRegion r1 = i.Value;
                    World.Obj.ObjRegion r2 = si.Value;



                    if (r1.Origine.ToPoint().X < r2.Origine.ToPoint().X)
                    {
                        if (Math.Abs(GameMath.Utils.distance(r1.Origine.ToPoint(), r2.Origine.ToPoint())) < RoadMaxLenght)
                        {
                            drawRoad(r1.Origine.ToPoint(), r2.Origine.ToPoint(), _World, _Grid, _Bitmap);
                        }
                    }
                    else
                    {
                        if (Math.Abs(GameMath.Utils.distance(r2.Origine.ToPoint(), r1.Origine.ToPoint())) < RoadMaxLenght)
                        {
                            drawRoad(r2.Origine.ToPoint(), r1.Origine.ToPoint(), _World, _Grid, _Bitmap);
                        }
                    }
                }
            }
        }
コード例 #2
0
        public void GenerateRegion(int ID, WorldLocation Location, World.WorldScene NewWorld, Random rnd)
        {
            World.Obj.ObjRegion NewRegion = new World.Obj.ObjRegion();
            NewRegion.Name    = "Region_" + ID;
            NewRegion.Origine = Location;
            NewRegion.BiomeID = rnd.Next(GameObjectsManager.Biomes.Count);
            NewRegion.Color   = new Color(rnd.Next(256), rnd.Next(256), rnd.Next(256));


            NewWorld.Region.Add(ID, NewRegion);
        }