Exemple #1
0
    void Update()
    {
        this.currentMoneyText.text = System.Math.Round(Player.getMoney(), 2) + " EUR"; // 0 EUR

        string connective = "in";

        switch (Configurations.Options.language)
        {
        case Configurations.Options.languages.ENGLISH:
            connective = "in";
            break;

        case Configurations.Options.languages.PORTUGUESE:
            connective = "em";
            break;

        case Configurations.Options.languages.SPANISH:
            connective = "en";
            break;

        default:
            connective = "in";
            break;
        }

        this.nextMoneyText.text =
            "+" + WalkingOptions.getGains() + " EUR " + connective + "\n" + Mathf.Round(WalkingOptions.getMustWalk() - Player.getCurrentWalking()) + "m"; // Next money in 0m

        this.nextMoneySlider.value = Player.getCurrentWalking() / WalkingOptions.getMustWalk();                                                           // Change slider value.
    }
Exemple #2
0
    void Update()
    {
        Vector2 updatedPosition = this.getCurrentPlayerPositionInRealWorld();

        this.verifyHackingActivation();

        if (
            this.lastRealWorldPlayerPosisiton.x != updatedPosition.x ||
            this.lastRealWorldPlayerPosisiton.y != updatedPosition.y
            )
        {
            float positionDifferenceInMeters = this.positionDifferenceInMeters(
                updatedPosition.x,
                updatedPosition.y,
                this.lastRealWorldPlayerPosisiton.x,
                this.lastRealWorldPlayerPosisiton.y
                );

            if (!float.IsNaN(positionDifferenceInMeters))
            {
                Player.setCurrentWalking(Player.getCurrentWalking() + positionDifferenceInMeters);
                Player.setTotalWalking(Player.getTotalWalking() + positionDifferenceInMeters);

                if (Player.getCurrentWalking() >= WalkingOptions.getMustWalk())
                {
                    Player.setMoney(Mathf.Clamp(Player.getMoney() + WalkingOptions.getGains(), 0, MAXIMUM_MONEY));

                    Player.setCurrentWalking(0); // Restart current walking.
                }
            }

            this.lastRealWorldPlayerPosisiton = updatedPosition;
        }
    }