public NonInertiasPhiUpdater ( GameObjInfo objInfo, Vector2 pos, Vector2 vel, float azi, float angVel )
 {
     this.objInfo = objInfo;
     this.Pos = pos;
     this.Vel = vel;
     this.Azi = azi;
     this.AngVel = angVel;
     this.nextPos = pos;
     this.nextAzi = azi;
 }
Beispiel #2
0
        void phiUpdater_OnOverlap( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {
            //if (objB.ObjClass == "Border")
            //{
            //    ((SceneKeeperCommon)(GameManager.CurSceneKeeper)).RemoveGameObj( this, true, false, false, false, SceneKeeperCommon.GameObjLayer.lowFlying );
            //}

            if (onOverlap != null)
                onOverlap( this, result, objB );
        }
Beispiel #3
0
        public EyeableInfo ( IEyeableObj obj )
        {
            this.objInfo = obj.ObjInfo;
            this.pos = obj.Pos;
            this.curTransMatrix = obj.TransMatrix;

            curKeyPoints = new Vector2[obj.KeyPoints.Length];
            for (int i = 0; i < obj.KeyPoints.Length; i++)
            {
                curKeyPoints[i] = Vector2.Transform( obj.KeyPoints[i], obj.TransMatrix );
            }
        }
Beispiel #4
0
        void CollideHandler ( CollisionResult result, GameObjInfo objB )
        {
            if (objB.ObjClass == "Border")
            {
            }
            else if (objB.ObjClass == "ShellNormal")
            {
            }
            else if (objB.ObjClass == "DuelTank")
            {
            }

        }
Beispiel #5
0
        void Rock_OnCollided(IGameObj Sender, CollisionResult result, GameObjInfo objB)
        {
            if (objB.ObjClass == "WarShip")// || objB.ObjClass == "Rock")
            {
                Vector2 newVel = CalMirrorVel((Sender as Rock).Vel, result.NormalVector);
                (Sender as Rock).Vel = newVel;
            }
            else if (objB.ObjClass == "Rock")
            {
                Vector2 newVel = CalMirrorVel((Sender as Rock).Vel, result.NormalVector);
                (Sender as Rock).Vel = newVel;
            }

            //BroadcastObjPhiStatus(Sender, true);
        }
Beispiel #6
0
 void Gold_OnOverLap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     SetGoldNewPos(Sender as Gold);
 }
Beispiel #7
0
        void Warship_OnOverLap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
        {
            if (objB.ObjClass == "Gold")
            {
                WarShip ship = Sender as WarShip;
                ship.Score += SpaceWarConfig.GoldScore;

                SyncShipScoreHp(ship, true);
            }
        }
 public NonInertiasColUpdater( GameObjInfo objInfo, Sprite[] collideSprites )
     : base( objInfo )
 {
     this.collideSprites = collideSprites;
     colMethod = new SpriteColMethod( collideSprites );
 }
Beispiel #9
0
 void phiUpdater_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (onCollided != null)
         //onCollided( this, result, objB );
         InfoRePath.CallEvent(this.MgPath, "onCollided", onCollided, this, result, objB);
 }
