예제 #1
0
 void EndMoving()
 {
     eventAfterMove?.Invoke();
     eventAfterMove    = null;
     isMoving          = false;
     tile.movingEntity = null;
     tile = movable.CurrentTile;
     tile.movingEntity = this;
     EndTurn();
 }
예제 #2
0
    public void MoveTo(TileProperties to, Movable.OnMovableDelegate onEndMove)
    {
        var pathToTarget = AStarSearch.Path(tile, to, entitySO.availableTiles);

        if (pathToTarget != null && pathToTarget.Count >= 0)
        {
            TileProperties newTile = movable.MoveToward(pathToTarget, movingEntitySO.movementPoints, to.movingEntity != null);
            if (newTile)
            {
                tile.currentMovable = null;
                tile.movingEntity   = null;
                eventAfterMove      = onEndMove;

                tile = newTile;
                tile.movingEntity = this;
                isMoving          = true;
            }
            // TODO make end turn
        }
    }