private void Actor_Hurt(object sender, AttackEventArgs attackArgs) { Actor victim = (Actor) sender; if (behaviorLists.ContainsKey(victim)) { ActionList victimBehaviorList = behaviorLists[victim]; Aggravated aggravated = new Aggravated(victimBehaviorList, victim, attackArgs.damageInfo.attacker); Stunned stunned = new Stunned(victimBehaviorList, victim); if (!victimBehaviorList.has(aggravated) && !victimBehaviorList.has(stunned)) victimBehaviorList.pushFront(aggravated); if (!victimBehaviorList.has(stunned)) victimBehaviorList.pushFront(stunned); } }
override public void update(float dt) { if (world.isInSight(owner, target.hitBox.Center)) { ownerList.endAll(); //Follow follow = new Follow(enemy.behaviorList, enemy, protagonist); //if (!enemy.behaviorList.has(follow)) // enemy.behaviorList.pushFront(follow); Aggravated aggravated = new Aggravated(ownerList, owner, target); if (!ownerList.has(aggravated)) ownerList.pushFront(aggravated); //Follow follow = new Follow(ownerList, owner, target, world); //if (!owner.behaviorList.has(follow)) // owner.behaviorList.pushFront(follow); //onEnd(); } }
override public void update(float dt) { if (owner.world.isInSight(owner, target.hitBox.Center)) { ownerList.endAll(); //Follow follow = new Follow(enemy.behaviorList, enemy, protagonist); //if (!enemy.behaviorList.has(follow)) // enemy.behaviorList.pushFront(follow); Aggravated aggravated = new Aggravated(ownerList, owner, target); if (!ownerList.has(aggravated)) { ownerList.pushFront(aggravated); } //Follow follow = new Follow(ownerList, owner, target, world); //if (!owner.behaviorList.has(follow)) // owner.behaviorList.pushFront(follow); //onEnd(); } }
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); } } } }