예제 #1
0
        private void SceneInitial()
        {
            tank = new TankSinTur("tank", new GameObjInfo("Tank", "Player"), TankSinTur.M60TexPath, TankSinTur.M60Data,
                                  170, MathHelper.PiOver4, Color.Yellow,
                                  0f, 80, 60, 0.6f * MathHelper.Pi, 0.5f * MathHelper.Pi, MathHelper.Pi, 2f,
                                  new Vector2(100, 50), 0, 0);

            AutoShootAI autoShoot = new AutoShootAI();

            autoShoot.OrderServer = tank;
            ManualControl manualControl = new ManualControl();

            manualControl.OrderServer = tank;
            //tank.SetTankAI( manualControl );
            tank.SetTankAI(autoShoot);
            tank.onShoot   += new Tank.ShootEventHandler(Tank_onShoot);
            tank.ShellSpeed = shellSpeed;

            //ItemCommon item = new ItemCommon( "item", "Scorpion", Path.Combine( Directories.ContentDirectory, "GameObjs\\scorpion" ), new Vector2( 128, 128 ), 0.031f, new Vector2[] { new Vector2( 128, 128 ) },
            //    new Vector2( 150, 50 ), 0f, Vector2.Zero, 0 );
            Ball ball = new Ball("ball", 0.031f, new Vector2(150, 50), 0, Vector2.Zero, 0);

            ball.OnCollided += new OnCollidedEventHandler(item_OnCollided);

            smoke = new SmokeGenerater(0, 50, Vector2.Zero, 0.3f, 0f, true, ball);

            sceneMgr.AddGroup(string.Empty, new TypeGroup <TankSinTur>("tank"));
            sceneMgr.AddGroup(string.Empty, new TypeGroup <Ball>("ball"));
            sceneMgr.AddGroup(string.Empty, new TypeGroup <SmartTank.PhiCol.Border>("border"));
            sceneMgr.AddGroup(string.Empty, new TypeGroup <ShellNormal>("shell"));

            sceneMgr.PhiGroups.Add("tank");
            sceneMgr.PhiGroups.Add("ball");
            sceneMgr.PhiGroups.Add("shell");

            sceneMgr.ColPairGroups.Add(new SceneMgr.Pair("tank", "ball"));
            sceneMgr.ColPairGroups.Add(new SceneMgr.Pair("tank", "border"));
            sceneMgr.ColPairGroups.Add(new SceneMgr.Pair("ball", "border"));
            sceneMgr.ColPairGroups.Add(new SceneMgr.Pair("shell", "border"));
            sceneMgr.ColPairGroups.Add(new SceneMgr.Pair("shell", "ball"));

            sceneMgr.ShelterGroups.Add(new SceneMgr.MulPair("tank", new List <string>()));
            sceneMgr.VisionGroups.Add(new SceneMgr.MulPair("tank", new List <string>(new string[] { "ball" })));

            sceneMgr.AddGameObj("tank", tank);
            sceneMgr.AddGameObj("ball", ball);
            sceneMgr.AddGameObj("border", new SmartTank.PhiCol.Border(mapSize));


            //camera.Focus( tank );
        }
예제 #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);
        }