Пример #1
0
    public override void PlaceGridObject(Vector2 gridCoordinates)
    {
        GridCoordinates         = gridCoordinates;
        ParentTile              = GridCoords.FromGridToTile(gridCoordinates);
        this.transform.position = GridCoords.FromGridToWorld(gridCoordinates);

        if (gridObjectPositionAdded != null)
        {
            gridObjectPositionAdded(this);
        }
    }
Пример #2
0
    public void Move(Vector2 gridCoords)
    {
        if (pickupCoroutine != null)
        {
            StopCoroutine(pickupCoroutine);
            pickupCoroutine = null;
        }

        //When MOVE command is called, it converts gridCoords to WorldCoords and sets isMoving to true
        displayedGridCoords = gridCoords;
        targetWorldCoords   = GridCoords.FromGridToWorld(gridCoords);
        isMoving            = true;
    }
Пример #3
0
    // Fonction qui permet de vérifier si une coordonnée donnée se trouve dans un point de déploiement
    public bool IsInDeployPoint(Vector2 gridCoords)
    {
        Vector2 worldCoords = GridCoords.FromGridToWorld(gridCoords);

        foreach (var deployPoint in _allDeployPoints)
        {
            if (deployPoint.IsInRadius(worldCoords))
            {
                return(true);
            }
        }

        return(false);
    }