Beispiel #10
0
        //float lastCollideWithBorderTime = -1;
        void item_OnCollided( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {

            if (objB.ObjClass == "Border")
            {
                ((ItemCommon)Sender).Vel = -2 * Vector2.Dot( ((ItemCommon)Sender).Vel, result.NormalVector ) * result.NormalVector + ((ItemCommon)Sender).Vel;

                //float curTime = GameManager.CurTime;
                //if (lastCollideWithBorderTime != -1 && curTime - lastCollideWithBorderTime < 0.05f)
                //    ((ItemCommon)Sender).Scale -= 0.1f * 0.25f;

                //lastCollideWithBorderTime = curTime;
            }
            else if (objB.ObjClass == "Tank")
            {
                //((ItemCommon)Sender).Scale += 0.1f * 0.25f;
                //((ItemCommon)Sender).Pos += result.NormalVector * 10f;
                ((ItemCommon)Sender).Vel = ((ItemCommon)Sender).Vel.Length() * result.NormalVector;


                if (firstHitTank)
                {
                    showFirstHitTank = true;
                    firstHitTank = false;
                }
            }
            else if (objB.ObjClass == "ShellNormal")
            {
                smoke.Concen += 0.3f;

                if (((ItemCommon)Sender).Scale < 0.5f * 0.031f)
                {
                    //scene.RemoveGameObj( Sender, true, false, false, false, SceneKeeperCommon.GameObjLayer.HighBulge );
                    sceneMgr.DelGameObj( "shell", Sender.Name );
                    Score += 100;

                    hitSum++;

                    AddNewItem( Sender );

                    if (firstScore)
                    {
                        showFirstScore = true;
                        firstScore = false;
                    }

                    smoke.Concen = 0;
                }
                else
                {
                    ((ItemCommon)Sender).Scale -= 0.15f * 0.031f;
                    ((ItemCommon)Sender).Vel = -result.NormalVector * ((ItemCommon)Sender).Vel.Length();
                    hitSum++;
                }

                if (firstHit)
                {
                    showFirstHit = true;
                    firstHit = false;
                }

                NiceShootSum += 2;
                showNiceShoot = true;

                if (NiceShootSum >= 30 && !speedy)
                {
                    TextEffectMgr.AddRiseFade( "You Got A Speedy Turret!", tank.Pos, 2f, Color.Purple, LayerDepth.Text, GameFonts.Lucida, 300, 0.2f );
                    tank.FireCDTime = 2f;
                    speedy = true;
                }
            }

        }
Beispiel #11
0
 public void CallOnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnOverLap != null)
         OnOverLap(Sender, result, objB);
 }
Beispiel #12
0
        void shell_onCollided( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {
            sceneMgr.DelGameObj( "shell", Sender.Name );
            new ShellExplodeBeta( Sender.Pos, ((ShellNormal)Sender).Azi );

            Quake.BeginQuake( 10, 50 );
            Sound.PlayCue( "EXPLO1" );

        }
Beispiel #13
0
        void tank_onCollide( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {
            if (objB.ObjClass == "ShellNormal")
            {
                if (Sender == tank1)
                {
                    tank1.Live--;
                    // 在此添加效果
                    tank1.smoke.Concen += 0.2f;

                    if (tank1.Live <= 0 && !tank1.IsDead)
                    {
                        new Explode( tank1.Pos, 0 );

                        tank1.Dead();

                        new GameTimer( 3,
                            delegate()
                            {
                                MessageBox.Show( "Tank2胜利!" );
                                gameOver = true;
                            } );

                    }
                }
                else if (Sender == tank2)
                {
                    tank2.Live--;

                    tank2.smoke.Concen += 0.2f;
                    // 在此添加效果
                    if (tank2.Live <= 0 && !tank2.IsDead)
                    {
                        new Explode( tank2.Pos, 0 );

                        tank2.Dead();

                        new GameTimer( 3,
                            delegate()
                            {
                                MessageBox.Show( "Tank1胜利!" );
                                gameOver = true;
                            } );
                    }
                }
            }
        }
Beispiel #14
0
        void CollideHandler ( CollisionResult result, GameObjInfo objB )
        {
            // 通过objB的信息确定碰撞物的种类。
            if (objB.ObjClass == "Border")
            {
                // 添加自己的处理函数
            }
            else if (objB.ObjClass == "ShellNormal")
            {
                // 添加自己的处理函数
            }
            else if (objB.ObjClass == "DuelTank")
            {
                // 添加自己的处理函数
            }

        }
Beispiel #15
0
        void Shell_onCollided( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {
            //scene.RemoveGameObj( Sender, true, false, false, false, SceneKeeperCommon.GameObjLayer.lowFlying );
            sceneMgr.DelGameObj( "shell", Sender.Name );

            //camera.Focus( tank );
            //if (objB.Name == "Border")
            //{
            //    NiceShootSum = Math.Max( 0, NiceShootSum - 1 );
            //}
        }
Beispiel #16
0
 void Shell_onOverlap( IGameObj Sender, CollisionResult result, GameObjInfo objB )
 {
     if (objB.ObjClass == "Border")
         NiceShootSum = Math.Max( 0, NiceShootSum - 10 );
     //camera.Focus( tank );
 }
 public NonInertiasPhiUpdater ( GameObjInfo objInfo )
 {
     this.objInfo = objInfo;
 }
Beispiel #18
0
 void phisicalUpdater_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnOverLap != null)
         InfoRePath.CallEvent(this.mgPath, "OnOverlap", OnOverLap, this, result, objB);
 }
Beispiel #19
0
 void phiUpdater_OnCollied( IGameObj Sender, CollisionResult result, GameObjInfo objB )
 {
     if (onCollided != null)
         onCollided( this, result, objB );
 }
 public NonInertiasColUpdater( GameObjInfo objInfo, Vector2 pos, Vector2 vel, float azi, float angVel, Sprite[] collideSprites )
     : base( objInfo, pos, vel, azi, angVel )
 {
     this.collideSprites = collideSprites;
     colMethod = new SpriteColMethod( collideSprites );
 }
Beispiel #21
0
 public void CallOnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnCollied != null)
         OnCollied(Sender, result, objB);
 }
