Ejemplo n.º 1
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        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);
                if (!victimBehaviorList.has(aggravated))
                {
                    victimBehaviorList.pushFront(aggravated);
                }
                Stunned stunned = new Stunned(victimBehaviorList, victim);
                if (!victimBehaviorList.has(stunned))
                {
                    victimBehaviorList.pushFront(stunned);
                }
            }
        }