BulletMan.MainScreen.s_Canyon_Released C# (CSharp) Метод

s_Canyon_Released() приватный Метод

Release canyon fire button
private s_Canyon_Released ( Component source ) : void
source Component
Результат void
        void s_Canyon_Released(Component source)
        {
            isCanyonPressed = false;

            float radians = MathHelper.ToRadians(slOrientation.Value);
            aux_offset.X = (float)Math.Cos(radians) * s_Canyon.Size.X;
            aux_offset.Y = (float)Math.Sin(radians) * s_Canyon.Size.X;

            //Smoke
            psSmoke.Position = s_Canyon.Position - aux_offset;
            psSmoke.Play();

            //Bullet
            //ball = new Sprite("aux", iball);
            //ball.Draggable = true;
            //AddComponent(ball, psSmoke.Position);
            //PhysicWorld.AddBody(ball,BodyType.DYNAMIC, BodyShape.CIRCLE, Category.All);
            //balls.Add(ball);

            //Vector2 aux2 = psSmoke.Position-s_Canyon.Position;
            //aux2.Y *= -1;
            //aux2.Normalize();
            //aux2 *= pbPower.Value;
            //ball.PhysicBody.ApplyForce(ActionType.IMPULSE, aux2);
            //SendToFront(psSmoke);

            CreateBulletMan(psSmoke.Position);

            Vector2 aux2 = psSmoke.Position - s_Canyon.Position;
            aux2.Y *= -1;
            aux2.Normalize();
            aux2 *= pbPower.Value/2;
            sHead.PhysicBody.ApplyForce(ActionType.IMPULSE, aux2*4);
            sBody.PhysicBody.ApplyForce(ActionType.IMPULSE, aux2);
            sLeftArm.PhysicBody.ApplyForce(ActionType.IMPULSE, aux2);
            sRightArm.PhysicBody.ApplyForce(ActionType.IMPULSE, aux2);
            sLeftLeg.PhysicBody.ApplyForce(ActionType.IMPULSE, aux2);
            sRightLeg.PhysicBody.ApplyForce(ActionType.IMPULSE, aux2);
            SendToFront(psSmoke);

            //Rest power bar
            pbPower.Value = 0;

            //Rumble
            Preferences.App.Vibrate(500);
        }