示例#1
0
    public static PlayerHandler CreatePlayer()
    {
        Transform playerTransform = Instantiate(GameAssets.i.pfPlayerTransform, new Vector3(0, 0), Quaternion.identity);

        HealthSystem healthSystem = new HealthSystem(150 + (GameControl.control.lvl * 8));
        HealthBar    healthBar    = Instantiate(GameAssets.i.pfHealthBar, new Vector3(0, 1.5f), Quaternion.identity, playerTransform).GetComponent <HealthBar>();

        healthBar.Setup(healthSystem);

        ExperienceSystem experienceSystem = new ExperienceSystem(GameControl.control.tempXp);
        Transform        experienceBarObj = Instantiate(GameAssets.i.pfXpBar, new Vector3(0, 0), Quaternion.identity);
        ExperienceBar    experienceBar    = experienceBarObj.GetComponent <ExperienceBar>();

        experienceBarObj.SetParent(GameObject.Find("XpBarHolder").GetComponent <Transform>(), false);
        experienceBar.Setup(experienceSystem);

        PlayerHandler playerHandler = playerTransform.GetComponent <PlayerHandler>();

        playerHandler.Setup(healthSystem, experienceSystem);

        return(playerHandler);
    }
示例#2
0
 public void ExpSetup(Player player)
 {
     experienceBar.Setup(player.Stats_Component.Level, player.Stats_Component.Current_Xp);
 }