Esempio n. 1
0
        private Bullet(GeomCloneLevel currentLevel, Vector2 position, Vector2 direction, float maxSpeed)
            : base(currentLevel, position, direction * maxSpeed, 0.01f, maxSpeed, 0, 0, 0.005f)
        {
            rotation = (float)(180.0 / Math.PI * Math.Acos((double)direction.X) * Math.Sign((double)direction.Y)) + 90.0f;

            parts.Add(new ActorPart(Game, "smallRect", position, rotation, Vector2.Zero, 90.0f, 0.15f, 0.5f, Color.White));
            parts.Add(new ActorPart(Game, "smallRect", position, rotation, new Vector2(-(float)6 / referenceWidth, (float)1 / referenceHeight), 10.0f, 0.28f, 0.5f, Color.White));
            parts.Add(new ActorPart(Game, "smallRect", position, rotation, new Vector2(-(float)6 / referenceWidth, -(float)1 / referenceHeight), -10.0f, 0.28f, 0.5f, Color.White));
        }
 public EnemyDead(GeomCloneLevel level, Enemy enemy, Vector2 bulletVelocity)
     : base(level, enemy, null)
 {
     // Activate proper animation
     Owner.ChangeAnimation(new FadeOutDead(level, Owner));
     // Eliminate any eventual behavior
     Owner.ResetBehavior();
     // Sets the velocity of the dead particle to have the same direction of the bullet velocity
     Owner.Vehicle.Velocity = 100 * bulletVelocity;
 }
Esempio n. 3
0
        public static List <Enemy> Spawn3SmallRhombs(GeomCloneLevel level, Vector2 position)
        {
            List <Enemy> list = new List <Enemy>(3);

            for (int ii = 0; ii < 3; ii++)
            {
                Vector2 displacement = RandomHelper.getRandomVector() * 0.1f;
                list.Add(new FastSmallRhomb(level, position + displacement));
            }
            return(list);
        }
Esempio n. 4
0
        public static List <Bullet> SpawnBulletCoupleOld(GeomCloneLevel currentLevel, Vector2 position, Vector2 direction)
        {
            Vector2 direction1 = Vector2.Transform(direction, Matrix.CreateRotationZ((float)(Math.PI / 180.0 * 1.0)));
            Vector2 direction2 = Vector2.Transform(direction, Matrix.CreateRotationZ((float)(-Math.PI / 180.0 * 1.0)));

            List <Bullet> list = new List <Bullet>(2);

            list.Add(new Bullet(currentLevel, position, direction1, 700));
            list.Add(new Bullet(currentLevel, position, direction2, 700));
            return(list);
        }
Esempio n. 5
0
        public static List <Enemy> SpawnRhombFlock(int size, GeomCloneLevel level, Player evader)
        {
            Vector2 position = new Vector2(RandomHelper.getRandomFloat(), RandomHelper.getRandomFloat());

            List <Enemy> list = new List <Enemy>(size);

            for (int ii = 0; ii < size; ii++)
            {
                Vector2 displacement = RandomHelper.getRandomVector() * 0.1f;
                list.Add(new Rhomb(level, evader, position + displacement));
            }

            return(list);
        }
Esempio n. 6
0
        //public ulong GetID { get { return ID; } }
        #endregion

        #region Constructor
        public Actor(GeomCloneLevel setCurrentLevel, Vector2 setPosition, Vector2 setVelocity, float setMass, float setMaxSpeed,
                     float setMaxForce, float setMaxTurnRate, float setBRadius)
            : base(setCurrentLevel.Game)
        {
            currentLevel = setCurrentLevel;
            //ID = nextID++;
            position = setPosition;
            bRadius  = setBRadius;
            velocity = setVelocity * gameSpeed;
            rotation = 0.0f;
            parts    = new List <ActorPart>();
            v        = new Vehicle(new Vector2(position.X * referenceWidth, position.Y * referenceHeight), velocity, setMass, setMaxSpeed * gameSpeed, setMaxForce, setMaxTurnRate, CurrentLevel.GetNeighbors, GameObject2D.referenceWidth, GameObject2D.referenceHeight);
            //CheckPositionBoundaries();
            ChangeState(new NormalState(CurrentLevel, this));
        }
