Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        this.transform.position = GlobalVariables.spawnPos;

        GlobalVariables.globalObjects["player"] = this.gameObject;
        controller  = this.gameObject.GetComponent <CharacterMoverComponent>();
        meleeAttack = this.gameObject.GetComponent <CharacterMeleeComponent>();
        hud         = this.gameObject.GetComponent <PlayerHUDComponent>();
        vfx         = this.gameObject.GetComponent <PlayerVFXComponent>();
        level       = this.gameObject.GetComponent <CharacterLevelComponent>();
        animator    = this.gameObject.GetComponent <Animator>();
        animator.SetFloat("AnimSpeed", 1.0f);
        rangedAttack = GetComponent <CharacterRangedComponent>();
        health       = GetComponent <CharacterHealthComponent>();

        health.health    = PlayerStats.Health;
        health.maxHealth = PlayerStats.Maxhealth;
        hud.hasKey       = PlayerStats.HasKey;
        hud.hasNecklace  = PlayerStats.HasNecklace;
        level.XP         = PlayerStats.Xp;
        level.level      = PlayerStats.Level;
        level.levelUp    = PlayerStats.Levelup;

        hud.hasSword = PlayerStats.HasSword;
    }
Esempio n. 2
0
 private void Start()
 {
     player = GameObject.Find("Player");
     hud    = player.GetComponent <PlayerHUDComponent>();
     health = player.GetComponent <CharacterHealthComponent>();
     level  = player.GetComponent <CharacterLevelComponent>();
 }
Esempio n. 3
0
 private void OnCollisionEnter2D(Collision2D other)
 {
     HUD = other.collider.GetComponent <PlayerHUDComponent>();
     if (HUD != null && HUD.hasKey)
     {
         Destroy(gameObject);
     }
 }
Esempio n. 4
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        PlayerHUDComponent HUD = other.GetComponent <PlayerHUDComponent>();

        if (HUD == null)
        {
            return;
        }
        HUD.getNecklace();
        Destroy(gameObject);
    }
Esempio n. 5
0
    void Start()
    {
        Object cache;

        GlobalVariables.globalObjects.TryGetValue("player", out cache);

        if (cache != null)
        {
            player = (GameObject)cache;
        }
        HUD = player.GetComponent <PlayerHUDComponent>();
    }