Exemplo n.º 1
0
        private void InitialScene()
        {
            sceneMgr = new SceneMgr();

            tank = new TankSinTur("tank", new GameObjInfo("Tank", string.Empty),
                                  TankSinTur.M60TexPath, TankSinTur.M60Data,
                                  tankRaderDepth, tankRaderAng, Color.Wheat,
                                  tankMaxForwardSpd, tankMaxBackwardSpd, tankMaxRotaSpd, tankMaxRotaTurretSpd, tankMaxRotaRaderSpd,
                                  0.3f, tankStartPos, tankStartAzi);

            wall1 = new ObstacleCommon("wall1", new GameObjInfo("wall", string.Empty), new Vector2(100, 50), 0,
                                       Path.Combine(Directories.ContentDirectory, "GameObjs\\wall"),
                                       new Vector2(90, 15), 1f, Color.White, LayerDepth.GroundObj, new Vector2[] { new Vector2(90, 15) });
            wall1.GetEyeableInfoHandler = EyeableInfo.GetEyeableInfoHandler;

            wall2 = new ObstacleCommon("wall2", new GameObjInfo("wall", string.Empty), new Vector2(250, 150), MathHelper.PiOver2,
                                       Path.Combine(Directories.ContentDirectory, "GameObjs\\wall"),
                                       new Vector2(90, 15), 1f, Color.White, LayerDepth.GroundObj, new Vector2[] { new Vector2(90, 15) });
            wall2.GetEyeableInfoHandler = EyeableInfo.GetEyeableInfoHandler;

            wall3 = new ObstacleCommon("wall3", new GameObjInfo("wall", string.Empty), new Vector2(100, 100), 0,
                                       Path.Combine(Directories.ContentDirectory, "GameObjs\\wall"),
                                       new Vector2(90, 15), 1f, Color.White, LayerDepth.GroundObj, new Vector2[] { new Vector2(90, 15) });
            wall3.GetEyeableInfoHandler = EyeableInfo.GetEyeableInfoHandler;


            ball = new Ball("ball", 0.3f, new Vector2(300, 250), 0, new Vector2(5, 5), 0);

            sceneMgr.AddGroup("", new TypeGroup <TankSinTur>("tank"));
            sceneMgr.AddGroup("", new Group("obstacle"));
            sceneMgr.AddGroup("obstacle", new TypeGroup <ObstacleCommon>("wall"));
            sceneMgr.AddGroup("obstacle", new TypeGroup <Ball>("ball"));
            sceneMgr.AddGroup("obstacle", new TypeGroup <SmartTank.PhiCol.Border>("border"));
            sceneMgr.AddColMulGroups("tank", "obstacle");
            sceneMgr.PhiGroups.AddRange(new string[] { "tank", "obstacle\\ball" });
            sceneMgr.AddShelterMulGroups("tank", "obstacle\\wall");
            sceneMgr.VisionGroups.Add(new SceneMgr.MulPair("tank", new List <string>(new string[] { "obstacle\\ball", "obstacle\\wall" })));

            sceneMgr.AddGameObj("tank", tank);
            sceneMgr.AddGameObj("obstacle\\wall", wall1, wall2, wall3);
            sceneMgr.AddGameObj("obstacle\\ball", ball);
            sceneMgr.AddGameObj("obstacle\\border", new SmartTank.PhiCol.Border(mapSize));

            GameManager.LoadScene(sceneMgr);
        }
Exemplo n.º 2
0
        private void InitialScene()
        {
            sceneMgr = new SceneMgr();

            tank = new TankSinTur( "tank", new GameObjInfo( "Tank", string.Empty ),
                TankSinTur.M60TexPath, TankSinTur.M60Data,
                tankRaderDepth, tankRaderAng, Color.Wheat,
                tankMaxForwardSpd, tankMaxBackwardSpd, tankMaxRotaSpd, tankMaxRotaTurretSpd, tankMaxRotaRaderSpd,
                0.3f, tankStartPos, tankStartAzi );

            wall1 = new ObstacleCommon( "wall1", new GameObjInfo( "wall", string.Empty ), new Vector2( 100, 50 ), 0,
                Path.Combine( Directories.ContentDirectory, "GameObjs\\wall" ),
                new Vector2( 90, 15 ), 1f, Color.White, LayerDepth.GroundObj, new Vector2[] { new Vector2( 90, 15 ) } );
            wall1.GetEyeableInfoHandler = EyeableInfo.GetEyeableInfoHandler;

            wall2 = new ObstacleCommon( "wall2", new GameObjInfo( "wall", string.Empty ), new Vector2( 250, 150 ), MathHelper.PiOver2,
                            Path.Combine( Directories.ContentDirectory, "GameObjs\\wall" ),
                            new Vector2( 90, 15 ), 1f, Color.White, LayerDepth.GroundObj, new Vector2[] { new Vector2( 90, 15 ) } );
            wall2.GetEyeableInfoHandler = EyeableInfo.GetEyeableInfoHandler;

            wall3 = new ObstacleCommon( "wall3", new GameObjInfo( "wall", string.Empty ), new Vector2( 100, 100 ), 0,
                Path.Combine( Directories.ContentDirectory, "GameObjs\\wall" ),
                new Vector2( 90, 15 ), 1f, Color.White, LayerDepth.GroundObj, new Vector2[] { new Vector2( 90, 15 ) } );
            wall3.GetEyeableInfoHandler = EyeableInfo.GetEyeableInfoHandler;


            ball = new Ball( "ball", 0.3f, new Vector2( 300, 250 ), 0, new Vector2( 5, 5 ), 0 );

            sceneMgr.AddGroup( "", new TypeGroup<TankSinTur>( "tank" ) );
            sceneMgr.AddGroup( "", new Group( "obstacle" ) );
            sceneMgr.AddGroup( "obstacle", new TypeGroup<ObstacleCommon>( "wall" ) );
            sceneMgr.AddGroup( "obstacle", new TypeGroup<Ball>( "ball" ) );
            sceneMgr.AddGroup( "obstacle", new TypeGroup<SmartTank.PhiCol.Border>( "border" ) );
            sceneMgr.AddColMulGroups( "tank", "obstacle" );
            sceneMgr.PhiGroups.AddRange( new string[] { "tank", "obstacle\\ball" } );
            sceneMgr.AddShelterMulGroups( "tank", "obstacle\\wall" );
            sceneMgr.VisionGroups.Add( new SceneMgr.MulPair( "tank", new List<string>( new string[] { "obstacle\\ball", "obstacle\\wall" } ) ) );

            sceneMgr.AddGameObj( "tank", tank );
            sceneMgr.AddGameObj( "obstacle\\wall", wall1, wall2, wall3 );
            sceneMgr.AddGameObj( "obstacle\\ball", ball );
            sceneMgr.AddGameObj( "obstacle\\border", new SmartTank.PhiCol.Border( mapSize ) );
            
            GameManager.LoadScene( sceneMgr );
        }