Пример #1
0
 public override void FromXml(XmlElement element)
 {
     base.FromXml(element);
     chase  = GetElement(CHASE) as AbstractAi;
     flee   = GetElement(FLEE) as AbstractAi;
     wander = new NeutralBehavior(Being);
 }
Пример #2
0
 public HauntBehavior(Being being, Being oponent) : base(being)
 {
     this.Oponent = oponent;
     chase        = new ChaseBehavior(being, oponent);
     flee         = new FleeBehavior(being, oponent);
     wander       = new NeutralBehavior(being);
 }
Пример #3
0
 public override void FromXml(XmlElement element)
 {
     base.FromXml(element);
     walkableTerrain = GetStringAttribute(WALKABLE_TERRAIN);
     race            = GetStringAttribute(RACE);
     speed           = GetIntAttribute(SPEED) / 1000f;
     ai       = GetElement(AI) as AbstractAi;
     ai.Being = this;
 }
Пример #4
0
        public override void Create(XmlElement prototype)
        {
            base.Create(prototype);
            //
            maxHealth = health = int.Parse(prototype.Attributes[HEALTH].Value);
            attack    = int.Parse(prototype.Attributes[ATTACK].Value);
            defense   = int.Parse(prototype.Attributes[DEFENSE].Value);
            if (prototype.Attributes[CAN_OPEN_DOOR] != null)
            {
                canOpenDoor = bool.Parse(prototype.Attributes[CAN_OPEN_DOOR].Value);
            }
            //
            string aiTypeName     = prototype.Attributes[AI_TYPE_NAME].Value;
            string aiAssemblyName = prototype.Attributes[AI_ASSEMBLY_NAME].Value;

            Ai       = AbstractAi.LoadAi(aiTypeName, aiAssemblyName);
            Ai.Being = this;
        }