Ejemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.gameObject.tag == "Player")
        {
            Debug.Log("Picked Up PowerUp");
            switch (PowerUpID)
            {
            case 0:
                if (P_Stats.P_Health < P_Stats.P_MaxHealth)
                {
                    P_Stats.P_Health += 500;
                    ScoreDisplay.ScoreUpdate(PowerUPVal);
                    Debug.Log("Healed 500 HP");
                    if (P_Stats.P_Health >= P_Stats.P_MaxHealth)
                    {
                        P_Stats.P_Health = P_Stats.P_MaxHealth;
                    }
                }
                else if (P_Stats.P_Health >= P_Stats.P_MaxHealth)
                {
                    Debug.Log("Full HP");
                }
                break;

            case 1:
                ScoreDisplay.ScoreUpdate(PowerUPVal);
                break;
            }
            Destroy(PowerUpParent);
        }
    }
 // Update is called once per frame
 void Update()
 {
     if (Health <= 0)
     {
         E_spawnScript.EnemyCount -= 1;
         DisplayScr.ScoreUpdate(ScoreVal);
         E_spawnScript = null;
         E_spawn       = null;
         Instantiate(deathFx, this.gameObject.transform.position, this.gameObject.transform.rotation);
         if (LootChance [LootID] >= LootRoll)
         {
             Instantiate(LootTable[LootID], this.gameObject.transform.position, this.gameObject.transform.rotation);
         }
         DestroyObject(E_Obj);
     }
 }