public void Start()
 {
     if (!nameTagManager)
     {
         nameTagManager = FindObjectOfType <NameTagManager>();
     }
     this.nameTag            = nameTagManager.Add(this.transform);
     this.nameTag.Scale      = 0.1f;
     this.transform.rotation = Quaternion.Euler(0, 180, 0);
 }
Esempio n. 2
0
    public void SetPlayer(RavenNest.Models.Player player)
    {
        gameObject.name = player.Name;

        if (!gameManager)
        {
            gameManager = FindObjectOfType <GameManager>();
        }
        if (!playerAppearance)
        {
            playerAppearance = GetComponent <PlayerAppearance>();
        }
        if (playerAppearance)
        {
            playerAppearance.SetAppearance(player.Appearance);
        }

        UserId      = player.UserId;
        PlayerName  = player.Name;
        Stats       = new Skills(player.Skills);
        Resources   = player.Resources;
        Statistics  = player.Statistics;
        ExpOverTime = 1m; // P...

        Inventory.Create(player.InventoryItems, gameManager.Items.GetItems());

        lastSavedExperienceTotal = Stats.TotalExperience;

        // remove after all players have been fixed ;o or make a repository fixer or whatever.

        if (!nameTagManager)
        {
            nameTagManager = GameObject.Find("NameTags").GetComponent <NameTagManager>();
        }

        if (nameTagManager)
        {
            nameTagManager.Add(this);
        }

        Stats.Health.Reset();

        Inventory.EquipBestItems();
        Equipment.HideEquipments(); // don't show sword on join
    }