示例#1
0
        public DuelTank(string name, string texPath, GameObjData skinData, Vector2 pos, float Azi, string tankName,
                        float tankRaderLength, float tankMaxForwardSpd, float tankMaxBackwardSpd,
                        float live)
            : base(name, new GameObjInfo("DuelTank", tankName), texPath, skinData,
                   tankRaderLength, MathHelper.Pi * 0.15f, Color.Yellow,
                   tankMaxForwardSpd, tankMaxBackwardSpd, MathHelper.PiOver4, MathHelper.PiOver4, MathHelper.Pi, 0.8f, pos, Azi)
        {
            this.live = live;
            smoke     = new SmokeGenerater(0, 30, Vector2.Zero, 0.3f, 0, false, this);

            this.GetEyeableInfoHandler = TankSinTur.GetCommonEyeInfoFun;
        }
示例#2
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 );
        }