/* * Destroys the agent, and rewards the player with points! Also adds a referece of the kill to the directors 'kills' list * and totalKills variables. Additionaly, instantiates GameObjects to play a death sound, and particle affect */ void Die() { dead = true; Instantiate(onDeathSound); Instantiate(deathSplatter, transform.position, transform.rotation); Destroy(gameObject); director.AddScore(scoreReward); director.AddKill(); }
void Start() { refs = GameObject.Find(RefName).GetComponent <PrefabReferences>(); var directorGo = GameObject.Find(DirectorName); if (directorGo != null) { director = directorGo.GetComponent <Director>(); director.AddScore(this.Faction); } }