public ExplosiveManager(World _world, ContactListener _contactListener)
 {
     ExplosiveSprites = new List<Sprite>();
     physicsWorld = _world;
     contactListener = _contactListener;
     contactListener.DamageExplosive += new ContactListener.DamageEventHandler(contactListener_DamageExplosive);
 }
Example #2
0
 internal ContactManager()
 {
     m_contactList     = null;
     m_contactCount    = 0;
     m_contactFilter   = new ContactFilter();
     m_contactListener = null;
     m_broadPhase      = new BroadPhase();
 }
Example #3
0
 public ContactManager(World argPool, BroadPhase broadPhase)
 {
     m_contactList = null;
     m_contactCount = 0;
     m_contactFilter = new ContactFilter();
     m_contactListener = null;
     m_broadPhase = broadPhase;
     pool = argPool;
 }
 public ContactManager(World argPool, BroadPhaseStrategy strategy)
 {
     m_contactList     = null;
     m_contactCount    = 0;
     m_contactFilter   = new ContactFilter();
     m_contactListener = null;
     m_broadPhase      = new BroadPhase(strategy);
     pool = argPool;
 }
Example #5
0
 // Use this for initialization
 void Start()
 {
     m_player          = FindObjectOfType <PlayerController>().gameObject;
     m_gameController  = FindObjectOfType <GameController>();
     m_contactListener = FindObjectOfType <ContactListener>();
     if (!m_player)
     {
         Debug.LogWarning("Not Found Player");
     }
 }
        private List<Sprite> StaticBlockSprites; //floats, metal and switch blocks (all immune to dying)

        #endregion Fields

        #region Constructors

        public BlockManager(World _world, ContactListener _contactListener)
        {
            BlockSprites = new List<Sprite>();
            StaticBlockSprites = new List<Sprite>();
            physicsWorld = _world;
            contactListener = _contactListener;
            contactListener.DamageBlock += new ContactListener.DamageEventHandler(contactListener_DamageBlock);
            contactListener.DamageSwitch += new ContactListener.DamageEventHandler(contactListener_DamageSwitch);
            contactListener.BlockExploded += new ContactListener.EffectEventHandler(contactListener_BlockExploded);
        }
        public EnemyManager(World _world, ContactListener _contactListener)
        {
            FruitSprites = new List<Sprite>();
            VeggieSprites = new List<Sprite>();
            physicsWorld = _world;
            contactListener = _contactListener;

            contactListener.DamageVeggie += new ContactListener.DamageEventHandler(contactListener_DamageVeggie);
            contactListener.VeggieExploded += new ContactListener.EffectEventHandler(contactListener_VeggieExploded);
            contactListener.DamageBoss += new ContactListener.DamageEventHandler(contactListener_DamageBoss);
        }
Example #8
0
        public Island(int bodyCapacity, int contactCapacity, int jointCapacity, ContactListener listener)
        {
            m_bodyCapacity    = bodyCapacity;
            m_contactCapacity = contactCapacity;

            m_listener = listener;

            m_bodies   = new Body[bodyCapacity];
            m_contacts = new Contact[contactCapacity];
            m_joints   = new Joint[jointCapacity];

            m_velocities = new Velocity[m_bodyCapacity];
            m_positions  = new Position[m_bodyCapacity];
        }
