Beispiel #1
0
    private void OnMouseDown()
    {
        if (canWalkTo)
        {
            if (currentStepingGameTool != null)
            {
                game.SetToolUI(currentStepingGameTool, currentStepingGameTool.GetComponentInParent <Loading>(), false);
            }
            game.SetToolUI(game.GetClickedTile().currentStepingGameTool, game.GetClickedTile().currentStepingGameTool.GetComponentInParent <Loading>(), false);
            game.MoveTo(GetComponent <Tile>());
        }
        else if (!canWalkTo && canBeClicked && game.GetClickedTile() != this)
        {
            if (gameToolResized)
            {
                currentStepingGameTool.gameObject.transform.localScale -= currentStepingGameTool.GetResizeFactor();
                gameToolResized = false;
            }

            game.SetClickedTile(GetComponent <Tile>());
            game.SetToolUI(currentStepingGameTool, currentStepingGameTool.GetComponentInParent <Loading>(), true);
        }
        else if (!canWalkTo && canBeClicked && game.GetClickedTile() == this)
        {
            game.ResetClickedTile();
            game.SetToolUI(currentStepingGameTool, currentStepingGameTool.GetComponentInParent <Loading>(), false);
        }
    }