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); }
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); } } }