Example #9
0
        public void init(int bodyCapacity, int contactCapacity, int jointCapacity,
                         ContactListener listener)
        {
            // System.out.println("Initializing Island");
            m_bodyCapacity    = bodyCapacity;
            m_contactCapacity = contactCapacity;
            m_jointCapacity   = jointCapacity;
            m_bodyCount       = 0;
            m_contactCount    = 0;
            m_jointCount      = 0;

            m_listener = listener;

            if (m_bodies == null || m_bodyCapacity > m_bodies.Length)
            {
                m_bodies = new Body[m_bodyCapacity];
            }
            if (m_joints == null || m_jointCapacity > m_joints.Length)
            {
                m_joints = new Joint[m_jointCapacity];
            }
            if (m_contacts == null || m_contactCapacity > m_contacts.Length)
            {
                m_contacts = new Contact[m_contactCapacity];
            }

            // dynamic array
            if (m_velocities == null || m_bodyCapacity > m_velocities.Length)
            {
                Velocity[] old = m_velocities == null ? new Velocity[0] : m_velocities;
                m_velocities = new Velocity[m_bodyCapacity];
                ArrayHelper.Copy(old, 0, m_velocities, 0, old.Length);
                for (int i = old.Length; i < m_velocities.Length; i++)
                {
                    m_velocities[i] = new Velocity();
                }
            }

            // dynamic array
            if (m_positions == null || m_bodyCapacity > m_positions.Length)
            {
                Position[] old = m_positions == null ? new Position[0] : m_positions;
                m_positions = new Position[m_bodyCapacity];
                ArrayHelper.Copy(old, 0, m_positions, 0, old.Length);
                for (int i = old.Length; i < m_positions.Length; i++)
                {
                    m_positions[i] = new Position();
                }
            }
        }
        private int towerTimerTotal = 2000; //ms the reset to value

        #endregion Fields

        #region Constructors

        public HazardManager(World _world, ContactListener _contactListener)
        {
            HazardSprites = new List<Sprite>();
            TowerSprites = new List<Sprite>();
            physicsWorld = _world;
            contactListener = _contactListener;
            contactListener.DamageSwitch += new ContactListener.DamageEventHandler(contactListener_DamageSwitch);
            contactListener.DamageCreature += new ContactListener.DamageEventHandler(contactListener_DamageCreature);
            contactListener.DamageSaw += new ContactListener.DamageEventHandler(contactListener_DamageSaw);
            contactListener.DamageFan += new ContactListener.DamageEventHandler(contactListener_DamageFan);
            contactListener.DamageSpike += new ContactListener.DamageEventHandler(contactListener_DamageSpike);
            contactListener.DamageBee += new ContactListener.DamageEventHandler(contactListener_DamageBee);
            contactListener.BeeDeflection += new ContactListener.EffectEventHandler(contactListener_BeeDeflection);
            contactListener.SpringDeflection += new ContactListener.EffectEventHandler(contactListener_SpringDeflection);
            contactListener.WindDeflection += new ContactListener.EffectEventHandler(contactListener_WindDeflection);
        }
        /// <summary>
        /// Initialise world with the specified SimulationParameters.
        /// </summary>
        /// <param name="simParams"></param>
        protected void InitSimulationWorld(SimulationParameters simParams)
        {
            _simParams = simParams;
            _world     = CreateBox2DWorld();

            // Allow physics calcs to use values from previous timestep.
            _world.SetWarmStarting(_simParams._warmStarting);

            // Enable additional collision detection for high speed objects (that might not ever contact each other at a given timestep due to speed).
            _world.SetContinuousPhysics(_simParams._continuousPhysics);

            // Put stuff in the world.
            PopulateWorld();

            // Create contact listener.
            ContactListener contactListener = CreateContactListener();

            if (null != contactListener)
            {
                _world.SetContactListener(contactListener);
            }
        }
        public EffectManager(World _world, ContactListener _contactListener, Color _tint)
        {
            physicsWorld = _world;
            contactListener = _contactListener;
            tint = _tint;
            EffectSprites = new List<Sprite>();

            contactListener.FruitExploded += new ContactListener.EffectEventHandler(contactListener_FruitExploded);
            contactListener.VeggieExploded += new ContactListener.EffectEventHandler(contactListener_VeggieExploded);
            contactListener.BlockExploded += new ContactListener.EffectEventHandler(contactListener_BlockExploded);
            contactListener.BombExploded += new ContactListener.EffectEventHandler(contactListener_BombExploded);
            contactListener.ShotFired += new ContactListener.EffectEventHandler(contactListener_ShotFired);
            contactListener.FanActivated += new ContactListener.EffectEventHandler(contactListener_FanActivated);
            contactListener.CreatureExploded += new ContactListener.EffectEventHandler(contactListener_CreatureExploded);
            contactListener.FireShotExploded += new ContactListener.EffectEventHandler(contactListener_FireShotExploded);
            contactListener.IceShotExploded += new ContactListener.EffectEventHandler(contactListener_IceShotExploded);
            contactListener.LitShotExploded += new ContactListener.EffectEventHandler(contactListener_LitShotExploded);
            //contactListener.DamageBlock += new ContactListener.DamageEventHandler(contactListener_DamageBlock);
            //contactListener.DamageFruit += new ContactListener.DamageEventHandler(contactListener_DamageFruit);
            //contactListener.DamageVeggie += new ContactListener.DamageEventHandler(contactListener_DamageVeggie);
            //contactListener.DamageExplosive += new ContactListener.DamageEventHandler(contactListener_DamageExplosive);
            contactListener.DamageSnowball += new ContactListener.DamageEventHandler(contactListener_DamageSnowball);
            contactListener.Poof += new ContactListener.EffectEventHandler(contactListener_Poof);
            contactListener.SmallPoof += new ContactListener.EffectEventHandler(contactListener_SmallPoof);
            contactListener.ImpactPoofs += new ContactListener.EffectEventHandler(contactListener_ImpactPoofs);
            contactListener.SnowballThrown += new ContactListener.EffectEventHandler(contactListener_SnowballThrown);
            contactListener.TowerSawShot += new ContactListener.EffectEventHandler(contactListener_TowerSawShot);
            contactListener.NewSpiderThread += new ContactListener.EffectEventHandler(contactListener_NewSpiderThread);
            contactListener.LemonActivated += new ContactListener.EffectEventHandler(contactListener_LemonActivated);
            contactListener.WaterSplash += new ContactListener.EffectEventHandler(contactListener_WaterSplash);
            contactListener.LavaSplash += new ContactListener.EffectEventHandler(contactListener_LavaSplash);
            contactListener.EmberCreated += new ContactListener.EffectEventHandler(contactListener_EmberCreated);
            contactListener.DropCreated += new ContactListener.EffectEventHandler(contactListener_DropCreated);
            contactListener.WindParticleCreated += new ContactListener.EffectEventHandler(contactListener_WindParticleCreated);
            contactListener.FruitMotionBlur += new ContactListener.EffectEventHandler(contactListener_FruitMotionBlur);
            contactListener.CreateTNTBarrel += new ContactListener.EffectEventHandler(contactListener_CreateTNTBarrel);
        }
        public void Init()
        {
            this.World = new World(new Vec2(0, 35));


            this.CreateRectangleWall(0, -this.GameBoard.GameModel.BoardHeight, 1, this.GameBoard.GameModel.BoardHeight * 2, null);
            this.CreateRectangleWall(this.GameBoard.GameModel.BoardWidth, -this.GameBoard.GameModel.BoardHeight, 1, this.GameBoard.GameModel.BoardHeight * 2, null);
            this.CreateRectangleWall(0, this.GameBoard.GameModel.BoardHeight, this.GameBoard.GameModel.BoardWidth, 1, null);


            this.Collisions = new List <CollisionObject>();

            var myListener = new ContactListener();

            myListener.beginContact = (fixture) =>
            {
                if (fixture.getFixtureA().getBody().getUserData() != null)
                {
                    if (fixture.getFixtureA().getBody().getUserData() is ICollider)
                    {
                        this.Collisions.Add(new CollisionObject((ICollider)fixture.getFixtureA().getBody().getUserData(), (ICollider)fixture.getFixtureB().getBody().getUserData()));
                    }
                }

                if (fixture.getFixtureB().getBody().getUserData() != null)
                {
                    if (fixture.getFixtureB().getBody().getUserData() is ICollider)
                    {
                        this.Collisions.Add(new CollisionObject((ICollider)fixture.getFixtureB().getBody().getUserData(), (ICollider)fixture.getFixtureA().getBody().getUserData()));
                    }
                }
            };


            this.World.setContactListener(myListener);
        }
