Beispiel #1
0
    private void Die()
    {
        // Delete consider VV

        if (!alreadyKilled)
        {
            playerStats.AddGold(1);
            playerStats.GrantExperience(1);
            MonsterCount.AddMonsterCount(-1);
            MonsterCount.AddMonsterKilled(1);
            alreadyKilled = true;
        }

        Destroy(this.gameObject);
    }
Beispiel #2
0
    private void SpawnMonster()
    {
        spawnTimer -= Time.deltaTime;

        if (spawnTimer <= 0f)
        {
            int randomMonster = Random.Range(0, monsters.Length);

            GameObject monster = Instantiate(monsters[randomMonster], transform.position, Quaternion.identity);
            monster.transform.SetParent(MonsterParent.transform, true);

            // Delete VV
            MonsterCount.AddMonsterCount(1);
            ResetSpawnTimer();
        }
    }
Beispiel #3
0
    private void MoveToDestination()
    {
        transform.LookAt(DestinationPoint.transform.position);

        transform.position += transform.forward * movementSpeed * Time.deltaTime;

        if (Vector3.Distance(this.transform.position, DestinationPoint.transform.position) <= 2f)
        {
            // Delete VV
            if (!alreadyKilled)
            {
                MonsterCount.AddMonsterCount(-1);
                MonsterCount.AddMonsterKilled(1);
                alreadyKilled = true;
                Destroy(this.gameObject);
            }
        }
    }