コード例 #1
0
ファイル: fbWorld.cs プロジェクト: Koneke/Farbase
        public void SpawnStation(
            int owner,
            int id,
            int x,
            int y
            )
        {
            Station s = new Station(this);

            s.Owner    = owner;
            s.ID       = id;
            s.Position = new Vector2i(x, y);

            Map.At(x, y).Station = s;
            Map.Stations.Add(s.ID, s);

            if (!PlayerStations.ContainsKey(s.Owner))
            {
                PlayerStations.Add(s.Owner, new List <int>());
            }

            PlayerStations[s.Owner].Add(s.ID);
        }
コード例 #2
0
ファイル: fbWorld.cs プロジェクト: Koneke/Farbase
        public List <Tile> GetNeighbours()
        {
            List <Tile> neighbours = new List <Tile>();

            for (int x = -1; x < 1; x++)
            {
                for (int y = -1; y < 1; y++)
                {
                    if (!(x == 0 && y == 0))
                    {
                        Tile t = map.At(x, y);
                        if (t != null)
                        {
                            neighbours.Add(t);
                        }
                    }
                }
            }

            return(neighbours);
        }