Ejemplo n.º 1
0
        public EnemyEntity(EggGameScreen gameScreen, Clip clip,
            Vector2 position, Vector2 scale, float rotation)
            : base(gameScreen, clip, position, scale, rotation, PHYSICS_OFFSET, PHYSICS_RADIUS)
        {
            // Calculate what entity type to attack.
            CurrentState = State.WanderAimless;
            MovementSpeed = SLOW_SPEED;
            EntityType = Type.Enemy;
            HitPlayer = false;
            HitEgg = false;

            DynamicBody.OnCollision += CollisionHandler;
            FindNearestTarget();

            _animations[new AnimKey(AnimState.Walk, AnimationDirection.Left)] = clip.AnimSet["walk-left"];
            _animations[new AnimKey(AnimState.Walk, AnimationDirection.Right)] = clip.AnimSet["walk-right"];
            _animations[new AnimKey(AnimState.Walk, AnimationDirection.Up)] = clip.AnimSet["walk-up"];
            _animations[new AnimKey(AnimState.Walk, AnimationDirection.Down)] = clip.AnimSet["walk-down"];

            _animations[new AnimKey(AnimState.Sucked, AnimationDirection.Left)] = clip.AnimSet["sucked-right"];
            _animations[new AnimKey(AnimState.Sucked, AnimationDirection.Right)] = clip.AnimSet["sucked-left"];
            _animations[new AnimKey(AnimState.Sucked, AnimationDirection.Up)] = clip.AnimSet["sucked-down"];
            _animations[new AnimKey(AnimState.Sucked, AnimationDirection.Down)] = clip.AnimSet["sucked-up"];

            PlayNewEnemyAnimation();
        }
Ejemplo n.º 2
0
        public EnemyEntity(EggGameScreen gameScreen, Clip clip,
                           Vector2 position, Vector2 scale, float rotation)
            : base(gameScreen, clip, position, scale, rotation, PHYSICS_OFFSET, PHYSICS_RADIUS)
        {
            // Calculate what entity type to attack.
            CurrentState  = State.WanderAimless;
            MovementSpeed = SLOW_SPEED;
            EntityType    = Type.Enemy;
            HitPlayer     = false;
            HitEgg        = false;


            DynamicBody.OnCollision += CollisionHandler;
            FindNearestTarget();

            _animations[new AnimKey(AnimState.Walk, AnimationDirection.Left)]  = clip.AnimSet["walk-left"];
            _animations[new AnimKey(AnimState.Walk, AnimationDirection.Right)] = clip.AnimSet["walk-right"];
            _animations[new AnimKey(AnimState.Walk, AnimationDirection.Up)]    = clip.AnimSet["walk-up"];
            _animations[new AnimKey(AnimState.Walk, AnimationDirection.Down)]  = clip.AnimSet["walk-down"];

            _animations[new AnimKey(AnimState.Sucked, AnimationDirection.Left)]  = clip.AnimSet["sucked-right"];
            _animations[new AnimKey(AnimState.Sucked, AnimationDirection.Right)] = clip.AnimSet["sucked-left"];
            _animations[new AnimKey(AnimState.Sucked, AnimationDirection.Up)]    = clip.AnimSet["sucked-down"];
            _animations[new AnimKey(AnimState.Sucked, AnimationDirection.Down)]  = clip.AnimSet["sucked-up"];

            PlayNewEnemyAnimation();
        }
Ejemplo n.º 3
0
        // TODO: refactor this to use the content manager for retrieving
        // different enemy types ..
        public EnemySpawner(EggGameScreen gameScreen, Clip clip)
        {
            _gameScreen            = gameScreen;
            _secondsSinceLastSpawn = 0f;
            _minDistFromPlayer     = 10f;
            _clip = clip;

            // spawn every 5sec
            SpawnInterval = 5f;
        }
Ejemplo n.º 4
0
        // TODO: refactor this to use the content manager for retrieving
        // different enemy types ..
        public EnemySpawner(EggGameScreen gameScreen, Clip clip)
        {
            _gameScreen = gameScreen;
            _secondsSinceLastSpawn = 0f;
            _minDistFromPlayer = 10f;
            _clip = clip;

            // spawn every 5sec
            SpawnInterval = 5f;
        }
Ejemplo n.º 5
0
        public CharacterEntity(EggGameScreen gameScreen, Clip clip,
            Vector2 position, Vector2 scale, float rotation, Vector2 physicsOffset, float physicsRadius)
        {
            ClipInstance = new ClipInstance(clip);
            GameScreen = gameScreen;
            Position = position; Scale = scale; Rotation = rotation;
            _physicsRadius = physicsRadius;
            _physicsOffset = physicsOffset;
            IsValid = true;

            SetupDynamics();
        }
Ejemplo n.º 6
0
        public CharacterEntity(EggGameScreen gameScreen, Clip clip,
                               Vector2 position, Vector2 scale, float rotation, Vector2 physicsOffset, float physicsRadius)
        {
            ClipInstance   = new ClipInstance(clip);
            GameScreen     = gameScreen;
            Position       = position; Scale = scale; Rotation = rotation;
            _physicsRadius = physicsRadius;
            _physicsOffset = physicsOffset;
            IsValid        = true;

            SetupDynamics();
        }
