void Awake()
 {
     gameManager      = GetComponent <GameMamager>();
     enemyPrefab      = gameManager.enemyPrefab;
     enemySpawnPoints = null;
     enemySpawnPoints = GameObject.FindGameObjectsWithTag("EnemySpawnPoint");
 }
Beispiel #2
0
    void Start()
    {
        bulletRenderer  = GetComponent <MeshRenderer>();
        gameManager     = gameManagerObject.GetComponent <GameMamager>();
        playerCharacter = GameObject.FindGameObjectWithTag("Player");
        gunTrans        = playerCharacter.GetComponentInChildren <GunController>();
        swordTrans      = playerCharacter.GetComponentInChildren <SwordController>();

        InvokeRepeating("hitPlayer", 3, 1);
    }
Beispiel #3
0
    void Update()
    {
        if (!isGameRunning)
        {
            return;
        }

        if (!isPlayerDead && playerLife <= 0f)
        {
            gameManager  = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameMamager>();
            isPlayerDead = true;
            gameManager.playerDead();
            // Destroy(gameObject);
            HUD.SetActive(false);
            return;
        }

        float percentLife = playerLife / playerLifeMax;

        healthBar.value = percentLife;
    }
Beispiel #4
0
 void Start()
 {
     hitsToExplode = Random.Range(5, 11);
     gameManager   = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameMamager>();
 }