예제 #1
0
    public void Initialize(ScoreDisplay dest, int value)
    {
        Destination = dest;
        Value = value;

        _rect = GetComponent<RectTransform>();
        _destRect = Destination.GetComponent<RectTransform>();

        UIText.text = (value >= 0) ? "+" + value.ToString() : value.ToString();

        UIText.DOFade(0, ScoreManager.Instance.ScoreTextFadeDuration);

        _initialized = true;
    }
예제 #2
0
    public void Initialize(ScoreDisplay dest, int value)
    {
        Destination = dest;
        Value       = value;

        _rect     = GetComponent <RectTransform>();
        _destRect = Destination.GetComponent <RectTransform>();

        UIText.text = (value >= 0) ? "+" + value.ToString() : value.ToString();

        UIText.DOFade(0, ScoreManager.Instance.ScoreTextFadeDuration);

        _initialized = true;
    }
예제 #3
0
 public void RpcScores(int score)
 {
     //Co-op
     if (Mode == 2)
     {
         // Add to the shared score
         _controller.SharedScore.GetComponent <PlaceController>().Score += score;
     }
     // Versus
     else
     {
         // Add to personal score
         ScoreDisplay.GetComponent <PlaceController>().Score += score;
     }
 }
예제 #4
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();
    }
예제 #5
0
 //Set players colour and the colour of its score
 public void SetColour()
 {
     GetComponent <Renderer>().material = Materials[_colour];
     ScoreDisplay.GetComponent <PlaceController>().Offset = _colour * 10;
 }