Пример #1
0
 public GasCell(Tile _attachedTile)
 {
     gasVel = new Vector2(0, 0);
     NextGasVel = new Vector2(0, 0);
     lastSentGasses = new Dictionary<GasType, float>();
     gasMixture = new GasMixture();
     rand = new Random();
     attachedTile = _attachedTile;
 }
Пример #2
0
 private Rectangle TilePos(Tile T)
 {
     return new Rectangle((int)(T.WorldPosition.X), (int)(T.WorldPosition.Y), (int)(tileSpacing), (int)(tileSpacing));
 }
Пример #3
0
        private bool RemoveTile(Tile t)
        {
            if (t == null)
                return false;
            if (t.GetType().Name == "Wall")
            {
                _wallArray.Remove(t);
            }
            else
            {
                _groundArray.Remove(t);
            }

            return true;
        }
Пример #4
0
 private void AddTile(Tile t)
 {
     if (t.GetType().Name == "Wall")
     {
         _wallArray.Insert(t);
     }
     else
     {
         _groundArray.Insert(t);
     }
 }
Пример #5
0
        public void UpdateTile(Tile t)
        {
            if (t == null || t.gasCell == null)
                return;
            t.gasCell.SetNeighbours(this);

            foreach (Tile u in GetAllTilesIn(new RectangleF(t.WorldPosition.X - tileSpacing, t.WorldPosition.Y - tileSpacing, tileSpacing * 2, tileSpacing * 2)))
            {
                u.gasCell.SetNeighbours(this);
            }
        }
Пример #6
0
        public void AttachToTile(Vector2 tilePos)
        {
            var map = IoCManager.Resolve<IMapManager>();

            var currentTile = map.GetWallAt(tilePos) as Tile;

            if (currentTile == null) return;

            var previousTile = map.GetWallAt(Owner.GetComponent<TransformComponent>(ComponentFamily.Transform).Position) as Tile;

            previousTile.TileChange -= TileChanged;

            currentTile.TileChange += TileChanged;

            linkedTile = currentTile;
        }
Пример #7
0
        private void OnMove(object sender, VectorEventArgs args)
        {
            var map = IoCManager.Resolve<IMapManager>();

            var previousTile = map.GetWallAt(args.VectorFrom) as Tile;
            if(previousTile != null)
                previousTile.TileChange -= TileChanged;

            var currentTile = map.GetWallAt(args.VectorTo) as Tile;

            if (currentTile == null) return;

            currentTile.TileChange += TileChanged;

            linkedTile = currentTile;
        }
Пример #8
0
 public void AttachToTile(Tile t)
 {
     attachedTile = t;
 }