Esempio 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();
        }
Esempio n. 2
0
        public EnemyEntity(ThrongGameScreen 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.Idle, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("idle-left");
            _animations[new AnimKey(AnimState.Idle, AnimationDirection.Left)] = clip.AnimSet.CreateSingleAnimSet("right-right");

            _animations[new AnimKey(AnimState.Run, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("run-right");
            _animations[new AnimKey(AnimState.Run, AnimationDirection.Left)] = clip.AnimSet.CreateSingleAnimSet("run-left");

            _animations[new AnimKey(AnimState.Attack, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("attack-right");
            _animations[new AnimKey(AnimState.Attack, AnimationDirection.Left)] = clip.AnimSet.CreateSingleAnimSet("attack-left");

            _animations[new AnimKey(AnimState.Hit, AnimationDirection.Right)] = clip.AnimSet.CreateSubSet(true, "hitA-right", "hitB-right", "hitC-right");
            _animations[new AnimKey(AnimState.Hit, AnimationDirection.Left)] = clip.AnimSet.CreateSubSet(true, "hitA-left", "hitB-left", "hitC-left");

            _animations[new AnimKey(AnimState.Death, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("death-right");
            _animations[new AnimKey(AnimState.Death, AnimationDirection.Left)] = clip.AnimSet.CreateSingleAnimSet("death-left");

            PlayNewEnemyAnimation();
        }
Esempio n. 3
0
 public void Init(ContentManager content, Clip clip)
 {
     foreach (ClipAnim ca in Anims)
     {
         ca.Init(content, clip);
     }
 }
Esempio n. 4
0
        public void Init(ContentManager content, Clip clip)
        {
            parentClip = clip;

            foreach (JointAnim ja in JointAnims)
            {
                ja.Init(content, this);
            }
        }
Esempio n. 5
0
        // TODO: refactor this to use the content manager for retrieving
        // different enemy types ..
        public EnemySpawner(ThrongGameScreen gameScreen, Clip clip)
        {
            _gameScreen = gameScreen;
            _secondsSinceLastSpawn = 0f;
            _minDistFromPlayer = 10f;
            _clip = clip;

            // spawn every 5sec
            SpawnInterval = 5f;
        }
Esempio n. 6
0
 public ClipInstance(Clip clip)
 {
     Clip = clip;
     JointStates = new SpriteState[clip.Joints.Length];
     AbsoluteTransforms = new Transform2D[clip.Joints.Length];
     JointStates[0].Transform = Transform2D.Identity;
     currentAnim = new ClipAnimInstance(this);
     Play(clip.AnimSet.Anims[0]);
     Update(0.0f);
 }
Esempio n. 7
0
        public CharacterEntity(ThrongGameScreen 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();
        }
Esempio n. 8
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");
        }
Esempio n. 9
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();
        }
Esempio n. 10
0
        public ClipInstance(Clip clip)
        {
            Clip = clip;
            JointStates = new JointState[clip.Joints.Length];
            AbsoluteTransforms = new Transform2D[clip.Joints.Length];

            // There are potentially 3 types of animation per joint
            JointAnimStates = new JointAnimState<JointAnim>[clip.Joints.Length * 3];

            for (int i = 0; i < JointStates.Length; ++i)
            {
                JointStates[i].Color = Color.White;
                JointStates[i].Transform = clip.Joints[i].Transform;
                JointStates[i].Texture = clip.Joints[i].Texture;
                JointStates[i].TextureRect = clip.Joints[i].TextureRect;
                JointStates[i].FlipState = clip.Joints[i].FlipState;
                JointStates[i].Origin = clip.Joints[i].Origin;
                JointStates[i].Visible = true;
            }
            ComputeAbsoluteTransforms();
        }
Esempio n. 11
0
 public CharacterEntity(ThrongGameScreen gameScreen, Clip clip, Vector2 position,
     Vector2 scale)
     : this(gameScreen, clip, position, scale, 0.0f, Vector2.Zero, 1.0f)
 {
 }
Esempio n. 12
0
 public CharacterEntity(ThrongGameScreen gameScreen, Clip clip, Vector2 position)
     : this(gameScreen, clip, position, new Vector2(1f), 0.0f, Vector2.Zero, 1.0f)
 {
 }
Esempio n. 13
0
 public PlayerEntity(EggGameScreen gameScreen, Clip clip, Vector2 position,
     Vector2 scale)
     : this(gameScreen, clip, position, scale, 0.0f)
 {
 }
Esempio n. 14
0
 public PlayerEntity(EggGameScreen gameScreen, Clip clip, Vector2 position)
     : this(gameScreen, clip, position, new Vector2(1f), 0.0f)
 {
 }
Esempio n. 15
0
 public PlayerEntity(EggGameScreen gameScreen, Clip clip)
     : this(gameScreen, clip, new Vector2(), new Vector2(1f), 0.0f)
 {
 }
Esempio n. 16
0
        private void SetupAnimations(Clip clip)
        {
            _animations[new AnimKey(State.Idle, AnimationDirection.Left)] = clip.AnimSet["idle-left"];
            _animations[new AnimKey(State.Idle, AnimationDirection.Right)] = clip.AnimSet["idle-right"];
            _animations[new AnimKey(State.Idle, AnimationDirection.Up)] = clip.AnimSet["idle-up"];
            _animations[new AnimKey(State.Idle, AnimationDirection.Down)] = clip.AnimSet["idle-down"];
            _animations[new AnimKey(State.Idle, AnimationDirection.DiagonalUpLeft)] = clip.AnimSet["idle-diag-up-left"];
            _animations[new AnimKey(State.Idle, AnimationDirection.DiagonalUpRight)] = clip.AnimSet["idle-diag-up-right"];
            _animations[new AnimKey(State.Idle, AnimationDirection.DiagonalDownLeft)] = clip.AnimSet["idle-diag-down-left"];
            _animations[new AnimKey(State.Idle, AnimationDirection.DiagonalDownRight)] = clip.AnimSet["idle-diag-down-right"];

            _animations[new AnimKey(State.Moving, AnimationDirection.Left)] = clip.AnimSet["walk-left"];
            _animations[new AnimKey(State.Moving, AnimationDirection.Right)] = clip.AnimSet["walk-right"];
            _animations[new AnimKey(State.Moving, AnimationDirection.Up)] = clip.AnimSet["walk-up"];
            _animations[new AnimKey(State.Moving, AnimationDirection.Down)] = clip.AnimSet["walk-down"];
            _animations[new AnimKey(State.Moving, AnimationDirection.DiagonalUpLeft)] = clip.AnimSet["walk-diag-up-left"];
            _animations[new AnimKey(State.Moving, AnimationDirection.DiagonalUpRight)] = clip.AnimSet["walk-diag-up-right"];
            _animations[new AnimKey(State.Moving, AnimationDirection.DiagonalDownLeft)] = clip.AnimSet["walk-diag-down-left"];
            _animations[new AnimKey(State.Moving, AnimationDirection.DiagonalDownRight)] = clip.AnimSet["walk-diag-down-right"];

            _animations[new AnimKey(State.Sucking, AnimationDirection.Left)] = clip.AnimSet["suck-left"];
            _animations[new AnimKey(State.Sucking, AnimationDirection.Right)] = clip.AnimSet["suck-right"];
            _animations[new AnimKey(State.Sucking, AnimationDirection.Up)] = clip.AnimSet["suck-up"];
            _animations[new AnimKey(State.Sucking, AnimationDirection.Down)] = clip.AnimSet["suck-down"];
            _animations[new AnimKey(State.Sucking, AnimationDirection.DiagonalUpLeft)] = clip.AnimSet["suck-diag-up-left"];
            _animations[new AnimKey(State.Sucking, AnimationDirection.DiagonalUpRight)] = clip.AnimSet["suck-diag-up-right"];
            _animations[new AnimKey(State.Sucking, AnimationDirection.DiagonalDownLeft)] = clip.AnimSet["suck-diag-down-left"];
            _animations[new AnimKey(State.Sucking, AnimationDirection.DiagonalDownRight)] = clip.AnimSet["suck-diag-down-right"];

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

            _animations[new AnimKey(State.Eating, AnimationDirection.DiagonalUpLeft)] = clip.AnimSet["eat-diag-up-left"];
            _animations[new AnimKey(State.Eating, AnimationDirection.DiagonalUpRight)] = clip.AnimSet["eat-diag-up-right"];
            _animations[new AnimKey(State.Eating, AnimationDirection.DiagonalDownLeft)] = clip.AnimSet["eat-diag-down-left"];
            _animations[new AnimKey(State.Eating, AnimationDirection.DiagonalDownRight)] = clip.AnimSet["eat-diag-down-right"];
        }
Esempio n. 17
0
        private void SetupAnimations(Clip clip)
        {
            _animations[new AnimKey(State.Idle, Weapon.Pistol, AnimationDirection.Left)] = clip.AnimSet.CreateSingleAnimSet("idle-left");
            _animations[new AnimKey(State.Idle, Weapon.Pistol, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("idle-right");

            _animations[new AnimKey(State.Run, Weapon.Pistol, AnimationDirection.Left)] = clip.AnimSet.CreateSingleAnimSet("run-left");
            _animations[new AnimKey(State.Run, Weapon.Pistol, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("run-right");

            _animations[new AnimKey(State.Attack, Weapon.Pistol, AnimationDirection.Left)] = clip.AnimSet.CreateSingleAnimSet("shoot-left");
            _animations[new AnimKey(State.Attack, Weapon.Pistol, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("shoot-right");

            _animations[new AnimKey(State.Idle, Weapon.Melee, AnimationDirection.Left)] = clip.AnimSet.CreateSingleAnimSet("idle_melee-left");
            _animations[new AnimKey(State.Idle, Weapon.Melee, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("idle_melee-right");

            _animations[new AnimKey(State.Run, Weapon.Melee, AnimationDirection.Left)] = clip.AnimSet.CreateSingleAnimSet("run_melee-left");
            _animations[new AnimKey(State.Run, Weapon.Melee, AnimationDirection.Right)] = clip.AnimSet.CreateSingleAnimSet("run_melee-right");

            _animations[new AnimKey(State.Attack, Weapon.Melee, AnimationDirection.Left)] = clip.AnimSet.CreateSubSet(true, "swingA-left", "swingB-left");
            _animations[new AnimKey(State.Attack, Weapon.Melee, AnimationDirection.Right)] = clip.AnimSet.CreateSubSet(true, "swingA-right", "swingB-right");
        }
Esempio n. 18
0
 public CharacterEntity(EggGameScreen gameScreen, Clip clip)
     : this(gameScreen, clip, new Vector2(), new Vector2(1f), 0.0f, Vector2.Zero, 1.0f)
 {
 }
Esempio n. 19
0
 public EggEntity(ThrongGameScreen gameScreen, Clip clip)
     : this(gameScreen, clip, new Vector2(), new Vector2(1f), 0.0f)
 {
 }
Esempio n. 20
0
 public EggEntity(ThrongGameScreen gameScreen, Clip clip, Vector2 position,
     Vector2 scale)
     : this(gameScreen, clip, position, scale, 0.0f)
 {
 }
Esempio n. 21
0
 public EggEntity(ThrongGameScreen gameScreen, Clip clip, Vector2 position)
     : this(gameScreen, clip, position, new Vector2(1f), 0.0f)
 {
 }