Esempio n. 7
0
 public Actor(GeomCloneLevel setCurrentLevel, Vector2 setPosition, Vector2 setVelocity, float setMass, float setMaxSpeed,
     float setMaxForce, float setMaxTurnRate, float setBRadius)
     : base(setCurrentLevel.Game)
 {
     currentLevel = setCurrentLevel;
     //ID = nextID++;
     position = setPosition;
     bRadius = setBRadius;
     velocity = setVelocity * gameSpeed;
     rotation = 0.0f;
     parts = new List<ActorPart>();
     v = new Vehicle(new Vector2(position.X * referenceWidth, position.Y * referenceHeight), velocity, setMass, setMaxSpeed * gameSpeed, setMaxForce, setMaxTurnRate, CurrentLevel.GetNeighbors, GameObject2D.referenceWidth, GameObject2D.referenceHeight);
     //CheckPositionBoundaries();
     ChangeState(new NormalState(CurrentLevel, this));
 }
Esempio n. 8
0
        public Rhomb(GeomCloneLevel setCurrentLevel, Player evader, Vector2 position)
            : base(setCurrentLevel, position, 0.1f, 300, 500.0f, 720.0f, 0.007f, 50)
        {
            Color c = Color.Aqua;

            rotation = 0.0f;

            float r = 45.0f;

            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, (float)8 / referenceHeight), -r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, (float)8 / referenceHeight), r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, -(float)8 / referenceHeight), -r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, -(float)8 / referenceHeight), r, 0.5f, 0.5f, c));

            Behavior.PursuitOn(evader.Vehicle);
            Behavior.SeparationOn();
            //ChangeState(new BornState(theGame, this));
            ChangeState(new RhombBorn(CurrentLevel, this));
        }
Esempio n. 9
0
        public FastRhomb(GeomCloneLevel level, Player evader, Vector2 position)
            : base(level, position, 0.7f, 500, 1000.0f, 720.0f, 0.007f,50)
        {
            Color c = Color.Pink;

            rotation = 0.0f;

            float r = 45.0f;
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, (float)8 / referenceHeight), -r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, (float)8 / referenceHeight), r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, -(float)8 / referenceHeight), -r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, -(float)8 / referenceHeight), r, 0.5f, 0.5f, c));

            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, Vector2.Zero, 0, 0.7071f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, Vector2.Zero, 90.0f, 0.7071f, 0.5f, c));

            Behavior.PursuitOn(evader.Vehicle);
            Behavior.SeparationOn();
            ChangeState(new FastRhombBorn(CurrentLevel, this));
        }
Esempio n. 10
0
        public static List <Bullet> SpawnBulletCouple(GeomCloneLevel currentLevel, Vector2 position, Vector2 direction)
        {
            Vector2 perp = VectorHelper.Perpendicular(direction);

            perp.Normalize();
            Vector2 pos1 = new Vector2(position.X * referenceWidth, position.Y * referenceHeight);
            Vector2 pos2 = pos1 - 4 * perp;

            pos1   += 4 * perp;
            pos1.X *= (float)1 / referenceWidth;
            pos1.Y *= (float)1 / referenceHeight;
            pos2.X *= (float)1 / referenceWidth;
            pos2.Y *= (float)1 / referenceHeight;

            List <Bullet> list = new List <Bullet>(2);

            list.Add(new Bullet(currentLevel, pos1, direction, 700));
            list.Add(new Bullet(currentLevel, pos2, direction, 700));
            return(list);
        }
Esempio n. 11
0
        public FastRhomb(GeomCloneLevel level, Player evader, Vector2 position)
            : base(level, position, 0.7f, 500, 1000.0f, 720.0f, 0.007f, 50)
        {
            Color c = Color.Pink;

            rotation = 0.0f;

            float r = 45.0f;

            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, (float)8 / referenceHeight), -r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, (float)8 / referenceHeight), r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, -(float)8 / referenceHeight), -r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, -(float)8 / referenceHeight), r, 0.5f, 0.5f, c));

            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, Vector2.Zero, 0, 0.7071f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, Vector2.Zero, 90.0f, 0.7071f, 0.5f, c));

            Behavior.PursuitOn(evader.Vehicle);
            Behavior.SeparationOn();
            ChangeState(new FastRhombBorn(CurrentLevel, this));
        }