Example #14
0
 public static void RegisterContactListener(ContactListener contactListener)
 {
     ContactListeners.Add(contactListener);
 }
		protected override void AddedToScene()
		{
			base.AddedToScene();

			layerInstance = this;

			//get screen size
			screenSize = Window.WindowSizeInPixels; //CCDirector::sharedDirector()->getWinSize();



			//INITIAL VARIABLES.... (D O N T    E D I T )

			// enable touches
#if XBOX || OUYA
            TouchEnabled = false;
            GamePadEnabled = true;
#else
			//TouchEnabled = true;

			CCEventListenerTouchAllAtOnce tListener = new CCEventListenerTouchAllAtOnce();

			tListener.OnTouchesBegan = TouchesBegan;
			//tListener.OnTouchesCancelled = TouchesCancelled;
			tListener.OnTouchesEnded = TouchesEnded;
			tListener.OnTouchesMoved = TouchesMoved;

			AddEventListener(tListener, this);

#endif


			// enable accelerometer
			//AccelerometerEnabled = false;

#if iPHONE || iOS
			IS_IPAD = MonoTouch.UIKit.UIDevice.CurrentDevice.UserInterfaceIdiom 
				== MonoTouch.UIKit.UIUserInterfaceIdiom.Pad;

			IS_RETINA = MonoTouch.UIKit.UIScreen.MainScreen.Bounds.Height 
				* MonoTouch.UIKit.UIScreen.MainScreen.Scale >= 1136;
#endif
#if WINDOWS || MACOS || MONOMAC || LINUX || OUYA || XBOX
			IS_IPAD = true;
			IS_RETINA = true;
#endif

			IS_IPHONE = !IS_IPAD;

			// ask director for the window size
			screenWidth = (int)screenSize.Width;
			screenHeight = (int)screenSize.Height;

			throwInProgress = false; //is a throw currently in progress, as in, is a ninja in midair (mostly used to prevent tossing two ninjas, one right after another)
			areWeInTheStartingPosition = true;  //is the world back at 0 on the X axis (if yes, then we can put a ninja in the sling)

			throwCount = 0;
			dotTotalOnOddNumberedTurn = 0;
			dotTotalOnEvenNumberedTurn = 0;

			currentLevel = GameData.SharedData.Level;  // use currentLevel =  0 for testing new shapes, will call [self buildLevelWithAllShapes];

			pointTotalThisRound = 0;
			pointsToPassLevel = GameData.SharedData.PointsToPassLevel;
			bonusPerExtraNinja = GameData.SharedData.BonusPerExtraNinja;

			CCLog.Log(string.Format("The level is {0}, you need {1} to move up a level", currentLevel, pointsToPassLevel));

			//PREFERENCE VARIABLES....

			openWithMenuInsteadOfGame = false; // start with the menu opening the game

			continuePanningScreenOnFingerRelease = true; // if the screen panning is midway between either the sling or targets, when you release your finger the screen will continue panning the last direction it moved (jumpy on iPhone if set to NO)
			reverseHowFingerPansScreen = false; //switch to yes to reverse. 
			topRightTouchEnablesDebugMode = true;  //SET TO NO IN FINAL BUILD
			useImagesForPointScoreLabels = true; //IF NO, means you use Marker Felt text for scores

			//set up background art

			backgroundLayerClouds = new CCSprite(GameData.SharedData.BackgroundCloudsFileName);  // will return the background clouds file for a particular level
			AddChild(backgroundLayerClouds, Constants.DepthClouds);

			backgroundLayerHills = new CCSprite(GameData.SharedData.BackgroundHillsFileName);  // will return the background hills file for a particular level
			AddChild(backgroundLayerHills, Constants.DepthHills);
			backgroundLayerHills.ScaleX = 1.05f;

			slingShotFront = new CCSprite("slingshot_front");
			AddChild(slingShotFront, Constants.DepthSlingShotFront);

			strapFront = new CCSprite("strap");
			AddChild(strapFront, Constants.DepthStrapFront);


			strapBack = new CCSprite("strapBack");
			AddChild(strapBack, Constants.DepthStrapBack);

			strapEmpty = new CCSprite("strapEmpty");
			AddChild(strapEmpty, Constants.DepthStrapBack);


			strapBack.Visible = false;  //visible only when stretching
			strapFront.Visible = false; //visible only when stretching



			//setup positions and variables for iPad devices or iPhones

			if (IS_IPAD)
			{
				areWeOnTheIPad = true;

				//vars 

				maxStretchOfSlingShot = 75; //best to leave as is, since this value ties in closely to the image size of strap.png. (should be 1/4 the size of the source image)
				multipyThrowPower = 1; // fine tune how powerful the sling shot is. Range is probably best between .5 to 1.5, currently for the iPad 1.0 is good

				worldMaxHorizontalShift = -(screenWidth);  // This determines how far the user can slide left or right to see the entire board. Always a negative number. 
				maxScaleDownValue = 1.0f; //dont change
				scaleAmount = 0; // increment to change the scale of the entire world when panning  
				initialPanAmount = 30; //how fast the screen pan starts
				extraAmountOnPanBack = 10; // I like a faster pan back. Adding a bit more
				adjustY = 0; // best to leave at 0 for iPad (moves the world down when panning)

				//background stuff

				backgroundLayerClouds.Position = new CCPoint(screenWidth, screenHeight / 2);
				backgroundLayerHills.Position = new CCPoint(screenWidth, screenHeight / 2);

				if (!IS_RETINA)
				{


					//non retina adjustment


				}
				else
				{

					//retina adjustment

					backgroundLayerClouds.Scale = 2.0f;
					backgroundLayerHills.Scale = 2.0f;
				}


				menuStartPosition = new CCPoint(130, screenSize.Height - 24);
				currentScoreLabelStartPosition = new CCPoint(200, screenSize.Height - 60);
				highScoreLabelStartPosition = new CCPoint(200, screenSize.Height - 80);

				fontSizeForScore = 22;

				//ground plane and platform

				groundPlaneStartPosition = new CCPoint(screenWidth, 50);
				platformStartPosition = new CCPoint(340, 190);

				//sling shot
				slingShotCenterPosition = new CCPoint(370, 255);

				slingShotFront.Position = new CCPoint(374, 240);
				strapFront.Position = new CCPoint(slingShotCenterPosition.X, slingShotCenterPosition.Y);
				strapBack.Position = new CCPoint(slingShotCenterPosition.X + 33, slingShotCenterPosition.Y - 10);
				strapEmpty.Position = new CCPoint(378, 235);

				//ninja

				ninjaStartPosition1 = new CCPoint(380, 250);
				ninjaStartPosition2 = new CCPoint(300, 155);
				ninjaStartPosition3 = new CCPoint(260, 155);
				ninjaStartPosition4 = new CCPoint(200, 120);
				ninjaStartPosition5 = new CCPoint(160, 120);

			}

			else if (IS_IPHONE)
			{
				//CCLOG (@"this is an iphone");

				areWeOnTheIPad = false;

				//vars 
				maxStretchOfSlingShot = 75; //best to leave as is, since this value ties in closely to the image size of strap.png. (should be 1/4 the size of the source image)
				multipyThrowPower = 1.0f; // fine tune how powerful the sling shot is. Range is probably best between .5 to 1.5, and a little goes a long way

				worldMaxHorizontalShift = -(screenWidth); // This determines how far the user can slide left or right to see the entire board. Always a negative number
				maxScaleDownValue = 0.65f; //range should probably be between 0.75 and 1.0;
				scaleAmount = .01f; // increment to change the scale of the entire world when panning
				adjustY = -34;

				initialPanAmount = 20; //how fast the screen pan starts
				extraAmountOnPanBack = 0; // best to leave at 0 on iPhone

				//background stuff



				if (!IS_RETINA)
				{

					//non retina adjustment

					backgroundLayerClouds.Position = new CCPoint(screenWidth, 192);
					backgroundLayerClouds.Scale = .7f;
					backgroundLayerHills.Position = new CCPoint(screenWidth, 245);
					backgroundLayerHills.Scale = .7f;

				}
				else
				{

					//retina adjustment

					backgroundLayerClouds.Position = new CCPoint(screenWidth, 192);
					backgroundLayerClouds.Scale = 1.7f;
					backgroundLayerHills.Position = new CCPoint(screenWidth, 265);
					backgroundLayerHills.Scale = 1.7f;
				}



				menuStartPosition = new CCPoint(70, screenSize.Height - 17);
				currentScoreLabelStartPosition = new CCPoint(140, screenSize.Height - 50); //score label
				highScoreLabelStartPosition = new CCPoint(140, screenSize.Height - 70);
				fontSizeForScore = 18;

				//ground plane and platform

				groundPlaneStartPosition = new CCPoint(screenWidth, -25);
				platformStartPosition = new CCPoint(130, 120);

				//sling shot

				slingShotCenterPosition = new CCPoint(160, 185);
				slingShotFront.Position = new CCPoint(164, 170);
				strapFront.Position = new CCPoint(slingShotCenterPosition.X, slingShotCenterPosition.Y);
				strapBack.Position = new CCPoint(slingShotCenterPosition.X + 33, slingShotCenterPosition.Y - 10);
				strapEmpty.Position = new CCPoint(168, 163);

				//ninja

				ninjaStartPosition1 = new CCPoint(170, 175);
				ninjaStartPosition2 = new CCPoint(110, 82);
				ninjaStartPosition3 = new CCPoint(65, 82);
				ninjaStartPosition4 = new CCPoint(90, 65);
				ninjaStartPosition5 = new CCPoint(43, 65);



			}

			SetUpParticleSystemSun();

			CCMenuItemImage button1 = new CCMenuItemImage("gameMenu", "gameMenu", ShowMenu);

			MenuButton = new CCMenu(button1);
			MenuButton.Position = menuStartPosition;
			AddChild(MenuButton, Constants.DepthScore);



			// assign CCPoints to keep track of the starting positions of objects that move relative to the entire layer.

			hillsLayerStartPosition = backgroundLayerHills.Position;
			cloudLayerStartPosition = backgroundLayerClouds.Position;

			// Define the gravity vector.

			yAxisGravity = -9.81f;

			b2Vec2 gravity = b2Vec2.Zero;
			gravity.Set(0.0f, yAxisGravity);


			// Construct a world object, which will hold and simulate the rigid bodies.
			world = new b2World(gravity);

			world.AllowSleep = false;

			world.SetContinuousPhysics(true);

			//EnableDebugMode();


			// Define the ground body.
			var groundBodyDef = new b2BodyDef();  // Make sure we call 
			groundBodyDef.position.Set(0, 0); // bottom-left corner

			// Call the body factory which allocates memory for the ground body
			// from a pool and creates the ground box shape (also from a pool).
			// The body is also added to the world.
			b2Body groundBody = world.CreateBody(groundBodyDef);

			// Define the ground box shape.
			b2EdgeShape groundBox = new b2EdgeShape();

			int worldMaxWidth = screenWidth * 4; //If you ever want the BOX2D world width to be more than it is then increase this  (currently, this should be plenty of extra space)
			int worldMaxHeight = screenHeight * 3; //If you ever want the BOX2D world height to be more  than it is then increase this (currently, this should be plenty of extra space)

			// bottom
			groundBox.Set(new b2Vec2(-4, 0), new b2Vec2(worldMaxWidth / Constants.PTM_RATIO, 0));
			groundBody.CreateFixture(groundBox, 0);

			// top
			groundBox.Set(new b2Vec2(-4, worldMaxHeight / Constants.PTM_RATIO), new b2Vec2(worldMaxWidth / Constants.PTM_RATIO, worldMaxHeight / Constants.PTM_RATIO));
			groundBody.CreateFixture(groundBox, 0);

			// left
			groundBox.Set(new b2Vec2(-4, worldMaxHeight / Constants.PTM_RATIO), new b2Vec2(-4, 0));
			groundBody.CreateFixture(groundBox, 0);

			// right
			groundBox.Set(new b2Vec2(worldMaxWidth / Constants.PTM_RATIO, worldMaxHeight / Constants.PTM_RATIO), new b2Vec2(worldMaxWidth / Constants.PTM_RATIO, 0));
			groundBody.CreateFixture(groundBox, 0);

			//Contact listener 
			contactListener = new ContactListener();
			world.SetContactListener(contactListener);

			//Set up the ground plane

			theGroundPlane = new GroundPlane(world, groundPlaneStartPosition, GameData.SharedData.GroundPlaneFileName);
			AddChild(theGroundPlane, Constants.DepthFloor);


			//Set up the starting platform

			thePlatform = new StartPlatform(world, platformStartPosition, "platform");
			AddChild(thePlatform, Constants.DepthPlatform);

			//Set up ninjas

			ninjaBeingThrown = 1; //always starts at 1 (first ninja, then second ninja, and so on) 
			ninjasToTossThisLevel = GameData.SharedData.NumberOfNinjasToTossThisLevel;  //total number of ninjas to toss for this level



			ninja1 = new Ninja(world, ninjaStartPosition1, @"ninja");
			AddChild(ninja1, Constants.DepthNinjas);

			currentBodyNode = ninja1;

			currentBodyNode.SpriteInSlingState();

			if (ninjasToTossThisLevel >= 2)
			{

				ninja2 = new Ninja(world, ninjaStartPosition2, @"ninjaRed");
				AddChild(ninja2, Constants.DepthNinjas);
				ninja2.SpriteInStandingState();

			}
			if (ninjasToTossThisLevel >= 3)
			{

				ninja3 = new Ninja(world, ninjaStartPosition3, @"ninjaBlue");
				AddChild(ninja3, Constants.DepthNinjas);
				ninja3.SpriteInStandingState();
			}
			if (ninjasToTossThisLevel >= 4)
			{

				ninja4 = new Ninja(world, ninjaStartPosition4, @"ninjaBrown");
				AddChild(ninja4, Constants.DepthNinjas);
				ninja4.SpriteInStandingState();
			}
			if (ninjasToTossThisLevel >= 5)
			{

				ninja5 = new Ninja(world, ninjaStartPosition5, @"ninjaGreen");
				AddChild(ninja5, Constants.DepthNinjas);
				ninja5.SpriteInStandingState();
			}

			//Build the Stack. 

			stack = new TheStack(world);
			AddChild(stack, Constants.DepthStack);


			//give the stack a moment to drop, then switches every pieces to static (locks it into position, until the first slingshot)...
			ScheduleOnce(SwitchAllStackObjectsToStatic, 1.0f);

			currentScoreLabel = new CCLabelTtf(String.Format("{0}: Needed", pointsToPassLevel), "MarkerFelt", fontSizeForScore);
			AddChild(currentScoreLabel, Constants.DepthScore);
			currentScoreLabel.Color = new CCColor3B(255, 255, 255);
			currentScoreLabel.Position = currentScoreLabelStartPosition;
			currentScoreLabel.AnchorPoint = new CCPoint(1, .5f);
			// HighScoreForLevel
			highScoreLabel = new CCLabelTtf(String.Format("High Score: {0}", GameData.SharedData.HighScoreForLevel), "MarkerFelt", fontSizeForScore);
			AddChild(highScoreLabel, Constants.DepthScore);
			highScoreLabel.Color = new CCColor3B(255, 255, 255);

			highScoreLabel.Position = currentScoreLabel.Position - new CCPoint(0, highScoreLabel.ContentSize.Height);// highScoreLabelStartPosition;
			highScoreLabel.AnchorPoint = new CCPoint(1, .5f);
			highScoreLabelStartPosition = highScoreLabel.Position;


			var levelString = string.Format("Level: {0}", currentLevel);
			ShowBoardMessage(levelString);

			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log("/////////////////////////////////////////////////////");
			CCLog.Log("/////////////////////////////////////////////////////");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log("The art and animation in this template is copyright CartoonSmart LLC");
			CCLog.Log("You must make significant changes to the art before submitting your game to the App Store");
			CCLog.Log("Please create your own characters, backgrounds, etc and spend the time to make the game look totally unique");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log("The Video guide for this template is at https://vimeo.com/cartoonsmart/angryninjasguide  ");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log("/////////////////////////////////////////////////////");
			CCLog.Log("/////////////////////////////////////////////////////");
			CCLog.Log(" ");
			CCLog.Log(" ");




			GameSounds.SharedGameSounds.IntroTag();

			if (GameData.SharedData.Level == 1)
			{

				GameSounds.SharedGameSounds.PlayBackgroundMusic(AmbientFXSounds.Frogs);

			}
			else
			{

				GameSounds.SharedGameSounds.PlayBackgroundMusic(AmbientFXSounds.Insects);
			}

			if (GameData.SharedData.FirstRunEver && openWithMenuInsteadOfGame)
			{
				CCLog.Log("First run ever");
				Schedule(ShowMenuFromSelector, 2f);
				GameData.SharedData.FirstRunEver = false;
			}

			// Always do this last.
			this.Schedule(Tick);
		}
