Exemple #1
0
 public void Dying()
 {
     isDying = true;
     enemy_Animator.SetTrigger("Dying");
     Destroy(gameObject, 3f);
     playerUI.monsterCount--;
     if (playerUI.monsterCount == 0)
     {
         FinishPoint.allMonsters = true; FinishPoint.goalCheck.Add(true); finish.Finish();
     }
     playerUI._monsterCount.text = "x" + playerUI.monsterCount;
     playerUI.SetColorIcon(playerUI._monsters, 255, 255, 255, 255);
 }
Exemple #2
0
    private void Update()
    {
        if (isPickupItem && Input.GetKeyDown(KeyCode.E))
        {
            switch (gameObject.tag)
            {
            case "HealthPickup":
            {
                if (m_Player.CurrentHealth < m_Player.MaxHealth)
                {
                    m_Stats.AddHealth(m_Player.MaxHealth / 100 * precent);
                    m_Respawns.InActiveItem(gameObject.transform.parent.gameObject, m_Respawns.respawnPoints);
                }
                break;
            }

            case "EnergyPickup":
            {
                if (m_Player.CurrentEnergy < m_Player.MaxEnergy)
                {
                    m_Stats.AddEnergy(m_Player.MaxEnergy / 100 * precent);
                    m_Respawns.InActiveItem(gameObject.transform.parent.gameObject, m_Respawns.respawnPoints);
                }
                break;
            }

            case "CointPickup":
            {
                HuntLevelData.CoinCount += 1;
                playerUI.SetText(HuntLevelData.CoinCount, playerUI._coinCount);
                playerUI.SetColorIcon(playerUI._coinIcon, 255, 255, 255, 255);
                m_Respawns.InActiveItem(gameObject.transform.parent.gameObject, m_Respawns.respawnCurrencyPoints);
                break;
            }

            case "ChessPickup":
            {
                if (!isCoinChessClose)
                {
                    HuntLevelData.CoinChessCount += 1;
                    playerUI.SetText(HuntLevelData.CoinChessCount, playerUI._chessCount);
                    playerUI.SetColorIcon(playerUI._chessIcon, 255, 255, 255, 255);
                    gameObject.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("ChessClose");
                    isCoinChessClose = true;
                }
                break;
            }

            case "GoldKey":
            {
                FinishPoint.goldKey = true;
                if (FinishPoint.goldKey && FinishPoint.silverKey)
                {
                    FinishPoint.goalCheck.Add(true); finish.Finish();
                }
                playerUI.SetColorIcon(playerUI._goldeKey, 255, 255, 255, 255);
                m_Respawns.InActiveItem(gameObject.transform.parent.gameObject, m_Respawns.respawnKeyPoints);
                break;
            }

            case "SilverKey":
            {
                FinishPoint.silverKey = true;
                if (FinishPoint.goldKey && FinishPoint.silverKey)
                {
                    FinishPoint.goalCheck.Add(true); finish.Finish();
                }
                playerUI.SetColorIcon(playerUI._silverKey, 255, 255, 255, 255);
                m_Respawns.InActiveItem(gameObject.transform.parent.gameObject, m_Respawns.respawnKeyPoints);
                break;
            }

            case "ResourceItem":
            {
                HuntLevelData.ResourceCount++;
                playerUI.SetColorIcon(playerUI._resources, 255, 255, 255, 255);
                playerUI.SetText(HuntLevelData.ResourceCount, playerUI._resourcesCount);
                gameObject.transform.parent.gameObject.SetActive(false);
                break;
            }
            }
        }
    }