Esempio n. 12
0
        public FastSmallRhomb(GeomCloneLevel currentLevel, Vector2 position)
            : base(currentLevel, position, 0.1f, 600, 700, 720.0f, 0.005f, 25)
        {
            Color c = Color.Pink;

            rotation = 0.0f;

            float r = 45.0f;

            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)4 / referenceWidth, (float)4 / referenceHeight), -r, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)4 / referenceWidth, (float)4 / referenceHeight), r, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)4 / referenceWidth, -(float)4 / referenceHeight), -r, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)4 / referenceWidth, -(float)4 / referenceHeight), r, 0.25f, 0.5f, c));

            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, Vector2.Zero, 0, 0.3535f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, Vector2.Zero, 90.0f, 0.3535f, 0.5f, c));

            //Behavior.SeparationOn();
            Behavior.WanderOn(100, 150, 100);
            Vehicle.Heading = RandomHelper.getRandomVector();
            ChangeState(new NormalState(CurrentLevel, this, new Spin(CurrentLevel, this, -400)));
        }
Esempio n. 13
0
        public static List <Bullet> Spawn5Bullets(GeomCloneLevel currentLevel, Vector2 position, Vector2 direction)
        {
            Vector2 direction1 = Vector2.Transform(direction, Matrix.CreateRotationZ((float)(Math.PI / 180.0 * 1.1)));
            Vector2 direction2 = Vector2.Transform(direction, Matrix.CreateRotationZ((float)(-Math.PI / 180.0 * 1.1)));
            Vector2 direction3 = Vector2.Transform(direction, Matrix.CreateRotationZ((float)(Math.PI / 180.0 * 2.8)));
            Vector2 direction4 = Vector2.Transform(direction, Matrix.CreateRotationZ((float)(-Math.PI / 180.0 * 2.8)));

            Vector2 perp = VectorHelper.Perpendicular(direction);

            perp.Normalize();

            Vector2 transformedPosition = new Vector2(position.X * referenceWidth, position.Y * referenceHeight);

            Vector2 pos0 = transformedPosition + 5 * direction;
            Vector2 pos1 = transformedPosition + 5 * perp + 3 * direction;
            Vector2 pos2 = transformedPosition - 5 * perp + 3 * direction;
            Vector2 pos3 = transformedPosition + 6 * perp;
            Vector2 pos4 = transformedPosition - 6 * perp;

            Vector2 scale = new Vector2((float)1.0f / referenceWidth, (float)1.0f / referenceHeight);

            pos0 *= scale;
            pos1 *= scale;
            pos2 *= scale;
            pos3 *= scale;
            pos4 *= scale;

            List <Bullet> list = new List <Bullet>(2);

            list.Add(new Bullet(currentLevel, pos0, direction, 650));
            list.Add(new Bullet(currentLevel, pos1, direction1, 650));
            list.Add(new Bullet(currentLevel, pos2, direction2, 650));
            list.Add(new Bullet(currentLevel, pos3, direction3, 650));
            list.Add(new Bullet(currentLevel, pos4, direction4, 650));
            return(list);
        }
Esempio n. 14
0
        public SmartRhomb(GeomCloneLevel currentLevel, Vector2 position, Player evader)
            : base(currentLevel, position, 0.1f, 400.0f, 150.0f, 720.0f, 0.007f, 100)
        {
            Color c = Color.LawnGreen;

            rotation = 0.0f;

            float r = 45.0f;

            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, (float)8 / referenceHeight), -r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, (float)8 / referenceHeight), r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, -(float)8 / referenceHeight), -r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, -(float)8 / referenceHeight), r, 0.5f, 0.5f, c));

            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, 0), 90.0f, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, 0), 90.0f, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(0, (float)8 / referenceHeight), 0, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(0, -(float)8 / referenceHeight), 0, 0.25f, 0.5f, c));

            Behavior.PursuitOn(evader.Vehicle);
            Behavior.SeparationOn();
            Behavior.EvadeMultiOn(CurrentLevel.EntityManager.GetBulletsVehicles, 250);
            ChangeState(new BornState(CurrentLevel, this));
        }
