Ejemplo n.º 1
0
    private void ChangeMyHudHealth(float aHealthPercentage, string aHealthText, int aShieldValue)
    {
        if (!hasAuthority)
        {
            return;
        }

        myCharacterHUD.SetHealthBarFillAmount(aHealthPercentage);
        myCharacterHUD.SetHealthText(aHealthText);
        myCharacterHUD.SetShieldBar(aShieldValue, myHealth.myCurrentHealth);
    }
Ejemplo n.º 2
0
    public void SetFriendHud(PlayerList someConnectedPlayers)
    {
        if (!isLocalPlayer)
        {
            return;
        }

        myFriendList.Clear();
        foreach (Transform child in myFriendList.gameObject.transform)
        {
            CmdUnsubscribe(child.gameObject);
            Destroy(child.gameObject);
        }


        for (int index = 0; index < someConnectedPlayers.Count; index++)
        {
            if (someConnectedPlayers[index].netId == myCharacter.GetComponent <NetworkIdentity>().netId)
            {
                continue;
            }

            GameObject player = ClientScene.FindLocalObject(someConnectedPlayers[index].netId);

            GameObject friend = Instantiate(myFriendList.myFriendlistHudPrefab, myFriendList.transform);
            friend.GetComponent <FriendHud>().SetCharacter(player);
            friend.GetComponent <FriendHud>().SetParent(myCharacter.GetComponent <PlayerCharacter>());

            PlayerCharacter playerCharacter = player.GetComponent <PlayerCharacter>();
            CharacterHUD    hud             = friend.GetComponent <CharacterHUD>();
            hud.SetName(playerCharacter.Name);
            hud.SetHealthBarFillAmount(player.GetComponent <Health>().GetHealthPercentage());
            myFriendList.AddHud(hud, someConnectedPlayers[index].netId, myCharacter.GetComponent <PlayerCharacter>().Name);

            CmdSubscribe(player);
        }
    }
Ejemplo n.º 3
0
 private void ChangeTargetHudHealth(float aHealthPercentage, string aHealthText, int aShieldValue)
 {
     myTargetHUD.SetHealthBarFillAmount(aHealthPercentage);
     myTargetHUD.SetHealthText(aHealthText);
     myTargetHUD.SetShieldBar(aShieldValue, myTarget.GetComponent <Health>().myCurrentHealth);
 }