public void RemoveComponent(IAIComponent component)
 {
     if (AIComponents.Contains(component))
     {
         AIComponents.Remove(component);
     }
 }
 public void AddComponent(IAIComponent component)
 {
     if (!AIComponents.Contains(component))
     {
         AIComponents.Add(component);
     }
 }
Example #3
0
        public Enemy(World world, EnemyData data)
            : base(world)
        {
            _isAction = false;
            _sightRadius = data.SightRadius;

            this.Texture = data.Texture;
            this.Velocity = data.Velocity;

            this.AnimatedSprites = data.DeepCopySprites;
            this._idleComponent = data.IdleComponent.Clone();
            this._decisionComponent = data.DecisionComponent.Clone();
            this._actionComponents = data.DeepCopyActionComponents;

            this.LeftCollisionOffset = data.LeftCollisionOffset;
            this.RightCollisionOffset = data.RightCollisionOffset;
            this.TopCollisionOffset = data.TopCollisionOffset;
            this.BottomCollisionOffset = data.BottomCollisionOffset;
            this._health = new AttributePair(data.Health);

            this.AnimatedSprites.First().Value.IsAnimating = true;

            _healthTexture = world.Game.Content.Load<Texture2D>(@"Gui/EnemyHealthBar");

            String[] color = data.Color.Split(',');
            if(color.Length == 3)
                _tintColor = new Color(int.Parse(color[0]), int.Parse(color[1]), int.Parse(color[2]));

            foreach (AnimatedSprite sprite in AnimatedSprites.Values)
            {
                sprite.TintColor = _tintColor;
            }
        }
 public virtual void dispose()
 {
     unRegisterEvt();
     this._npcAIComponent = null;
     this._aiContext      = null;
     this._aiStateManager = null;
     this._host           = null;
 }
 public BaseMonsterAIState(IAIComponent monsterAIComponent)
 {
     this._monsterAIComponent = monsterAIComponent;
     this._aiContext          = monsterAIComponent as IAIContext;
     this._aiStateManager     = monsterAIComponent as IAIStateManager;
     this._host = monsterAIComponent.host();
     init();
 }
 public BaseNPCAIState(IAIComponent npcAIComponent)
 {
     this._npcAIComponent = npcAIComponent;
     this._aiContext      = npcAIComponent as IAIContext;
     this._aiStateManager = npcAIComponent as IAIStateManager;
     this._host           = npcAIComponent.host();
     init();
 }
 public AIAttractedState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Example #8
0
 public DrowningState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Example #9
0
 public AIFreeState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Example #10
0
 public AIPreAttack(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Example #11
0
 public NPCFollowPlayerState(IAIComponent npcAIComponent)
     : base(npcAIComponent)
 {
 }
Example #12
0
 public AIRunAwayState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Example #13
0
 public AIAttackState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Example #14
0
 public AIBeHitState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Example #15
0
 public AIBreedState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
     _random    = new System.Random();
     _breedRate = DataManagerM.Instance.getMonsterDataManager().getBreedDate(_host).breedRate;
 }
 public LodgedAttackState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Example #17
0
 public LodgedFreeState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Example #18
0
 public LodgedRoamState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Example #19
0
 public AIAimState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
 public LodgedPreAttack(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Example #21
0
 public NPCIdleState(IAIComponent npcAIComponent)
     : base(npcAIComponent)
 {
 }
Example #22
0
 public NPCRoamState(IAIComponent npcAIComponent)
     : base(npcAIComponent)
 {
 }