コード例 #1
0
        public TestWings() : base("testWings.png")
        {
            // set your types
            Types             = new Type[] { Type.WINGS };
            NormalAnchorPoint = CCPoint.AnchorMiddle;

            // add a mount point for two engines at the center of each wing
            var engineMount1 = new PartMount(this, new CCPoint(ContentSize.Width / 2, (ContentSize.Height / 2) + (ContentSize.Height / 4)), Type.ENGINE);
            var engineMount2 = new PartMount(this, new CCPoint(ContentSize.Width / 2, (ContentSize.Height / 2) - (ContentSize.Height / 4)), Type.ENGINE);
            // add mount points for two guns a bit further out
            var gunMount1 = new PartMount(this, new CCPoint(ContentSize.Width / 2, (ContentSize.Height - (ContentSize.Height / 6))), Type.GUN);
            var gunMount2 = new PartMount(this, new CCPoint(ContentSize.Width / 2, ContentSize.Height / 6), Type.GUN);

            gunMount1.NullRotation = -20f;
            gunMount1.Dz           = 1;
            gunMount2.NullRotation = 20f;
            gunMount2.Dz           = 1;
            PartMounts             = new PartMount[] { engineMount1, engineMount2, gunMount1, gunMount2 };

            // specify the collision polygon
            CollisionType = Collisions.CreateDiamondCollisionPolygon(this);

            // specify the mass points
            MassPoints = new MassPoint[] { new MassPoint((ContentSize.Width / 2) - 1, ContentSize.Height, 30), new MassPoint((ContentSize.Width / 2), (ContentSize.Height / 2) + (ContentSize.Height / 6), 50), new MassPoint((ContentSize.Width / 2), (ContentSize.Height / 2) - (ContentSize.Height / 6), 50), new MassPoint((ContentSize.Width / 2) - 1, 0, 30) };
        }
コード例 #2
0
ファイル: Part.cs プロジェクト: PSteinhaus/CocosSharpMathGame
        protected MassPoint[] CreateDiamondMassPoints(float massPerPoint)
        {
            var points     = DiamondCollisionPoints();
            var massPoints = new MassPoint[4];

            for (int i = 0; i < massPoints.Length; i++)
            {
                massPoints[i] = new MassPoint(points[i].X, points[i].Y, massPerPoint);
            }
            return(massPoints);
        }
コード例 #3
0
        public TestEngine() : base("testEngine.png")
        {
            // set your types
            Types             = new Type[] { Type.ENGINE };
            NormalAnchorPoint = CCPoint.AnchorMiddle;

            // specify the mass points
            MassPoints = new MassPoint[] { new MassPoint(ContentSize.Width / 2, ContentSize.Height / 2, 30) };

            // specify the collision polygon
            CollisionType = Collisions.CreateDiamondCollisionPolygon(this);

            // give the engine maneuver abilities
            ManeuverAbility = new ManeuverAbility((float)Math.Pow(10, 5) * 0.25f, (float)Math.Pow(10, 5) * 3.0f);//, (float)Math.Pow(10, 5)*0.1f, (float)Math.Pow(10, 5));
        }
コード例 #4
0
        public TestWeaponShiny() : base("weaponTestShiny.png") // for now, as there is no gun sprite yet
        {
            SetHealthAndMaxHealth(8);
            // set your types
            Types             = new Type[] { Type.GUN };
            NormalAnchorPoint = new CCPoint(1 / ContentSize.Width, 0.5f);

            // specify the mass points
            MassPoints = new MassPoint[] { new MassPoint(ContentSize.Width / 2, ContentSize.Height / 2, 30) };

            // specify the collision polygon
            CollisionType = Collisions.CreateDiamondCollisionPolygon(this);

            // give the gun a WeaponAbility
            WeaponAbility = WeaponAbility.CreateTestWeaponShiny(this);
        }
コード例 #5
0
        public WeaponScrap() : base("weaponScrap.png")
        {
            SetHealthAndMaxHealth(4);
            // set your types
            Types             = new Type[] { Type.GUN };
            NormalAnchorPoint = new CCPoint(1.5f / ContentSize.Width, 0.5f);

            // specify the mass points
            MassPoints = new MassPoint[] { new MassPoint(ContentSize.Width / 2, ContentSize.Height / 2, 12) };

            // specify the collision polygon
            CollisionType = Collisions.CreateDiamondCollisionPolygon(this);

            // give the gun a WeaponAbility
            WeaponAbility = WeaponAbility.CreateScrapWeapon(this);
        }
コード例 #6
0
        public TestWing() : base("testWing.png")
        {
            // set your types
            Types             = new Type[] { Type.SINGLE_WING };
            NormalAnchorPoint = CCPoint.AnchorMiddleBottom;

            // add a mount point for two engines at the center of the wing
            var engineMount = new PartMount(this, new CCPoint(ContentSize.Width / 2, (ContentSize.Height / 2)), Type.ENGINE);
            // add a mount points for a gun a bit further out
            var gunMount = new PartMount(this, new CCPoint(ContentSize.Width / 2, (ContentSize.Height - (ContentSize.Height / 4))), Type.GUN);

            gunMount.NullRotation = -20f;
            gunMount.Dz           = 1;
            PartMounts            = new PartMount[] { engineMount, gunMount };

            // specify the collision polygon
            CollisionType = Collisions.CreateDiamondCollisionPolygon(this);

            // specify the mass points
            MassPoints = new MassPoint[] { new MassPoint((ContentSize.Width / 2) - 1, ContentSize.Height, 30), new MassPoint((ContentSize.Width / 2), (ContentSize.Height / 2) + (ContentSize.Height / 6), 50), new MassPoint((ContentSize.Width / 2), (ContentSize.Height / 2) - (ContentSize.Height / 6), 50), new MassPoint((ContentSize.Width / 2) - 1, 0, 30) };
        }