예제 #1
0
    // Update is called once per frame
    void Update()
    {
        NewPoint();

        if (Score > 0)
        {
            Time.timeScale = 1f;
            TimeLeft      -= Time.deltaTime;
            float Display = Mathf.Round(TimeLeft);
            //TimeLeft = (float)Math.Round(TimeLeft, 2);
            Timer.GetComponent <TextMeshProUGUI>().text = Display.ToString();
        }

        if (TimeLeft <= 0.0f)
        {
            Time.timeScale = 0f;
            GameDisplay.SetActive(false);
            ScoreDisplay.SetActive(true);
            ScoreObject.GetComponent <TextMeshProUGUI>().text = "Score: " + Score;
            if (!adShown)
            {
                Advertisement.Show();
                adShown = true;
            }
        }
    }
예제 #2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        // If the user is the server tell all other users what colour this player should be
        if (isServer)
        {
            RpcColour(_colour);
        }
        // Versus
        if (Mode == 1)
        {
            // Show individual score and hide player marker
            ScoreDisplay.SetActive(true);
            Marker.SetActive(false);
        }
        // Single Player / CO-OP
        else
        {
            // Hide individual score and show player marker
            // There is only 1 score at the top of the screen for these game modes
            ScoreDisplay.SetActive(false);
            Marker.SetActive(true);
            Marker.GetComponent <SpriteRenderer>().sprite = MarkerSprites[_colour];
        }
        // Get the players score and health
        Score  = ScoreDisplay.GetComponent <PlaceController>().Score;
        Health = Hearts.GetComponent <HeartController>().Health;
        // Players are continuously spinning
        transform.localEulerAngles = new Vector3(0.0f, 0.0f, transform.localEulerAngles.z - 2.0f);

        // If a player recently took damage it becomes invincible for a while
        Invinc();
        // If the player has died or is not in the game hide them
        OutOfTheWay();

        // If this is not the local player ignore the rest of the script
        if (!isLocalPlayer && !_controller.SinglePlayer)
        {
            return;
        }
        // Is the player a server or client. If both then just server is true
        Server = isServer;
        Client = isClient && !Server;

        // Move the player
        Move();
    }