Example #16
0
        public override void Evaluate(ContactListener listener)
        {
            Body b1 = _shape1.GetBody();
            Body b2 = _shape2.GetBody();

            //memcpy(&m0, &m_manifold, sizeof(b2Manifold));
            Manifold m0 = _manifold.Clone();

            Collision.Collision.CollideCircles(ref _manifold, (CircleShape)_shape1, b1.GetXForm(),
                                               (CircleShape)_shape2, b2.GetXForm());

            ContactPoint cp = new ContactPoint();

            cp.Shape1      = _shape1;
            cp.Shape2      = _shape2;
            cp.Friction    = Settings.MixFriction(_shape1.Friction, _shape2.Friction);
            cp.Restitution = Settings.MixRestitution(_shape1.Restitution, _shape2.Restitution);

            if (_manifold.PointCount > 0)
            {
                _manifoldCount = 1;
                ManifoldPoint mp = _manifold.Points[0];

                if (m0.PointCount == 0)
                {
                    mp.NormalImpulse  = 0.0f;
                    mp.TangentImpulse = 0.0f;

                    if (listener != null)
                    {
                        cp.Position = b1.GetWorldPoint(mp.LocalPoint1);
                        Vector2 v1 = b1.GetLinearVelocityFromLocalPoint(mp.LocalPoint1);
                        Vector2 v2 = b2.GetLinearVelocityFromLocalPoint(mp.LocalPoint2);
                        cp.Velocity   = v2 - v1;
                        cp.Normal     = _manifold.Normal;
                        cp.Separation = mp.Separation;
                        cp.ID         = mp.ID;
                        listener.Add(cp);
                    }
                }
                else
                {
                    ManifoldPoint mp0 = m0.Points[0];
                    mp.NormalImpulse  = mp0.NormalImpulse;
                    mp.TangentImpulse = mp0.TangentImpulse;

                    if (listener != null)
                    {
                        cp.Position = b1.GetWorldPoint(mp.LocalPoint1);
                        Vector2 v1 = b1.GetLinearVelocityFromLocalPoint(mp.LocalPoint1);
                        Vector2 v2 = b2.GetLinearVelocityFromLocalPoint(mp.LocalPoint2);
                        cp.Velocity   = v2 - v1;
                        cp.Normal     = _manifold.Normal;
                        cp.Separation = mp.Separation;
                        cp.ID         = mp.ID;
                        listener.Persist(cp);
                    }
                }
            }
            else
            {
                _manifoldCount = 0;
                if (m0.PointCount > 0 && listener != null)
                {
                    ManifoldPoint mp0 = m0.Points[0];
                    cp.Position = b1.GetWorldPoint(mp0.LocalPoint1);
                    Vector2 v1 = b1.GetLinearVelocityFromLocalPoint(mp0.LocalPoint1);
                    Vector2 v2 = b2.GetLinearVelocityFromLocalPoint(mp0.LocalPoint2);
                    cp.Velocity   = v2 - v1;
                    cp.Normal     = m0.Normal;
                    cp.Separation = mp0.Separation;
                    cp.ID         = mp0.ID;
                    listener.Remove(cp);
                }
            }
        }
        public ShotManager(World _world, ContactListener _contactListener)
        {
            ammoUI = new List<Sprite>();

            splitShot = new List<Sprite>(3);
            splitShot.Add(new Sprite(20, 63, Vector2.Zero,false));
            splitShot.Add(new Sprite(20, 63, Vector2.Zero,false));
            splitShot.Add(new Sprite(20, 63, Vector2.Zero,false));
            for (int i=0; i < 3; i++)
            {
                splitShot[i].SpriteType = Sprite.Type.FruitShot;
                splitShot[i].IsVisible = false;
                splitShot[i].IsExpired = false;
                splitShot[i].IsAwake = false;
                splitShot[i].IsHit = false;
                splitShot[i].TintColor = Color.White;
                splitShot[i].AnimationFPS = animationSpeed;
                splitShot[i].CurrentFrame = LevelDataManager.rand.Next(0, 3);
                splitShot[i].pathing = Sprite.Pathing.None;
            }

            shot = new Sprite(20, 0, Vector2.Zero,false);
            shot.IsExpired = false;
            shot.HitPoints = 1;
            shot.IsVisible = false;
            shot.SpriteType = Sprite.Type.FruitShot;

            PowerUpSprites = new List<Sprite>();
            ActivePowerUpBarrel = new Sprite(0, 0, Vector2.Zero, false);
            ActivePowerUpBarrel.IsExpired = true;
            ShotStartBarrel = new Sprite(0, 0, Vector2.Zero, false);
            ShotStartBarrel.IsExpired = true;

            physicsWorld = _world;
            contactListener = _contactListener;
            contactListener.PowerUpActivated += new ContactListener.EffectEventHandler(contactListener_PowerUpActivated);
            contactListener.DamageShot += new ContactListener.DamageEventHandler(contactListener_DamageShot);
            contactListener.StarCollected += new ContactListener.EffectEventHandler(contactListener_StarCollected);
            contactListener.BananaActivated += new ContactListener.EffectEventHandler(contactListener_BananaActivated);
            contactListener.LemonActivated += new ContactListener.EffectEventHandler(contactListener_LemonActivated);
            contactListener.AddPowerBarrel += new ContactListener.EffectEventHandler(contactListener_AddPowerBarrel);

            #region setup fruit in the Ammo UI, detect unlocked
            if (GameSettings.isBoss)
            {
                ammoUI.Add(new Sprite(20, 0, new Vector2(bossAmmoLocation.X + 6, bossAmmoLocation.Y + 0), false));
                ammoUI.Add(new Sprite(20, 21, new Vector2(bossAmmoLocation.X + 70, bossAmmoLocation.Y + 0), false));
                ammoUI.Add(new Sprite(20, 28, new Vector2(bossAmmoLocation.X + 134, bossAmmoLocation.Y + 0), false));
                ammoUI.Add(new Sprite(20, 35, new Vector2(bossAmmoLocation.X + 198, bossAmmoLocation.Y + 0), false));
                ammoUI.Add(new Sprite(20, 42, new Vector2(bossAmmoLocation.X + 262, bossAmmoLocation.Y + 0), false));
                ammoUI.Add(new Sprite(20, 49, new Vector2(bossAmmoLocation.X + 326, bossAmmoLocation.Y + 0), false));
                ammoUI.Add(new Sprite(20, 56, new Vector2(bossAmmoLocation.X + 390, bossAmmoLocation.Y + 0), false));
            }
            else
            {
                ammoUI.Add(new Sprite(20, 0, new Vector2(ammoUILocation.X + 6, ammoUILocation.Y + 0), false));
                ammoUI.Add(new Sprite(20, 21, new Vector2(ammoUILocation.X + 70, ammoUILocation.Y + 0), false));
                ammoUI.Add(new Sprite(20, 28, new Vector2(ammoUILocation.X + 134, ammoUILocation.Y + 0), false));
                ammoUI.Add(new Sprite(20, 35, new Vector2(ammoUILocation.X + 198, ammoUILocation.Y + 0), false));
                ammoUI.Add(new Sprite(20, 42, new Vector2(ammoUILocation.X + 262, ammoUILocation.Y + 0), false));
                ammoUI.Add(new Sprite(20, 49, new Vector2(ammoUILocation.X + 326, ammoUILocation.Y + 0), false));
                ammoUI.Add(new Sprite(20, 56, new Vector2(ammoUILocation.X + 390, ammoUILocation.Y + 0), false));
            }

            #if XBOX
            if (!Guide.IsTrialMode)
            #endif
            {
                if (GameSettings.LocksOn)
                {
                    int count = 0;
                    for (int i = 0; i < 5; i++)
                    {
                        if (LevelDataManager.levelData[1, 6 + i].IsBronze()) count++;
                    }
                    if (count < 2)
                    {
                        ammoUI[1].IsVisible = false;
                        ammoUI[1].TintColor = Color.Gray;
                    }
                }
                if (!LevelDataManager.levelData[2, 1].unlocked && GameSettings.LocksOn)
                {
                    ammoUI[2].IsVisible = false;
                    ammoUI[2].TintColor = Color.Gray;
                }
                if (GameSettings.LocksOn)
                {
                    int count = 0;
                    for (int i = 0; i < 5; i++)
                    {
                        if (LevelDataManager.levelData[2, 6 + i].IsBronze()) count++;
                    }
                    if (count < 2)
                    {
                        ammoUI[3].IsVisible = false;
                        ammoUI[3].TintColor = Color.Gray;
                    }
                }
                if (!LevelDataManager.levelData[3, 1].unlocked && GameSettings.LocksOn)
                {
                    ammoUI[4].IsVisible = false;
                    ammoUI[4].TintColor = Color.Gray;
                }
                if (!LevelDataManager.levelData[4, 1].unlocked && GameSettings.LocksOn)
                {
                    ammoUI[5].IsVisible = false;
                    ammoUI[5].TintColor = Color.Gray;
                }
                if (!LevelDataManager.levelData[5, 1].unlocked && GameSettings.LocksOn)
                {
                    ammoUI[6].IsVisible = false;
                    ammoUI[6].TintColor = Color.Gray;
                }
            }

            foreach (Sprite sprite in ammoUI)
            {
                sprite.AnimationFPS = animationSpeed;
                sprite.CurrentFrame = LevelDataManager.rand.Next(0, 3);
                sprite.HitPoints = 0;
            }
            #endregion

            if (LevelDataManager.levelData[LevelDataManager.world, LevelDataManager.level].starCollected) powerStarCollected = true;
        }
