Ejemplo n.º 1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Ejemplo n.º 2
0
 public static void EnemyDie()
 {
     lock (Lock)
     {
         count--;
         Debug.Log(EnemyCounter.getCount());
     }
 }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        waves        = GetComponent <Waves>();
        mana         = GetComponent <Mana>();
        enemyCounter = GetComponent <EnemyCounter>();

        StartCoroutine("tutorial");
    }
Ejemplo n.º 4
0
    void Start()
    {
        mana    = GetComponent <Mana>();
        waves   = GetComponent <Waves>();
        enemies = GetComponent <EnemyCounter>();

        waves.StartCoroutine("spawnWaves");
    }
Ejemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        EnemyCounter script = room.GetComponent <EnemyCounter>();

        if (script.enemyCount == 0)
        {
            Destroy(gameObject);
        }
    }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     textyPoo     = FindObjectOfType <ManaText>();
     mana         = GameObject.FindGameObjectWithTag("SceneManager").GetComponent <Mana>();
     enemycounter = GameObject.FindGameObjectWithTag("SceneManager").GetComponent <EnemyCounter>();
     sm           = GameObject.FindGameObjectWithTag("SceneManager").GetComponent <SM_tower_defense>();
     nav          = GetComponent <EnemyNavigation>();
     enemycounter.register(gameObject);
 }
Ejemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        bow           = GameObject.FindGameObjectWithTag("Bow").GetComponent <ArrowShoot>();
        player        = GameObject.FindGameObjectWithTag("Player");
        arrowTeleport = transform.GetChild(0);
        enemyCounter  = GameObject.Find("Enemies").GetComponent <EnemyCounter>();

        effectLight.enabled = false;
    }
Ejemplo n.º 8
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (EnemyCounter.isTheLevelComplete())
     {
         if (collision.tag == "Player")
         {
             loader.GetComponent <levelLoder>().LoadNextLevel();
         }
     }
 }
Ejemplo n.º 9
0
    void Awake()
    {
        anim = GetComponent<Animator>();
        enemyAudio = GetComponent<AudioSource>();
        hitParticles = GetComponentInChildren<ParticleSystem>();
        capsuleCollider = GetComponent<CapsuleCollider>();
        counter = GameObject.Find("EnemyManager").GetComponent<EnemyCounter>();

        currentHealth = startingHealth;
    }
Ejemplo n.º 10
0
    void Start()
    {
        hearAnnouncements();
        announce("Press Enter to begin!");

        mana    = GetComponent <Mana>();
        waves   = GetComponent <Waves>();
        enemies = GetComponent <EnemyCounter>();

        displayMana();
        displayScore();

        Time.timeScale = 1;
    }
Ejemplo n.º 11
0
 private void Start()
 {
     if (m_Player == null)
     {
         m_Player = FindObjectOfType <Player>();
     }
     if (m_EnemyCounter == null)
     {
         m_EnemyCounter = FindObjectOfType <EnemyCounter>();
     }
     m_EnemyCounter.OnEnemyWavesChanged          += UpdateEnemyWaveTextField;
     m_EnemyCounter.OnActiveEnemiesChanged       += UpdateActiveEnemiesTextField;
     m_EnemyCounter.OnEnemyReinforcementsChanged += UpdateEnemyReinforcementTextField;
 }
Ejemplo n.º 12
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }


        foreach (var o in enemyGobjs)
        {
            allEnemies.Add(o.GetComponent <IEnemy>());
        }

        Debug.Log($"敵人數: {allEnemies.Count}");
    }
Ejemplo n.º 13
0
    public void DeathSequence()
    {
        //-----GET VALUE FROM STORAGE COMPONENT
        EnemyValue enemyValue = GetComponent <EnemyValue>();

        //-----INCREMENT SCORE
        ProgressTracker.IncrementScore(enemyValue.scoreValue);

        //-----ADD COINS
        if (enemyValue.coinValue > 0)
        {
            ProgressTracker.IncrementCoins(enemyValue.coinValue);
        }

        //-----STOP ALLIGNING WITH SLOT
        GetComponent <EnemyMovement>().StopAllignment();

        //-----GET & FREE PREVIOUS SLOT
        Utils.Directions occupiedSlotDirection = transform.parent.transform.GetComponent <TrackSlotFinal>().GetDirection();
        transform.parent.transform.GetComponent <TrackSlot>().FreeSlot();

        //-----DECREMENT ENEMY COUNT
        EnemyCounter.DecrementCounter();

        //-----INCREMENT CHARGING SPEED
        EnemyValue.IncrementCharge();

        //-----DECREMENT SPAWN COOLDOWN
        EnemySpawnCoordinator.DecrementSpawnCooldown();

        //-----INCREMENT ATTACK MUSIC PITCH
        FindObjectOfType <MusicController>().IncrementPitch();

        //-----PLAY ANIMATION
        GetComponent <EnemyDeathAnimator>().PlayDeathAnimation(occupiedSlotDirection);

        //-----PLAY DEATH SFX
        GetComponent <EnemyAudioController>().PlayEnemyDeathSFX();

        //-----SHAKE CAMERA
        Camera.main.GetComponent <CameraShaker>().ShakeCam(cameraShakeDuration, cameraShakeMagnitude);
    }