Exemplo n.º 1
0
    protected bool Move(int xDir, int yDir)
    {
        if (MoveProgressing == null)
        {
            BaseTile tempBaseTile = GetNeigbourInDirection(xDir, yDir);
            if (tempBaseTile == null)
            {
                return(false);
            }

            Vector3 TargetPosition = tempBaseTile.GetLocation();
            MoveProgressing = StartCoroutine(SmoothMovement(TargetPosition, MoveDuration));
            tile.RemovUnitOnTile(this);

            tile = tempBaseTile;
            tile.AddUnitOnTile(this);

            return(true);
        }
        return(false);
    }