Beispiel #1
0
 public Missile(List<DrawableObjectAbstract> pipeline, CollisionDetectorInterface detector, CharacterAbstract target)
     : base(pipeline, TextureMap.fetchTexture(TEXTURE_NAME), detector, null, RADIUS, HEIGHT, Vector2.Zero, Vector2.Zero, Vector2.Zero, DEPTH)
 {
     damage_ = DAMAGE;
     boundsPolygon_ = new ConvexPolygon(BOUNDS_POINTS, Vector2.Zero);
     target_ = target;
 }
Beispiel #2
0
 public Grenade(List<DrawableObjectAbstract> pipeline, GameTexture texture, CollisionDetectorInterface detector, Vector2 direction, Vector2 position, Vector2 directionFacing)
     : base(pipeline, texture, detector, null, RADIUS, HEIGHT, CommonFunctions.normalizeNonmutating(direction) * SPEED, position, directionFacing, DEPTH)
 {
     boundsPolygon_ = new ConvexPolygon(BOUNDS_POINTS, Vector2.Zero);
     fuseTime_ = FUSE;
     started_ = false;
 }
 public NonLoopAnimation(GameTexture sprites,
     float frameLengthModifier,
     float depth,
     List<List<Vector2>> boundsPoints)
 {
     sprites_ = sprites;
     currentFrame_ = 0;
     totalFrames_ = sprites.getNumberOfImages();
     position_ = Vector2.Zero;
     rotation_ = Vector2.Zero;
     frameLengthModifier_ = frameLengthModifier;
     moved_ = Vector2.Zero;
     depth_ = depth;
     boundsPolygon_ = new ConvexPolygonInterface[boundsPoints.Count];
     for (int i = 0; i < boundsPoints.Count; i++)
     {
         boundsPolygon_[i] = new ConvexPolygon(boundsPoints[i], Vector2.Zero);
     }
     perFrameBounds_ = true;
 }
 public void checkCollisionsTest()
 {
     List<Vector2> points = new List<Vector2>();
     points.Add(new Vector2(-5.0f, 0f));
     points.Add(new Vector2(-1.0f, -15.0f));
     points.Add(new Vector2(7.0f, -15.0f));
     points.Add(new Vector2(10.0f, 0f));
     points.Add(new Vector2(7.0f, 15.0f));
     points.Add(new Vector2(-1.0f, 15.0f));
     ConvexPolygon boundsPolygon = new ConvexPolygon(points, Vector2.Zero);
     boundsPolygon.rotate(new Vector2(0.0f, 1.0f), Vector2.Zero);
     float minA = 0, maxA = 0, minB = 0, maxB = 0;
     boundsPolygon.projectPolygonOnAxis(new Vector2(1.0f, 0.0f), new Height(), ref minA, ref maxA);
     Assert.AreEqual(-15.0f, minA);
     Assert.AreEqual(15.0f, maxA);
     boundsPolygon.rotate(new Vector2(1.0f, 0.0f), Vector2.Zero);
     boundsPolygon.projectPolygonOnAxis(new Vector2(1.0f, 0.0f), new Height(), ref minB, ref maxB);
     Assert.AreNotEqual(minA, minB);
     Assert.AreNotEqual(minA, minB);
     Assert.AreEqual(-5.0f, minB);
     Assert.AreEqual(10.0f, maxB);
 }
 public NonLoopAnimation(GameTexture sprites,
     float frameLengthModifier,
     float depth,
     List<Vector2> boundsPoints)
 {
     sprites_ = sprites;
     currentFrame_ = 0;
     totalFrames_ = sprites.getNumberOfImages();
     position_ = Vector2.Zero;
     rotation_ = Vector2.Zero;
     frameLengthModifier_ = frameLengthModifier;
     moved_ = Vector2.Zero;
     depth_ = depth;
     boundsPolygon_ = new ConvexPolygonInterface[1];
     boundsPolygon_[0] = new ConvexPolygon(boundsPoints, Vector2.Zero);
     perFrameBounds_ = false;
 }