Example #18
0
 // Позволяет установить солвер
 public void SetSolver(ContactListener listener)
 {
     world.SetContactListener(listener);
 }
Example #19
0
        public virtual void update(ContactListener listener)
        {
            oldManifold.set_Renamed(m_manifold);

            // Re-enable this contact.
            m_flags |= ENABLED_FLAG;

            bool touching = false;
            bool wasTouching = (m_flags & TOUCHING_FLAG) == TOUCHING_FLAG;

            bool sensorA = m_fixtureA.Sensor;
            bool sensorB = m_fixtureB.Sensor;
            bool sensor = sensorA || sensorB;

            Body bodyA = m_fixtureA.Body;
            Body bodyB = m_fixtureB.Body;
            Transform xfA = bodyA.getTransform();
            Transform xfB = bodyB.getTransform();
            // log.debug("TransformA: "+xfA);
            // log.debug("TransformB: "+xfB);

            if (sensor)
            {
                Shape shapeA = m_fixtureA.Shape;
                Shape shapeB = m_fixtureB.Shape;
                touching = pool.getCollision().testOverlap(shapeA, m_indexA, shapeB, m_indexB, xfA, xfB);

                // Sensors don't generate manifolds.
                m_manifold.pointCount = 0;
            }
            else
            {
                evaluate(m_manifold, xfA, xfB);
                touching = m_manifold.pointCount > 0;

                // Match old contact ids to new contact ids and copy the
                // stored impulses to warm start the solver.
                for (int i = 0; i < m_manifold.pointCount; ++i)
                {
                    ManifoldPoint mp2 = m_manifold.points[i];
                    mp2.normalImpulse = 0.0f;
                    mp2.tangentImpulse = 0.0f;
                    ContactID id2 = mp2.id;

                    for (int j = 0; j < oldManifold.pointCount; ++j)
                    {
                        ManifoldPoint mp1 = oldManifold.points[j];

                        if (mp1.id.isEqual(id2))
                        {
                            mp2.normalImpulse = mp1.normalImpulse;
                            mp2.tangentImpulse = mp1.tangentImpulse;
                            break;
                        }
                    }
                }

                if (touching != wasTouching)
                {
                    bodyA.Awake = true;
                    bodyB.Awake = true;
                }
            }

            if (touching)
            {
                m_flags |= TOUCHING_FLAG;
            }
            else
            {
                m_flags &= ~TOUCHING_FLAG;
            }

            if (listener == null)
            {
                return;
            }

            if (wasTouching == false && touching == true)
            {
                listener.beginContact(this);
            }

            if (wasTouching == true && touching == false)
            {
                listener.endContact(this);
            }

            if (sensor == false && touching)
            {
                listener.preSolve(this, oldManifold);
            }
        }