Esempio n. 15
0
 public Enemy(GeomCloneLevel setCurrentLevel, Vector2 position, float mass, float maxSpeed, float maxForce, float maxTurnRate, float bRadius, ulong score)
     : base(setCurrentLevel, position, new Vector2(0.0f, 0.0f), mass, maxSpeed, maxForce, maxTurnRate, bRadius)
 {
     pointsWorth = score;
 }
Esempio n. 16
0
 public Animation(GeomCloneLevel setCurrentLevel, Actor setOwner)
 {
     owner        = setOwner;
     currentLevel = setCurrentLevel;
 }
Esempio n. 17
0
 public Flash(GeomCloneLevel level, Actor owner, float setTimeInterval) : base(level, owner)
 {
     timeInterval = setTimeInterval;
 }
Esempio n. 18
0
        public FastSmallRhomb(GeomCloneLevel currentLevel, Vector2 position)
            : base(currentLevel, position, 0.1f, 600, 700, 720.0f, 0.005f,25)
        {
            Color c = Color.Pink;

            rotation = 0.0f;

            float r = 45.0f;
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)4 / referenceWidth, (float)4 / referenceHeight), -r, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)4 / referenceWidth, (float)4 / referenceHeight), r, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)4 / referenceWidth, -(float)4 / referenceHeight), -r, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)4 / referenceWidth, -(float)4 / referenceHeight), r, 0.25f, 0.5f, c));

            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, Vector2.Zero, 0, 0.3535f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, Vector2.Zero, 90.0f, 0.3535f, 0.5f, c));

            //Behavior.SeparationOn();
            Behavior.WanderOn(100, 150, 100);
            Vehicle.Heading = RandomHelper.getRandomVector();
            ChangeState(new NormalState(CurrentLevel, this, new Spin(CurrentLevel, this, -400)));
        }
Esempio n. 19
0
        public static List<Bullet> SpawnBulletCouple(GeomCloneLevel currentLevel, Vector2 position, Vector2 direction)
        {
            Vector2 perp = VectorHelper.Perpendicular(direction);
            perp.Normalize();
            Vector2 pos1 = new Vector2(position.X * referenceWidth, position.Y * referenceHeight);
            Vector2 pos2 = pos1 - 4 * perp;
            pos1 += 4 * perp;
            pos1.X *= (float)1 / referenceWidth;
            pos1.Y *= (float)1 / referenceHeight;
            pos2.X *= (float)1 / referenceWidth;
            pos2.Y *= (float)1 / referenceHeight;

            List<Bullet> list = new List<Bullet>(2);
            list.Add(new Bullet(currentLevel, pos1, direction, 700));
            list.Add(new Bullet(currentLevel, pos2, direction, 700));
            return list;
        }
Esempio n. 20
0
 public NormalState(GeomCloneLevel setCurrentLevel, Actor owner)
     : base(setCurrentLevel, owner, null)
 {
     Owner.ChangeAnimation(new NoAnimation(setCurrentLevel, Owner));
 }
Esempio n. 21
0
 public Animation(GeomCloneLevel setCurrentLevel, Actor setOwner)
 {
     owner = setOwner;
     currentLevel = setCurrentLevel;
 }
Esempio n. 22
0
 public NormalState(GeomCloneLevel setCurrentLevel, Actor owner)
     : base(setCurrentLevel, owner, null)
 {
     Owner.ChangeAnimation(new NoAnimation(setCurrentLevel, Owner));
 }
Esempio n. 23
0
 public ActorState(GeomCloneLevel setCurrentLevel, Actor setOwner, Animation setAnimation)
 {
     owner = setOwner; currentLevel = setCurrentLevel;
     Owner.ChangeAnimation(setAnimation);
 }
Esempio n. 24
0
 public PlayerDead(GeomCloneLevel level, Player player)
     : base(level, player, null)
 {
     // Activate proper animation
     Owner.ChangeAnimation(new FadeOutDead(level, Owner));
 }
Esempio n. 25
0
 public FastRhombBorn(GeomCloneLevel level, FastRhomb owner) : base(level, owner)
 {
 }
Esempio n. 26
0
 public PlayerBorn(GeomCloneLevel level, Actor owner) : base(level, owner)
 {
 }
Esempio n. 27
0
 public FastRhombDead(GeomCloneLevel level, FastRhomb enemy, Vector2 bulletVelocity)
     : base(level, enemy, bulletVelocity)
 {
     CurrentLevel.EntityManager.AddEnemies(EnemyGeneratorHelper.Spawn3SmallRhombs(level, enemy.Position));
 }
