public void RemoveComponent(IAIComponent component)
 {
     if (AIComponents.Contains(component))
     {
         AIComponents.Remove(component);
     }
 }
 public void AddComponent(IAIComponent component)
 {
     if (!AIComponents.Contains(component))
     {
         AIComponents.Add(component);
     }
 }
Exemplo n.º 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;
            }
        }
Exemplo n.º 4
0
 public virtual void dispose()
 {
     unRegisterEvt();
     this._npcAIComponent = null;
     this._aiContext      = null;
     this._aiStateManager = null;
     this._host           = null;
 }
Exemplo n.º 5
0
 public BaseMonsterAIState(IAIComponent monsterAIComponent)
 {
     this._monsterAIComponent = monsterAIComponent;
     this._aiContext          = monsterAIComponent as IAIContext;
     this._aiStateManager     = monsterAIComponent as IAIStateManager;
     this._host = monsterAIComponent.host();
     init();
 }
Exemplo n.º 6
0
 public BaseNPCAIState(IAIComponent npcAIComponent)
 {
     this._npcAIComponent = npcAIComponent;
     this._aiContext      = npcAIComponent as IAIContext;
     this._aiStateManager = npcAIComponent as IAIStateManager;
     this._host           = npcAIComponent.host();
     init();
 }
Exemplo n.º 7
0
 public AIAttractedState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Exemplo n.º 8
0
 public DrowningState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Exemplo n.º 9
0
 public AIFreeState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Exemplo n.º 10
0
 public AIPreAttack(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Exemplo n.º 11
0
 public NPCFollowPlayerState(IAIComponent npcAIComponent)
     : base(npcAIComponent)
 {
 }
Exemplo n.º 12
0
 public AIRunAwayState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Exemplo n.º 13
0
 public AIAttackState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Exemplo n.º 14
0
 public AIBeHitState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Exemplo n.º 15
0
 public AIBreedState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
     _random    = new System.Random();
     _breedRate = DataManagerM.Instance.getMonsterDataManager().getBreedDate(_host).breedRate;
 }
Exemplo n.º 16
0
 public LodgedAttackState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Exemplo n.º 17
0
 public LodgedFreeState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Exemplo n.º 18
0
 public LodgedRoamState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Exemplo n.º 19
0
 public AIAimState(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Exemplo n.º 20
0
 public LodgedPreAttack(IAIComponent monsterAIComponent)
     : base(monsterAIComponent)
 {
 }
Exemplo n.º 21
0
 public NPCIdleState(IAIComponent npcAIComponent)
     : base(npcAIComponent)
 {
 }
Exemplo n.º 22
0
 public NPCRoamState(IAIComponent npcAIComponent)
     : base(npcAIComponent)
 {
 }