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