Esempio n. 28
0
 public Flash(GeomCloneLevel level, Actor owner, float setTimeInterval)
     : base(level, owner)
 {
     timeInterval = setTimeInterval;
 }
Esempio n. 29
0
 public RhombSqueeze(GeomCloneLevel level, Rhomb owner)
     : base(level, owner)
 {
 }
Esempio n. 30
0
 public NormalState(GeomCloneLevel level, Actor owner, Animation normalAnimation)
     : base(level, owner, normalAnimation)
 {
 }
Esempio n. 31
0
 public EnemyDead(GeomCloneLevel level, Enemy enemy, Vector2 bulletVelocity)
     : base(level, enemy, null)
 {
     // Activate proper animation
     Owner.ChangeAnimation(new FadeOutDead(level, Owner));
     // Eliminate any eventual behavior
     Owner.ResetBehavior();
     // Sets the velocity of the dead particle to have the same direction of the bullet velocity
     Owner.Vehicle.Velocity = 100 * bulletVelocity;
 }
Esempio n. 32
0
 public BornState(GeomCloneLevel setCurrentLevel, Actor owner)
     : base(setCurrentLevel, owner, null)
 {
     Owner.ChangeAnimation(new Flash(setCurrentLevel, Owner, 400));
 }
Esempio n. 33
0
        public static List<Enemy> SpawnRhombFlock(int size, GeomCloneLevel level, Player evader)
        {
            Vector2 position = new Vector2(RandomHelper.getRandomFloat(), RandomHelper.getRandomFloat());

            List<Enemy> list = new List<Enemy>(size);
            for (int ii = 0; ii < size; ii++)
            {
                Vector2 displacement = RandomHelper.getRandomVector() * 0.1f;
                list.Add(new Rhomb(level, evader, position + displacement));
            }

            return list;
        }
Esempio n. 34
0
 public BornState(GeomCloneLevel level, Actor owner, Animation bornAnimation) : base(level, owner, bornAnimation)
 {
     timeOutCount = 0;
 }
Esempio n. 35
0
        public static List<Bullet> SpawnBulletCoupleOld(GeomCloneLevel currentLevel, Vector2 position, Vector2 direction)
        {
            Vector2 direction1 = Vector2.Transform(direction, Matrix.CreateRotationZ((float)(Math.PI / 180.0 * 1.0)));
            Vector2 direction2 = Vector2.Transform(direction, Matrix.CreateRotationZ((float)(-Math.PI / 180.0 * 1.0)));

            List<Bullet> list = new List<Bullet>(2);
            list.Add(new Bullet(currentLevel, position, direction1, 700));
            list.Add(new Bullet(currentLevel, position, direction2, 700));
            return list;
        }
Esempio n. 36
0
 public static List<Enemy> Spawn3SmallRhombs(GeomCloneLevel level, Vector2 position)
 {
     List<Enemy> list = new List<Enemy>(3);
     for (int ii = 0; ii < 3; ii++)
     {
         Vector2 displacement = RandomHelper.getRandomVector() * 0.1f;
         list.Add(new FastSmallRhomb(level, position + displacement));
     }
     return list;
 }
Esempio n. 37
0
        public SmartRhomb(GeomCloneLevel currentLevel, Vector2 position, Player evader)
            : base(currentLevel, position, 0.1f, 400.0f, 150.0f, 720.0f, 0.007f, 100)
        {
            Color c = Color.LawnGreen;

            rotation = 0.0f;

            float r = 45.0f;
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, (float)8 / referenceHeight), -r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, (float)8 / referenceHeight), r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, -(float)8 / referenceHeight), -r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, -(float)8 / referenceHeight), r, 0.5f, 0.5f, c));

            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, 0), 90.0f, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, 0), 90.0f, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(0, (float)8 / referenceHeight), 0, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(0, -(float)8 / referenceHeight), 0, 0.25f, 0.5f, c));

            Behavior.PursuitOn(evader.Vehicle);
            Behavior.SeparationOn();
            Behavior.EvadeMultiOn(CurrentLevel.EntityManager.GetBulletsVehicles, 250);
            ChangeState(new BornState(CurrentLevel, this));
        }
