Exemplo n.º 1
0
    void GenerateAndPositionCellImage(Vector2Int position, float rotation, Sprite sprite, Color color)
    {
        GameObject instantiatedPathImage = ScenarioImageManager.GetOverlayImage(sprite, transform);

        instantiatedPathImage.transform.position = boardController.GetCellPosition(position);

        instantiatedPathImage.GetComponent <RectTransform>().rotation = Quaternion.Euler(new Vector3(0f, 0f, rotation));

        if (!drawingSelectedEntity)
        {
            color = new Color(color.r, color.g, color.b, deselectedEntityActionOpacity);
        }

        instantiatedPathImage.GetComponent <Image>().color = color;
    }
Exemplo n.º 2
0
    void DrawStagnation(ScenarioState state)
    {
        Clear();
        List <Vector2Int> stagnatedPositions = state.stagnatedPositions;

        for (int i = 0; i < stagnatedPositions.Count; i++)
        {
            GameObject instantiatedStagnationTile = ScenarioImageManager.GetStagnationTile(transform);
            instantiatedStagnationTile.transform.position = boardController.GetCellPosition(stagnatedPositions[i]);
        }

        List <Vector2Int> threateningPositions = state.threatenedStagnationPositions;

        for (int i = 0; i < threateningPositions.Count; i++)
        {
            GameObject instantiatedThreatenedImage = ScenarioImageManager.GetOverlayImage(threateningStagnationSprite, transform);
            instantiatedThreatenedImage.transform.position = boardController.GetCellPosition(threateningPositions[i]);
        }
    }
Exemplo n.º 3
0
    IEnumerator BlinkPositionAttackedIndicator(Vector2Int position)
    {
        Vector2    canvasPosition   = boardController.GetCellPosition(position);
        GameObject overlayIndicator = ScenarioImageManager.GetOverlayImage(attackedTileSprite, transform);

        overlayIndicator.transform.position = canvasPosition;

        Image overlayImage = overlayIndicator.GetComponent <Image>();

        overlayImage.color = clear;

        float blinkInTime  = positionAttackedBlinkTimer / 2f;
        float blinkOutTime = blinkInTime;
        float timeElapsed  = 0f;

        while (timeElapsed < blinkInTime)
        {
            float percentageComplete = timeElapsed / blinkInTime;
            overlayImage.color = Color.Lerp(clear, opaque, percentageComplete);
            timeElapsed       += Time.deltaTime;

            yield return(null);
        }

        timeElapsed = 0.0f;

        while (timeElapsed < blinkOutTime)
        {
            float percentageComplete = timeElapsed / blinkInTime;
            overlayImage.color = Color.Lerp(opaque, clear, percentageComplete);
            timeElapsed       += Time.deltaTime;

            yield return(null);
        }

        Destroy(overlayImage);
    }