Beispiel #6
0
 public Bullet(List<DrawableObjectAbstract> pipeline, CollisionDetectorInterface detector, Vector2 position, Vector2 direction)
     : base(pipeline, TextureMap.fetchTexture(TEXTURE_NAME), detector, null, RADIUS, HEIGHT, direction * SPEED, position, direction, DEPTH)
 {
     damage_ = DAMAGE;
     boundsPolygon_ = new ConvexPolygon(BOUNDS_POINTS, Vector2.Zero);
 }
Beispiel #7
0
        public BigBoss(List<DrawableObjectAbstract> pipeline, Vector2 pos)
            : base(pipeline, new CharacterHealth(), new CharacterAmmo(), new CharacterWeapon(), "bigboss", null, null, FRAMELENGTHMODIFIER, Vector2.Zero, pos, new Vector2(1.0f, 0.0f), 0.49f)
        {
            AI_ = new BossAI(this);

            List<GameTexture> animationTextures = new List<GameTexture>();
            animationTextures.Add(TextureMap.getInstance().getTexture("basic_enemy_walk"));
            animations_ = new AnimationSet(animationTextures);
            movingToward_ = new Vector2(150.0f, 260.0f);
            lookingAt_ = new Vector2(250.0f, 60.0f);
            atLocation_ = false;
            collisionDetector_ = null;
            radius_ = RADIUS;
            Allegiance_ = 2;
            height_ = new Height(true, true);
            ConvexPolygonInterface bounds = new ConvexPolygon(BOUNDS, Vector2.Zero);
            boundsPolygon_ = new CircularConvexPolygon(20, position_);

            AnimationInterface run = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Blank"), frameLengthModifier_, depth_, bounds);
            AnimationInterface runTo = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Blank"), frameLengthModifier_, depth_, bounds);
            AnimationInterface rest = new LoopAnimation(TextureMap.fetchTexture("GreenPlayer_Blank"), frameLengthModifier_, depth_, bounds);
            AnimationInterface top = new LoopAnimation(TextureMap.fetchTexture("Boss"), frameLengthModifier_, depth_, bounds);
            AnimationInterface[] restAnims = new AnimationInterface[3];
            restAnims[0] = rest;
            restAnims[1] = rest;
            restAnims[2] = top;
            AnimationInterface[] shoot = new AnimationInterface[1];
            shoot[0] = top;

            List<string> levels = new List<string>();
            levels.Add("look");
            levels.Add("lower");
            levels.Add("upper");

            Dictionary<string, Dictionary<string, CharacterActionInterface>> actions = new Dictionary<string, Dictionary<string, CharacterActionInterface>>();
            actions.Add("default", new Dictionary<string, CharacterActionInterface>());
            actions["default"].Add("move", new CharacterRunAction(this, run, 2.0f, "lower"));
            actions["default"].Add("moveTo", new CharacterRunToAction(this, runTo, 2.0f, "lower"));
            actions["default"].Add("rest", new CharacterStayStillAction(this, restAnims, levels, "upper", "lower"));
            actions["default"].Add("crouch", new NoAction("lower"));
            actions["default"].Add("cover", new NoAction("lower"));
            actions["default"].Add("shoot", new CharacterShootAction(this, shoot, "upper", 0));
            actions["default"].Add("look", new CharacterLookAction(this, "look"));
            actions["default"].Add("lookAt", new CharacterLookAtAction(this, "look"));
            actions["default"].Add("reload", new NoAction("lower"));
            actions["default"].Add("throw", new CharacterShootAction(this, shoot, "upper", 0));
            actuator_ = new MultiLevelActuator(actions, levels, this, "default", "rest", "lower", "upper");

            currentDrawColor_ = Color.White;
            health_.update(MAX_HEALTH);

            Weapon_ = new BigBossGatlingGuns(pipeline_, this, getGunHandle(true));
        }