Beispiel #22
0
        void Shell_onCollided(IGameObj Sender, CollisionResult result, GameObjInfo objB)
        {

            if (objB.ObjClass == "WarShip")
            {
                if (PurviewMgr.IsMainHost)
                {
                    WarShipShell shell = Sender as WarShipShell;
                    WarShip firer = shell.Firer as WarShip;
                    if (objB.Script != firer.ObjInfo.Script)
                    {
                        (shell.Firer as WarShip).Score += SpaceWarConfig.ScoreByHit;
                        SyncShipScoreHp(shell.Firer as WarShip, true);
                    }
                }

                sceneMgr.DelGameObj("shell", Sender.Name);
                new ShellExplodeBeta(Sender.Pos, ((ShellNormal)Sender).Azi);

                Quake.BeginQuake(10, 50);
                Sound.PlayCue("EXPLO1");
            }
            else
            {
                WarShipShell shell = (WarShipShell)Sender;
                shell.MirrorPath(result);

                //
                //BroadcastObjPhiStatus(shell, true);
            }

        }
Beispiel #23
0
 void phisicalUpdater_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnCollied != null)
         InfoRePath.CallEvent(this.mgPath, "OnCollied", OnCollied, this, result, objB);
 }
Beispiel #24
0
        void WarShip_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
        {
            if (objB.ObjClass == "WarShipShell")
            {
                WarShip ship = (WarShip)Sender;
                ship.BeginStill();
                if (PurviewMgr.IsMainHost)
                    ship.HitByShell();
                ship.Vel = result.NormalVector * SpaceWarConfig.ShellSpeed;

                SyncShipScoreHp(ship, false);
            }
            else if (objB.ObjClass == "WarShip")
            {
                WarShip ship = (WarShip)Sender;
                Vector2 newVel = CalMirrorVel(ship.Vel, result.NormalVector);
                ship.Vel = newVel;
                ship.BeginStill();
            }
            else if (objB.ObjClass == "Rock")
            {
                WarShip ship = (WarShip)Sender;
                Vector2 newVel = CalMirrorVel(ship.Vel, result.NormalVector);
                ship.Vel = newVel;
                ship.BeginStill();
            }
        }
Beispiel #25
0
 void phiUpdater_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (onOverlap != null)
         //onOverlap( this, result, objB );
         InfoRePath.CallEvent(this.MgPath, "onOverlap", onOverlap, this, result, objB);
 }
Beispiel #26
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="borderRect">边界矩形</param>
 public Border( Rectanglef borderRect )
 {
     this.borderRect = borderRect;
     colChecker = new BorderChecker( borderRect );
     objInfo = new GameObjInfo( "Border", "" );
 }