Beispiel #1
0
        public Mob(ContentManager content, Vector2 position, CharactersInRange charactersInRange, OnDeath onDeath, CollisionCheck collisionCheck, String monsterName)
            : base(content, position, SPEED, charactersInRange, onDeath, Constants.DEFAULT_HEALTH)
        {
            StaticDrawable2D character = getCharacterSprite(content, position, monsterName);

            base.init(character);

            BehaviourFinished idleCallback = delegate() {
                swapBehaviours(this.idleBehaviour, State.Idle);
            };
            BehaviourFinished restartPathing = delegate() {
#if DEBUG
                Debug.log("Restarting");
#endif
                //this.activeBehaviour.Target = this.LastKnownLocation;
                pathToWaypoint(this.LastKnownLocation);
            };

            this.seekingBehaviour    = new Tracking(position, SPEED, idleCallback, collisionCheck);
            this.lostTargetBehaviour = new LostTarget(this.seekingBehaviour.Position, this.seekingBehaviour.Position, SPEED, idleCallback);
            this.pathingBehaviour    = new Pathing(position, SPEED, idleCallback, collisionCheck, restartPathing);
            this.idleBehaviour       = new IdleBehaviour(position);
            this.activeBehaviour     = this.idleBehaviour;
            this.CurrentState        = State.Idle;
            updateBoundingSphere();
            this.previousPoint     = base.Position.toPoint();
            this.LastKnownLocation = base.Position;

            this.skills       = new List <Skill>();
            this.explosionSfx = LoadingUtils.load <SoundEffect>(content, "CorpseExplosion");
            initSkills();
        }
Beispiel #2
0
 public Tracking(Vector2 startingPosition, float speed, BehaviourFinished callback, CollisionCheck collisionCheck)
 {
     this.Position       = startingPosition;
     this.Target         = this.Position;
     this.SPEED          = speed;
     this.callback       = callback;
     this.collisionCheck = collisionCheck;
 }
 public Pathing(Vector2 startingPosition, float speed, BehaviourFinished callback, CollisionCheck collisionCheck, BehaviourFinished restartPathing)
 {
     this.SPEED          = speed;
     this.targets        = new Stack <Vector2>();
     this.Position       = startingPosition;
     this.callback       = callback;
     this.collisionCheck = collisionCheck;
     this.restartPathing = restartPathing;
 }
 public LostTarget(Vector2 startingPosition, Vector2 lastKnownPosition, float speed, BehaviourFinished callback)
     : base(startingPosition, speed, callback, null)
 {
     this.Target = lastKnownPosition;
 }