private void Actor_Spawn(object sender, SpawnEventArgs e) { Actor spawnedActor = (Actor)sender; if (e.spawnType == 1) { protagonist = spawnedActor; } else if (e.spawnType == 2) { ActionList behaviorList = new ActionList(spawnedActor); Neutral neutral = new Neutral(behaviorList, spawnedActor); behaviorList.pushFront(neutral); Alert alert = new Alert(behaviorList, spawnedActor, protagonist); behaviorList.pushFront(alert); behaviorLists[spawnedActor] = behaviorList; } //actors.Add(spawnedActor); }
private void Actor_Death(object sender, EventArgs e) { Actor victim = (Actor)sender; if (behaviorLists.ContainsKey(victim)) { behaviorLists.Remove(victim); } else if(victim.className == "player") { Aggravated aggravated = new Aggravated(null, null); Alert alert = new Alert(null, null); foreach(KeyValuePair<Actor, ActionList> entry in behaviorLists) { if (entry.Value.has(aggravated)) { entry.Value.remove(aggravated); } if (entry.Value.has(alert)) { entry.Value.remove(alert); } } } }