Ejemplo n.º 7
0
        public EggEntity(EggGameScreen gameScreen, Clip clip,
                         Vector2 position, Vector2 scale, float rotation)
            : base(gameScreen, clip, position, scale, rotation, PHYSICS_OFFSET, PHYSICS_RADIUS)
        {
            _clip = clip;

            EntityType   = Type.Egg;
            CurrentState = State.Idle;

            InitialiseAnimations();
            PlayNewEggAnimation();

            _sfxExplode = gameScreen.Content.Load <SoundEffect>("Sounds/Explode 1");
        }
Ejemplo n.º 8
0
        public PlayerEntity(EggGameScreen gameScreen, Clip clip,
                            Vector2 position, Vector2 scale, float rotation)
            : base(gameScreen, clip, position, scale, rotation, PHYSICS_OFFSET, PHYSICS_RADIUS)
        {
            EntityType = Type.Player;

            _animDirection = AnimationDirection.Right;

            LoadSounds(gameScreen.Content);

            SetupAnimations(clip);

            SwitchToMoving();
        }
Ejemplo n.º 9
0
        public EggEntity(EggGameScreen gameScreen, Clip clip,
            Vector2 position, Vector2 scale, float rotation)
            : base(gameScreen, clip, position, scale, rotation, PHYSICS_OFFSET, PHYSICS_RADIUS)
        {
            _clip = clip;

            EntityType = Type.Egg;
            CurrentState = State.Idle;

            InitialiseAnimations();
            PlayNewEggAnimation();

            _sfxExplode = gameScreen.Content.Load<SoundEffect>("Sounds/Explode 1");
        }
Ejemplo n.º 10
0
        public PlayerEntity(EggGameScreen gameScreen, Clip clip,
            Vector2 position, Vector2 scale, float rotation)
            : base(gameScreen, clip, position, scale, rotation, PHYSICS_OFFSET, PHYSICS_RADIUS)
        {
            EntityType = Type.Player;

            _animDirection = AnimationDirection.Right;

            LoadSounds(gameScreen.Content);

            SetupAnimations(clip);

            SwitchToMoving();
        }
Ejemplo n.º 11
0
 public EnemyEntity(EggGameScreen gameScreen, Clip clip, Vector2 position,
                    Vector2 scale)
     : this(gameScreen, clip, position, scale, 0.0f)
 {
 }
Ejemplo n.º 12
0
 public EnemyEntity(EggGameScreen gameScreen, Clip clip, Vector2 position)
     : this(gameScreen, clip, position, new Vector2(1f), 0.0f)
 {
 }
Ejemplo n.º 13
0
 public EnemyEntity(EggGameScreen gameScreen, Clip clip)
     : this(gameScreen, clip, new Vector2(), new Vector2(1f), 0.0f)
 {
 }
Ejemplo n.º 14
0
 public PlayerEntity(EggGameScreen gameScreen, Clip clip, Vector2 position,
     Vector2 scale)
     : this(gameScreen, clip, position, scale, 0.0f)
 {
 }
Ejemplo n.º 15
0
 public PlayerEntity(EggGameScreen gameScreen, Clip clip, Vector2 position)
     : this(gameScreen, clip, position, new Vector2(1f), 0.0f)
 {
 }
Ejemplo n.º 16
0
 public PlayerEntity(EggGameScreen gameScreen, Clip clip)
     : this(gameScreen, clip, new Vector2(), new Vector2(1f), 0.0f)
 {
 }
Ejemplo n.º 17
0
 public CharacterEntity(EggGameScreen gameScreen, Clip clip, Vector2 position,
     Vector2 scale)
     : this(gameScreen, clip, position, scale, 0.0f, Vector2.Zero, 1.0f)
 {
 }
Ejemplo n.º 18
0
 void LoadMainGameScreen(object asyncState)
 {
     _gameScreen = new EggGameScreen(this);
     _inactiveScreens.Add(_gameScreen);
     _startScreen.IsGameLoaded = true;
 }
Ejemplo n.º 19
0
 public CharacterEntity(EggGameScreen gameScreen, Clip clip, Vector2 position)
     : this(gameScreen, clip, position, new Vector2(1f), 0.0f, Vector2.Zero, 1.0f)
 {
 }
Ejemplo n.º 20
0
 public CharacterEntity(EggGameScreen gameScreen, Clip clip, Vector2 position,
                        Vector2 scale)
     : this(gameScreen, clip, position, scale, 0.0f, Vector2.Zero, 1.0f)
 {
 }
Ejemplo n.º 21
0
 void LoadMainGameScreen(object asyncState)
 {
     _gameScreen = new EggGameScreen(this);
     _inactiveScreens.Add(_gameScreen);
     _startScreen.IsGameLoaded = true;
 }
Ejemplo n.º 22
0
 public CharacterEntity(EggGameScreen gameScreen, Clip clip, Vector2 position)
     : this(gameScreen, clip, position, new Vector2(1f), 0.0f, Vector2.Zero, 1.0f)
 {
 }