예제 #1
0
 // Start is called before the first frame update
 void Start()
 {
     the_player_health = FindObjectOfType <Player_health>();
     //set the stats for the level 1 player
     current_hp      = hp_levelup[1];
     current_attack  = attack_levelup[1] + bonus_attack;
     current_defense = attack_levelup[1] + bonus_defense;
 }
예제 #2
0
    // Start is called before the first frame update
    void Start()
    {
        player_health = FindObjectOfType <Player_health>();
        player_stats  = FindObjectOfType <Player_stats>();

        player_health.Restart();
        player_stats.Restart();
    }
예제 #3
0
    void Start()
    {
        navagent    = GetComponent <NavMeshAgent>();
        My_animator = GetComponent <Animator>();
        navagent.stoppingDistance = stopingDistance;
        AttackCoolDown            = Time.time;

        playerhealth = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_health>();
    }
예제 #4
0
    // Start is called before the first frame update
    void Start()
    {
        if (!UI_Exist)
        {
            UI_Exist = true;
            DontDestroyOnLoad(transform.gameObject);
            player_health = FindObjectOfType <Player_health>();
        }
        else
        {
            Destroy(gameObject);
        }

        player_stats = GetComponent <Player_stats>();
    }
예제 #5
0
    // Start is called before the first frame update
    void Start()
    {
        the_player_stats  = FindObjectOfType <Player_stats>();
        the_player_health = FindObjectOfType <Player_health>();

        //start indexing everything
        //set everything to zero

        for (int i = 0; i < items.Length; i++)
        {
            switch (items[i].item_name)
            {
            case "sword":
                sword_index       = i;
                items[i].quantity = 0;
                break;

            case "shield":
                shield_index      = i;
                items[i].quantity = 0;

                break;

            case "health_potion":
                health_potion_index = i;
                items[i].quantity   = 0;

                break;

            case "berry":
                berry_index       = i;
                items[i].quantity = 0;

                break;

            case "mana_potion":
                mana_potion_index = i;
                items[i].quantity = 0;

                break;
            }
        }
    }
예제 #6
0
    void FindLes()
    {
        found_players = true;
        player        = GameObject.Find("Players");

        if (picked_les)
        {
            player_child = player.transform.GetChild(0).gameObject;
            player_child.SetActive(true);
        }
        else if (picked_sleepy)
        {
            player_child = player.transform.GetChild(1).gameObject;
            player_child.SetActive(true);
        }
        else if (picked_angry)
        {
            player_child = player.transform.GetChild(2).gameObject;
            player_child.SetActive(true);
        }

        //finds parent object, need to find child and then be able to grab child component
        ph = player_child.GetComponent <Player_health>();
    }
예제 #7
0
 private void Start()
 {
     health = this.gameObject.GetComponent <Player_health>();
 }
예제 #8
0
 // Use this for initialization
 void Start()
 {
     health         = _playerObject.gameObject.GetComponent <Player_health>();
     Bar.fillAmount = health.Health;
 }
예제 #9
0
 private void Start()
 {
     ph = GetComponent <Player_health>();
 }