Example #20
0
        public void init(int bodyCapacity, int contactCapacity, int jointCapacity,
            ContactListener listener)
        {
            // System.ref.println("Initializing Island");
            m_bodyCapacity = bodyCapacity;
            m_contactCapacity = contactCapacity;
            m_jointCapacity = jointCapacity;
            m_bodyCount = 0;
            m_contactCount = 0;
            m_jointCount = 0;

            m_listener = listener;

            if (m_bodies == null || m_bodyCapacity > m_bodies.Length)
            {
                m_bodies = new Body[m_bodyCapacity];
            }
            if (m_joints == null || m_jointCapacity > m_joints.Length)
            {
                m_joints = new Joint[m_jointCapacity];
            }
            if (m_contacts == null || m_contactCapacity > m_contacts.Length)
            {
                m_contacts = new Contact[m_contactCapacity];
            }

            // dynamic array
            if (m_velocities == null || m_bodyCapacity > m_velocities.Length)
            {
                Velocity[] old = m_velocities == null ? new Velocity[0] : m_velocities;
                m_velocities = new Velocity[m_bodyCapacity];
                Array.Copy(old, 0, m_velocities, 0, old.Length);
                for (int i = old.Length; i < m_velocities.Length; i++)
                {
                    m_velocities[i] = new Velocity();
                }
            }

            // dynamic array
            if (m_positions == null || m_bodyCapacity > m_positions.Length)
            {
                Position[] old = m_positions == null ? new Position[0] : m_positions;
                m_positions = new Position[m_bodyCapacity];
                Array.Copy(old, 0, m_positions, 0, old.Length);
                for (int i = old.Length; i < m_positions.Length; i++)
                {
                    m_positions[i] = new Position();
                }
            }
        }
