public bool Turn(Field.Tile target) { if (tile == null || target == null) { return(false); } if (target == tile.left) { direction = Field.Directions.LEFT; } else if (target == tile.right) { direction = Field.Directions.RIGHT; } else if (target == tile.up) { direction = Field.Directions.UP; } else if (target == tile.down) { direction = Field.Directions.DOWN; } else { return(false); } _face.UpdateDirectionView(direction); return(true); }
public void UpdateDirectionView(Field.Directions direction) { HideAll(); switch (direction) { case Field.Directions.UP: _bottomDir.Show(); break; case Field.Directions.DOWN: _topDir.Show(); break; case Field.Directions.LEFT: _leftDir.Show(); break; case Field.Directions.RIGHT: _rightDir.Show(); break; default: break; } }
public override bool MoveByDirection(Field.Directions direction) { var isValid = base.MoveByDirection(direction); if (uses_curtain && tile.type != Field.Tile.TileTypes.CURTAIN) { GlobalEventSystem.RaiseCurtainLeave(tile); } return(isValid); }
public virtual bool MoveByDirection(Field.Directions direction) { var isvalid = Move(direction); if (isvalid) { _SetPosition(tile.tileView.transform.position, true); } return(isvalid); }
public virtual bool ForceMoveByDirection(Field.Directions direction) { var isvalid = ForceMove(direction); _face.UpdateDirectionView(direction); if (isvalid) { _SetPosition(tile.tileView.transform.position, true); } return(isvalid); }
public override bool Move(Field.Directions direction) { if (movement_disabled) { this.direction = direction; return(false); } bool is_valid = base.Move(direction); if (is_valid) { FieldUpdate(); } return(is_valid); }
public virtual bool Move(Field.Directions direction) { //Debug.Log( "Move called by " + GetInstanceID() ); if (tile == null) { return(false); } Field.Tile target; switch (direction) { case Field.Directions.UP: target = tile.up; break; case Field.Directions.DOWN: target = tile.down; break; case Field.Directions.LEFT: target = tile.left; break; case Field.Directions.RIGHT: target = tile.right; break; default: target = null; break; } this.direction = direction; if (target != null) { if (this == GlobalDataHolder.player) { target.Activate(); } if ((target.passable) && target.unit == null) { //Debug.Log( "Moved from (" + tile.x.ToString() + ";" + tile.y.ToString() + ") to (" + target.x.ToString() + ";" + target.y.ToString() +")"); target.unit = this; tile.unit = null; tile = target; return(true); } } return(false); }
public virtual bool Move(Field.Directions direction) { if (tile == null) { return(false); } Field.Tile target; switch (direction) { case Field.Directions.UP: target = tile.up; break; case Field.Directions.DOWN: target = tile.down; break; case Field.Directions.LEFT: target = tile.left; break; case Field.Directions.RIGHT: target = tile.right; break; default: target = null; break; } this.direction = direction; if (target != null && target.unit == null) { if (target.type == Field.Tile.TileTypes.ROAD) { target.unit = this; tile.unit = null; tile = target; return(true); } else { Action(target); return(true); } } return(false); }
public Tile this[Field.Directions direction] { get { switch (direction) { case Field.Directions.UP: return(up); case Field.Directions.DOWN: return(down); case Field.Directions.LEFT: return(left); case Field.Directions.RIGHT: return(right); default: return(null); } } }