コード例 #1
0
 public MechEditor(Vector2 position, mechFacingCabin face) : base()
 {
     _size    = MechModule.MechBoundarySize;
     boundary = new RectangleF(MechModule.MechBoundarySize, position);
     _face    = face;
     _items.Add(new ItemHolder("Facing", _face));
 }
コード例 #2
0
ファイル: PlayerMech.cs プロジェクト: BlueBananasaurus/BP
 public PlayerMech(Vector2 position, mechFacingCabin face, Vector2 velocity, float health = 200f)
 {
     Boundary          = new RectangleF(MechModule.MechBoundarySize, position);
     _resolver         = new CollisionResolver(Globals.TileSize);
     _weight           = 1f;
     _time             = new Timer(100, true);
     _bubbleTime       = new Timer(300, true);
     Friendly          = true;
     Velocity          = velocity;
     WalkingVisible    = false;
     MechDirection     = mechFacingCabin.right;
     MechDirectionLegs = mechFacingLegs.left;
     _rotLeg           = 0;
     _walkSin          = (float)Math.Sin(0);
     Health            = health;
 }
コード例 #3
0
ファイル: DrawEntities.cs プロジェクト: BlueBananasaurus/BP
 public static void DrawMechDefault(Vector2 position, mechFacingCabin face)
 {
     DrawMech(new RectangleF(64 * 2, 96 * 2, position.X, position.Y), 0, false, Vector2.Zero, CollisionResolver.Standing, 0, mechFacingLegs.right, face);
 }
コード例 #4
0
ファイル: DrawEntities.cs プロジェクト: BlueBananasaurus/BP
        public static void DrawMech(RectangleF boundary, float rotLeg, bool walking, Vector2 velocity, CollisionResolver resolver, float walkSin, mechFacingLegs facingLegs, mechFacingCabin facingCabin)
        {
            Vector2 rightLegJoin = boundary.Origin + new Vector2(+12 + 16, +42);
            Vector2 leftLegJoin  = boundary.Origin + new Vector2(-12 - 16, +42);

            float jumpJoints = 4;

            if (walking == true)
            {
                if (velocity.X < 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 7), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                }
                if (velocity.X > 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 7), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(18.5f * 2, 12 * 2));
                }
            }
            else
            {
                if (resolver.TouchBottom == true || resolver.TouchTopMovable == true)
                {
                    if (facingLegs == mechFacingLegs.right)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], rightLegJoin + new Vector2(0, 7), origin: new Vector2(18.5f * 2, 12 * 2));
                    }
                    if (facingLegs == mechFacingLegs.left)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], leftLegJoin + new Vector2(0, 7), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                    }
                }
                else
                {
                    if (facingLegs == mechFacingLegs.right)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], rightLegJoin - new Vector2(0, jumpJoints), origin: new Vector2(18.5f * 2, 12 * 2));
                    }
                    if (facingLegs == mechFacingLegs.left)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], leftLegJoin - new Vector2(0, jumpJoints), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                    }
                }
            }

            if (facingCabin == mechFacingCabin.right)
            {
                Game1.SpriteBatchGlobal.Draw(texture: Game1.Textures["MechBody"], position: boundary.Position + new Vector2(0, (int)Math.Round((float)(Math.Sin(walkSin)))));
            }
            if (facingCabin == mechFacingCabin.left)
            {
                Game1.SpriteBatchGlobal.Draw(texture: Game1.Textures["MechBody"], position: boundary.Position + new Vector2(0, (int)Math.Round((float)Math.Sin(walkSin))), effects: SpriteEffects.FlipHorizontally);
            }

            if (walking == true)
            {
                if (velocity.X < 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 7), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                }
                if (velocity.X > 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 7), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(18.5f * 2, 12 * 2));
                }
            }
            else
            {
                if (resolver.TouchBottom == true || resolver.TouchTopMovable == true)
                {
                    if (facingLegs == mechFacingLegs.right)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], leftLegJoin + new Vector2(0, 7), origin: new Vector2(18.5f * 2, 12 * 2));
                    }
                    if (facingLegs == mechFacingLegs.left)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], rightLegJoin + new Vector2(0, 7), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                    }
                }
                else
                {
                    if (facingLegs == mechFacingLegs.right)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], leftLegJoin - new Vector2(0, jumpJoints), origin: new Vector2(18.5f * 2, 12 * 2));
                    }
                    if (facingLegs == mechFacingLegs.left)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], rightLegJoin - new Vector2(0, jumpJoints), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                    }
                }
            }
        }