Esempio n. 38
0
        public Rhomb(GeomCloneLevel setCurrentLevel, Player evader, Vector2 position)
            : base(setCurrentLevel, position, 0.1f, 300, 500.0f, 720.0f, 0.007f,50)
        {
            Color c = Color.Aqua;

            rotation = 0.0f;

            float r = 45.0f;
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, (float)8 / referenceHeight), -r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, (float)8 / referenceHeight), r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2(-(float)8 / referenceWidth, -(float)8 / referenceHeight), -r, 0.5f, 0.5f, c));
            parts.Add(new ActorPart(Game, "smallRect", Position, rotation, new Vector2((float)8 / referenceWidth, -(float)8 / referenceHeight), r, 0.5f, 0.5f, c));

            Behavior.PursuitOn(evader.Vehicle);
            Behavior.SeparationOn();
            //ChangeState(new BornState(theGame, this));
            ChangeState(new RhombBorn(CurrentLevel, this));
        }
Esempio n. 39
0
 public NoAnimation(GeomCloneLevel level, Actor owner) : base(level, owner)
 {
 }
Esempio n. 40
0
 public PlayerBorn(GeomCloneLevel level, Actor owner)
     : base(level, owner)
 {
 }
Esempio n. 41
0
 public Spin(GeomCloneLevel game, Actor owner, float setDegreesPerSecond) : base(game, owner)
 {
     degreesPerMilliSecond = setDegreesPerSecond / 1000;
 }
Esempio n. 42
0
 public RhombBorn(GeomCloneLevel level, Rhomb owner)
     : base(level, owner)
 {
 }
Esempio n. 43
0
 public FadeOutDead(GeomCloneLevel level, Actor owner) : base(level, owner)
 {
 }
Esempio n. 44
0
 public BornState(GeomCloneLevel setCurrentLevel, Actor owner)
     : base(setCurrentLevel, owner, null)
 {
     Owner.ChangeAnimation(new Flash(setCurrentLevel, Owner, 400));
 }
Esempio n. 45
0
 public NoAnimation(GeomCloneLevel level, Actor owner)
     : base(level, owner)
 {
 }
Esempio n. 46
0
 public RhombSqueeze(GeomCloneLevel level, Rhomb owner) : base(level, owner)
 {
 }
Esempio n. 47
0
 public Spin(GeomCloneLevel game, Actor owner, float setDegreesPerSecond)
     : base(game, owner)
 {
     degreesPerMilliSecond = setDegreesPerSecond / 1000;
 }
Esempio n. 48
0
 public Bomb(GeomCloneLevel currLev, Vector2 pos)
     : base(currLev, pos, new Vector2(), 1.0f, 0, 0, 0, 0.005f)
 {
 }
Esempio n. 49
0
 public FadeOutDead(GeomCloneLevel level, Actor owner)
     : base(level, owner)
 {
 }
Esempio n. 50
0
        private Bullet(GeomCloneLevel currentLevel, Vector2 position, Vector2 direction, float maxSpeed)
            : base(currentLevel, position, direction * maxSpeed, 0.01f, maxSpeed, 0, 0, 0.005f)
        {
            rotation = (float)(180.0 / Math.PI * Math.Acos((double)direction.X) * Math.Sign((double)direction.Y)) + 90.0f;

            parts.Add(new ActorPart(Game, "smallRect", position, rotation, Vector2.Zero, 90.0f, 0.15f, 0.5f, Color.White));
            parts.Add(new ActorPart(Game, "smallRect", position, rotation, new Vector2(-(float)6 / referenceWidth, (float)1 / referenceHeight), 10.0f, 0.28f, 0.5f, Color.White));
            parts.Add(new ActorPart(Game, "smallRect", position, rotation, new Vector2(-(float)6 / referenceWidth, -(float)1 / referenceHeight), -10.0f, 0.28f, 0.5f, Color.White));
        }
Esempio n. 51
0
 public FastRhombDead(GeomCloneLevel level,FastRhomb enemy,Vector2 bulletVelocity)
     : base(level, enemy, bulletVelocity)
 {
     CurrentLevel.EntityManager.AddEnemies(EnemyGeneratorHelper.Spawn3SmallRhombs(level, enemy.Position));
 }
