Exemplo n.º 1
0
        void InitializeCollisionsRelations()
        {
            //Create a relation between the boat collision and the tiles that form the island.
            TileShapeCollection LayerCollisions = Terrain.Collisions.First(x => x.Name == "Collisions");

            RelBoatIsland = CollisionManager.Self.CreateTileRelationship(
                PlayerBoat, LayerCollisions);

            RelBoatIsland.SetMoveCollision(0, 1);


            RelPlayerBoat = CollisionManager.Self.CreateRelationship(
                PlayerInstance, PlayerBoat);
            RelPlayerBoat.SetMoveCollision(0, 1);

            RelBoatCannonball = CollisionManager.Self.CreateRelationship(BoatList, CannonballList);
            RelBoatCannonball.SetEventOnlyCollision();
            RelBoatCannonball.CollisionOccurred += BoatCollidedWithCannonball;

            RelBulletTerrain = CollisionManager.Self.CreateTileRelationship(
                BulletList, RockCollision);
            RelBulletTerrain.CollisionOccurred += BulletCollidedWithTerrain;

            RelPlayerTerrain = CollisionManager.Self.CreateTileRelationship(
                PlayerInstance, RockCollision);
            RelPlayerTerrain.SetMoveCollision(1, 0);

            RelPlayerWeaponEnemies = CollisionManager.Self.CreateRelationship(
                PlayerInstance.mWeaponEntity, EnemyList);
            RelPlayerWeaponEnemies.SetEventOnlyCollision();
            RelPlayerWeaponEnemies.CollisionOccurred += PlayerWeaponHitEnemy;


            TileEntityInstantiator.CreateEntitiesFrom(Terrain);
        }
Exemplo n.º 2
0
        void CustomInitialize()
        {
            TileEntityInstantiator.CreateEntitiesFrom(Map);

            InitializeShips();

            JoinedPlayerManager.ResetGameStats();

            RandomizeWind();

            // debug initialize needs to be before initializing cameras because
            // new ships may be added through debug logic.
            DebugInitialize();

            // do this after DebugInitialize so the debug ships are created too:
            PositionShipsOnSpawnPoints();

            InitializeCameras();

            DoInitialCloudSpawning();

            OffsetTilemapLayers();

            InitializeCollision();

            PauseComponentInstance.Visible = false;
        }
Exemplo n.º 3
0
        void CustomInitialize()
        {
            CurrentMultipliers = new StatMultipliers(this);
            TileEntityInstantiator.CreateEntitiesFrom(Map);
            Map.RemoveTiles(t => t.Any(item => item.Name == "Type" && (item.Value as string) == "RemoveMe"), Map.TileProperties);

            // Create players after other entities so they can be spawned next to the base
            CreatePlayers();

            spawnManager = new SpawnManager();

            InitializeCollisions();

            InitializeCameraController();

            Factories.EnemyFactory.EntitySpawned = HandleEnemySpawn;
            EnemyList.CollectionChanged         += (a, b) => HandleEnemyListChanged();

            InitializeNodeNetworks();

            InitializeUi();

            InitializeMusic();

            levelStartTime = FlatRedBall.TimeManager.CurrentTime;
        }
Exemplo n.º 4
0
        private void TestEntitiesInFolders()
        {
            this.TiledEntityInFolderList.Count
            .ShouldBe(0, "because entities haven't yet been created");
            TileEntityInstantiator.CreateEntitiesFrom(TmxWithEntities);

            this.TiledEntityInFolderList.Count
            .ShouldBe(2, "because there are 2 tile instances creating this entity, one with a forward slash, one with a back slash");
        }
Exemplo n.º 5
0
        private void InitializeEntitiesFromMap()
        {
            TileEntityInstantiator.CreateEntitiesFrom(Map);

            foreach (var fish in FishList)
            {
                //propObject.Z = PlayerCharacterInstance.Z; // same as player so they sort
                fish.SetLayers(LightEffectsLayer);
            }
        }
Exemplo n.º 6
0
        private void LoadLevel(string levelNameToLoad)
        {
            TMXGlueLib.DataTypes.ReducedTileMapInfo.FastCreateFromTmx = true;

            currentLevel = (LayeredTileMap)GetFile(levelNameToLoad);

            currentLevel.AddToManagers(WorldLayer);

            TileEntityInstantiator.CreateEntitiesFrom(currentLevel);

#if DEBUG
            ApplyDebugInitializationValues();
#endif

            foreach (var item in SafeZoneList)
            {
                item.SetupCollision();
            }
        }
Exemplo n.º 7
0
        void CustomInitialize()
        {
            FlatRedBallServices.GraphicsOptions.TextureFilter = Microsoft.Xna.Framework.Graphics.TextureFilter.Point;

            BasicArena.AddToManagers();
            stage = new Stage(BasicArena);



            var ball = BallFactory.CreateNew();

            ball.X = 400;
            ball.Y = -100;

            PlatformerCharacterBaseList = new List <PlatformerCharacterBase>();

            TileEntityInstantiator.CreateEntitiesFrom(BasicArena);

            PlatformerCharacterBaseList.AddRange(PlatformInteracterList.OfType <PlatformerCharacterBase>());
        }
Exemplo n.º 8
0
        void CustomInitialize()
        {
            Camera.Main.OrthogonalHeight /= BaseZoomFactor;
            Camera.Main.OrthogonalWidth  /= BaseZoomFactor;
            Camera.Main.AttachTo(PlayerInstance);
            Camera.Main.RelativeZ = 100;

            BallListCollisionCircleVsGoalCollision.CollisionOccurred = BallGoalCollisionOccurred;
            PlayerInstanceBallCatchAreaVsBallListCollisionCircle.CollisionOccurred          = BallInPlayerRegion;
            PlayerInstanceAxisAlignedRectangleInstanceVsUpSpringCollision.CollisionOccurred =
                (player, collection) => player.YVelocity = PlayerSpringAmount;

            BallListCollisionCircleVsUpSpringCollision.CollisionOccurred =
                (ball, collection) => ball.YVelocity = BallSpringAmount;

            GoalDisplay.AttachTo(Camera.Main);
            GoalDisplay.RelativeZ = -1;
            GoalDisplay.RelativeY = GoalDisplayYOffset;

            TileEntityInstantiator.CreateEntitiesFrom(Map);
        }