Example #21
0
 /**
    * Register a contact event listener. The listener is owned by you and must remain in scope.
    *
    * @param listener
    */
 public void setContactListener(ContactListener listener)
 {
     m_contactManager.m_contactListener = listener;
 }
Example #22
0
        public override void Evaluate(ContactListener listener)
        {
            Body b1 = _shape1.GetBody();
            Body b2 = _shape2.GetBody();

            //memcpy(&m0, &m_manifold, sizeof(b2Manifold));
            Manifold m0 = _manifold.Clone();

            Collision.Collision.CollidePolygonAndCircle(ref _manifold, (PolygonShape)_shape1, b1.GetXForm(),
                                                        (CircleShape)_shape2, b2.GetXForm());

            bool[] persisted = new[] { false, false };

            ContactPoint cp = new ContactPoint();

            cp.Shape1      = _shape1;
            cp.Shape2      = _shape2;
            cp.Friction    = Settings.MixFriction(_shape1.Friction, _shape2.Friction);
            cp.Restitution = Settings.MixRestitution(_shape1.Restitution, _shape2.Restitution);

            // Match contact ids to facilitate warm starting.
            if (_manifold.PointCount > 0)
            {
                // Match old contact ids to new contact ids and copy the
                // stored impulses to warm start the solver.
                for (int i = 0; i < _manifold.PointCount; ++i)
                {
                    ManifoldPoint mp = _manifold.Points[i];
                    mp.NormalImpulse  = 0.0f;
                    mp.TangentImpulse = 0.0f;
                    bool      found = false;
                    ContactID id    = mp.ID;

                    for (int j = 0; j < m0.PointCount; ++j)
                    {
                        if (persisted[j])
                        {
                            continue;
                        }

                        ManifoldPoint mp0 = m0.Points[j];

                        if (mp0.ID.Key == id.Key)
                        {
                            persisted[j]      = true;
                            mp.NormalImpulse  = mp0.NormalImpulse;
                            mp.TangentImpulse = mp0.TangentImpulse;

                            // A persistent point.
                            found = true;

                            // Report persistent point.
                            if (listener != null)
                            {
                                cp.Position = b1.GetWorldPoint(mp.LocalPoint1);
                                Vector2 v1 = b1.GetLinearVelocityFromLocalPoint(mp.LocalPoint1);
                                Vector2 v2 = b2.GetLinearVelocityFromLocalPoint(mp.LocalPoint2);
                                cp.Velocity   = v2 - v1;
                                cp.Normal     = _manifold.Normal;
                                cp.Separation = mp.Separation;
                                cp.ID         = id;
                                listener.Persist(cp);
                            }
                            break;
                        }
                    }

                    // Report added point.
                    if (found == false && listener != null)
                    {
                        cp.Position = b1.GetWorldPoint(mp.LocalPoint1);
                        Vector2 v1 = b1.GetLinearVelocityFromLocalPoint(mp.LocalPoint1);
                        Vector2 v2 = b2.GetLinearVelocityFromLocalPoint(mp.LocalPoint2);
                        cp.Velocity   = v2 - v1;
                        cp.Normal     = _manifold.Normal;
                        cp.Separation = mp.Separation;
                        cp.ID         = id;
                        listener.Add(cp);
                    }
                }

                _manifoldCount = 1;
            }
            else
            {
                _manifoldCount = 0;
            }

            if (listener == null)
            {
                return;
            }

            // Report removed points.
            for (int i = 0; i < m0.PointCount; ++i)
            {
                if (persisted[i])
                {
                    continue;
                }

                ManifoldPoint mp0 = m0.Points[i];
                cp.Position = b1.GetWorldPoint(mp0.LocalPoint1);
                Vector2 v1 = b1.GetLinearVelocityFromLocalPoint(mp0.LocalPoint1);
                Vector2 v2 = b2.GetLinearVelocityFromLocalPoint(mp0.LocalPoint2);
                cp.Velocity   = v2 - v1;
                cp.Normal     = m0.Normal;
                cp.Separation = mp0.Separation;
                cp.ID         = mp0.ID;
                listener.Remove(cp);
            }
        }