Esempio n. 52
0
        public static List<Bullet> Spawn5Bullets(GeomCloneLevel currentLevel, Vector2 position, Vector2 direction)
        {
            Vector2 direction1 = Vector2.Transform(direction, Matrix.CreateRotationZ((float)(Math.PI / 180.0 * 1.1)));
            Vector2 direction2 = Vector2.Transform(direction, Matrix.CreateRotationZ((float)(-Math.PI / 180.0 * 1.1)));
            Vector2 direction3 = Vector2.Transform(direction, Matrix.CreateRotationZ((float)(Math.PI / 180.0 * 2.8)));
            Vector2 direction4 = Vector2.Transform(direction, Matrix.CreateRotationZ((float)(-Math.PI / 180.0 * 2.8)));

            Vector2 perp = VectorHelper.Perpendicular(direction);
            perp.Normalize();

            Vector2 transformedPosition = new Vector2(position.X * referenceWidth, position.Y * referenceHeight);

            Vector2 pos0 = transformedPosition + 5 * direction;
            Vector2 pos1 = transformedPosition + 5 * perp + 3 * direction;
            Vector2 pos2 = transformedPosition - 5 * perp + 3 * direction;
            Vector2 pos3 = transformedPosition + 6 * perp;
            Vector2 pos4 = transformedPosition - 6 * perp;

            Vector2 scale = new Vector2((float)1.0f / referenceWidth, (float)1.0f / referenceHeight);

            pos0 *= scale;
            pos1 *= scale;
            pos2 *= scale;
            pos3 *= scale;
            pos4 *= scale;

            List<Bullet> list = new List<Bullet>(2);
            list.Add(new Bullet(currentLevel, pos0, direction, 650));
            list.Add(new Bullet(currentLevel, pos1, direction1, 650));
            list.Add(new Bullet(currentLevel, pos2, direction2, 650));
            list.Add(new Bullet(currentLevel, pos3, direction3, 650));
            list.Add(new Bullet(currentLevel, pos4, direction4, 650));
            return list;
        }
Esempio n. 53
0
 public NormalState(GeomCloneLevel level, Actor owner, Animation normalAnimation)
     : base(level, owner, normalAnimation)
 {
 }
Esempio n. 54
0
 public Enemy(GeomCloneLevel setCurrentLevel, Vector2 position, float mass, float maxSpeed, float maxForce, float maxTurnRate, float bRadius,ulong score)
     : base(setCurrentLevel, position, new Vector2(0.0f, 0.0f), mass, maxSpeed, maxForce, maxTurnRate, bRadius)
 {
     pointsWorth = score;
 }
Esempio n. 55
0
 public PlayerDead(GeomCloneLevel level, Player player)
     : base(level, player, null)
 {
     // Activate proper animation
     Owner.ChangeAnimation(new FadeOutDead(level, Owner));
 }
Esempio n. 56
0
 public Bomb(GeomCloneLevel currLev, Vector2 pos)
     : base(currLev, pos, new Vector2(), 1.0f, 0, 0, 0, 0.005f)
 {
 }
Esempio n. 57
0
 public ActorState(GeomCloneLevel setCurrentLevel, Actor setOwner, Animation setAnimation)
 {
     owner = setOwner; currentLevel = setCurrentLevel;
     Owner.ChangeAnimation(setAnimation);
 }
Esempio n. 58
0
 public Player(GeomCloneLevel currentLevel, string blockTexture)
     : base(currentLevel, new Vector2(0.5f, 0.5f), new Vector2(0.0f, 0.0f), 1.0f, 550, 800.0f, 720.0f, 0.008f)
 {
     texture = blockTexture;
     Init(3, 3);
 }
Esempio n. 59
0
 public BornState(GeomCloneLevel level, Actor owner, Animation bornAnimation)
     : base(level, owner, bornAnimation)
 {
     timeOutCount = 0;
 }
Esempio n. 60
0
 public Player(GeomCloneLevel currentLevel, string blockTexture)
     : base(currentLevel, new Vector2(0.5f, 0.5f), new Vector2(0.0f, 0.0f), 1.0f, 550, 800.0f, 720.0f, 0.008f)
 {
     texture = blockTexture;
     Init(3, 3);
 }