Example #23
0
        // djm pooling

        public void update(ContactListener listener)
        {
            oldManifold.set(m_manifold);

            // Re-enable this contact.
            m_flags |= ENABLED_FLAG;

            bool touching    = false;
            bool wasTouching = (m_flags & TOUCHING_FLAG) == TOUCHING_FLAG;

            bool sensorA = m_fixtureA.isSensor();
            bool sensorB = m_fixtureB.isSensor();
            bool sensor  = sensorA || sensorB;

            Body      bodyA = m_fixtureA.getBody();
            Body      bodyB = m_fixtureB.getBody();
            Transform xfA   = bodyA.getTransform();
            Transform xfB   = bodyB.getTransform();

            // log.debug("TransformA: "+xfA);
            // log.debug("TransformB: "+xfB);

            if (sensor)
            {
                Shape shapeA = m_fixtureA.getShape();
                Shape shapeB = m_fixtureB.getShape();
                touching = pool.getCollision().testOverlap(shapeA, m_indexA, shapeB, m_indexB, xfA, xfB);

                // Sensors don't generate manifolds.
                m_manifold.pointCount = 0;
            }
            else
            {
                evaluate(m_manifold, xfA, xfB);
                touching = m_manifold.pointCount > 0;

                // Match old contact ids to new contact ids and copy the
                // stored impulses to warm start the solver.
                for (int i = 0; i < m_manifold.pointCount; ++i)
                {
                    ManifoldPoint mp2 = m_manifold.points[i];
                    mp2.normalImpulse  = 0.0d;
                    mp2.tangentImpulse = 0.0d;
                    ContactID id2 = mp2.id;

                    for (int j = 0; j < oldManifold.pointCount; ++j)
                    {
                        ManifoldPoint mp1 = oldManifold.points[j];

                        if (mp1.id.isEqual(id2))
                        {
                            mp2.normalImpulse  = mp1.normalImpulse;
                            mp2.tangentImpulse = mp1.tangentImpulse;
                            break;
                        }
                    }
                }

                if (touching != wasTouching)
                {
                    bodyA.setAwake(true);
                    bodyB.setAwake(true);
                }
            }

            if (touching)
            {
                m_flags |= TOUCHING_FLAG;
            }
            else
            {
                m_flags &= ~TOUCHING_FLAG;
            }

            if (listener == null)
            {
                return;
            }

            if (wasTouching == false && touching)
            {
                listener.beginContact(this);
            }

            if (wasTouching && touching == false)
            {
                listener.endContact(this);
            }

            if (sensor == false && touching)
            {
                listener.preSolve(this, oldManifold);
            }
        }
Example #24
0
        internal void Destroy(Contact c)
        {
            Fixture fixtureA = c.GetFixtureA();
            Fixture fixtureB = c.GetFixtureB();
            Body    bodyA    = fixtureA.GetBody();
            Body    bodyB    = fixtureB.GetBody();

            if (ContactListener != null && c.IsTouching())
            {
                ContactListener.EndContact(c);
            }

            // Remove from the world.
            if (c._prev != null)
            {
                c._prev._next = c._next;
            }

            if (c._next != null)
            {
                c._next._prev = c._prev;
            }

            if (c == _contactList)
            {
                _contactList = c._next;
            }

            // Remove from body 1
            if (c._nodeA.Prev != null)
            {
                c._nodeA.Prev.Next = c._nodeA.Next;
            }

            if (c._nodeA.Next != null)
            {
                c._nodeA.Next.Prev = c._nodeA.Prev;
            }

            if (c._nodeA == bodyA._contactList)
            {
                bodyA._contactList = c._nodeA.Next;
            }

            // Remove from body 2
            if (c._nodeB.Prev != null)
            {
                c._nodeB.Prev.Next = c._nodeB.Next;
            }

            if (c._nodeB.Next != null)
            {
                c._nodeB.Next.Prev = c._nodeB.Prev;
            }

            if (c._nodeB == bodyB._contactList)
            {
                bodyB._contactList = c._nodeB.Next;
            }

            c.Destroy();

            --_contactCount;
        }
Example #25
0
 public override void Evaluate(ContactListener listener)
 {
 }
        public static void InitializeSoundEvents(ContactListener _contactListener)
        {
            contactListener = _contactListener;

            #region SUBSCRIBE TO SOUND EVENTS
            contactListener.StarCollected += new ContactListener.EffectEventHandler(contactListener_StarCollected);
            contactListener.SawCutting += new ContactListener.EffectEventHandler(contactListener_SawCutting);
            contactListener.BeeDeflection += new ContactListener.EffectEventHandler(contactListener_BeeDeflection);
            contactListener.SpringDeflection += new ContactListener.EffectEventHandler(contactListener_SpringDeflection);
            contactListener.FruitExploded += new ContactListener.EffectEventHandler(contactListener_FruitExploded);
            contactListener.VeggieExploded += new ContactListener.EffectEventHandler(contactListener_VeggieExploded);
            contactListener.CreatureExploded += new ContactListener.EffectEventHandler(contactListener_CreatureExploded);
            contactListener.FireShotExploded += new ContactListener.EffectEventHandler(contactListener_FireShotExploded);
            contactListener.IceShotExploded += new ContactListener.EffectEventHandler(contactListener_IceShotExploded);
            contactListener.LitShotExploded += new ContactListener.EffectEventHandler(contactListener_LitShotExploded);
            contactListener.BombExploded += new ContactListener.EffectEventHandler(contactListener_BombExploded);
            contactListener.ShotFired += new ContactListener.EffectEventHandler(contactListener_ShotFired);
            contactListener.SnowballThrown += new ContactListener.EffectEventHandler(contactListener_SnowballThrown);
            contactListener.PerfectShot += new ContactListener.EffectEventHandler(contactListener_PerfectShot);
            contactListener.BananaActivated += new ContactListener.EffectEventHandler(contactListener_BananaActivated);
            contactListener.LemonActivated += new ContactListener.EffectEventHandler(contactListener_LemonActivated);
            contactListener.WaterSplash += new ContactListener.EffectEventHandler(contactListener_WaterSplash);
            contactListener.LavaSplash += new ContactListener.EffectEventHandler(contactListener_LavaSplash);

            #endregion

            return;
        }