Esempio n. 1
0
 public void Renew(GameObjInfo obj)
 {
     position.x = (float)(obj.X / 1000);
     position.y = 0f;
     position.z = (float)(obj.Y / 1000);
     teamId     = (int)obj.TeamID;
 }
Esempio n. 2
0
 public void CallOnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnOverLap != null)
     {
         OnOverLap(Sender, result, objB);
     }
 }
Esempio n. 3
0
 void phisicalUpdater_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnOverLap != null)
     {
         InfoRePath.CallEvent(this.mgPath, "OnOverlap", OnOverLap, this, result, objB);
     }
 }
Esempio n. 4
0
 public void CallOnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnCollied != null)
     {
         OnCollied(Sender, result, objB);
     }
 }
Esempio n. 5
0
        public static GameObjInfo Player(Character player)                      //转换成玩家
        {
            GameObjInfo ret = new GameObjInfo();

            ret.GameObjType = Communication.Proto.GameObjType.Character;
            Basic(player, ref ret);

            ret.TeamID     = player.TeamID;
            ret.Ap         = player.AP;
            ret.BulletType = ConvertTool.ToCommunicationBulletType(player.bulletType);

            Prop?holdProp = player.HoldProp;                            // 防止判断后被突然置null

            ret.PropType = holdProp == null ? Communication.Proto.PropType.Null : ConvertTool.ToCommunicationPropType(holdProp.GetPropType());

            ret.IsDying      = player.IsResetting;
            ret.JobType      = ConvertTool.ToCommunicationJobType(player.jobType);
            ret.CD           = player.CD;
            ret.MaxBulletNum = player.MaxBulletNum;
            ret.BulletNum    = player.BulletNum;
            ret.MaxHp        = player.MaxHp;
            ret.Hp           = player.HP;
            ret.LifeNum      = player.LifeNum;

            return(ret);
        }
Esempio n. 6
0
 void phisicalUpdater_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnCollied != null)
     {
         InfoRePath.CallEvent(this.mgPath, "OnCollied", OnCollied, this, result, objB);
     }
 }
Esempio n. 7
0
 void phiUpdater_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (onCollided != null)
     {
         onCollided(this, result, objB);
     }
 }
Esempio n. 8
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();
            }
        }
Esempio n. 9
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);
            }
        }
Esempio n. 10
0
        public static GameObjInfo Auto(GameObject gameObj) //自动判断转换的类型
        {
            if (gameObj.GetGameObjType() == THUnity2D.GameObject.GameObjType.Character)
            {
                return(Player((Character)gameObj));
            }
            switch (((Obj)gameObj).objType)
            {
            case THUnity2D.ObjType.Bullet: return(Bullet((Bullet)gameObj));

            case THUnity2D.ObjType.Prop: return(Prop((Prop)gameObj));

            case THUnity2D.ObjType.Wall: return(Wall((Wall)gameObj));

            case THUnity2D.ObjType.BirthPoint: return(BirthPoint((BirthPoint)gameObj));

            default:                            //错误情况,理论上不应该出现,为了过编译而设置
            {
                GameObjInfo ret = new GameObjInfo();
                ret.GameObjType = GameObjType.OutOfBoundBlock;
                Basic(gameObj, ref ret);
                return(ret);
            }
            }
        }
Esempio n. 11
0
 void phiUpdater_OnOverlap(IGameObj sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnOverlap != null)
     {
         OnOverlap(this, result, objB);
     }
 }
Esempio n. 12
0
 void Shell_onOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (objB.ObjClass == "Border")
     {
         NiceShootSum = Math.Max(0, NiceShootSum - 10);
     }
     //camera.Focus( tank );
 }
Esempio n. 13
0
 public void Renew(GameObjInfo obj)
 {
     position.x = obj.X / 500;
     position.y = 1f;
     position.z = obj.Y / 500;
     teamId     = (int)obj.TeamID;
     moveSpeed  = obj.MoveSpeed;
 }
Esempio n. 14
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);
     }
 }
Esempio n. 15
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);
     }
 }
Esempio n. 16
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");
        }
Esempio n. 17
0
        public static GameObjInfo BirthPoint(BirthPoint birthPoint)                     //转换成出生点
        {
            GameObjInfo ret = new GameObjInfo();

            ret.GameObjType = Communication.Proto.GameObjType.BirthPoint;
            Basic(birthPoint, ref ret);

            return(ret);
        }
Esempio n. 18
0
        public static GameObjInfo Wall(Wall wall)                               //转换成墙
        {
            GameObjInfo ret = new GameObjInfo();

            ret.GameObjType = Communication.Proto.GameObjType.Wall;
            Basic(wall, ref ret);

            return(ret);
        }
Esempio n. 19
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);
            }
        }
Esempio n. 20
0
 public TankSinTur(string name, GameObjInfo objInfo, string texPath, GameObjData skinData,
                   float raderLength, float raderAng, Color raderColor,
                   float maxForwardSpeed, float maxBackwardSpeed, float maxRotaSpeed,
                   float maxTurretRotaSpeed, float maxRaderRotaSpeed, float fireCDTime,
                   Vector2 pos, float baseAzi)
     : this(name, objInfo, texPath, skinData,
            raderLength, raderAng, raderColor, 0, maxForwardSpeed, maxBackwardSpeed, maxRotaSpeed, maxTurretRotaSpeed,
            maxRaderRotaSpeed, fireCDTime, pos, 0, 0)
 {
 }
Esempio n. 21
0
 public void Renew(GameObjInfo obj)
 {
     position.x  = (float)obj.X / 500;
     position.z  = (float)obj.Y / 500;
     direction.x = (float)(90 - obj.FacingDirection * 180 / 3.14);
     Debug.Log(obj.FacingDirection.ToString());
     isMoving  = obj.IsMoving;
     moveSpeed = obj.MoveSpeed;
     isDying   = obj.IsDying;
 }
Esempio n. 22
0
 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;
 }
Esempio n. 23
0
    public GameObject PropMap(GameObjInfo objValue)
    {
        GameObject retVal;

        switch (objValue.PropType)
        {
        case PropType.Null:
            retVal = null;
            break;

        case PropType.Bike:
            retVal = bike;
            break;

        case PropType.Amplifier:
            retVal = horn;
            break;

        case PropType.JinKeLa:
            retVal = schoolBag;
            break;

        case PropType.Rice:
            retVal = hotpot;
            break;

        case PropType.NegativeFeedback:
            retVal = shield;
            break;

        case PropType.Totem:
            retVal = clothes;
            break;

        case PropType.Phaser:
            retVal = javelin;
            break;

        case PropType.Dirt:
            retVal = puddle;
            break;

        case PropType.Attenuator:
            retVal = musicPlayer;
            break;

        case PropType.Divider:
            retVal = mail;
            break;

        default: retVal = null; break;
        }
        return(retVal);
    }
Esempio n. 24
0
 private static void Basic(GameObject gameObj, ref GameObjInfo ret)                      //拷贝基本信息
 {
     ret.Guid            = gameObj.ID;
     ret.X               = gameObj.Position.x;
     ret.Y               = gameObj.Position.y;
     ret.FacingDirection = gameObj.FacingDirection;
     ret.MoveSpeed       = gameObj.MoveSpeed;
     ret.CanMove         = gameObj.CanMove;
     ret.IsMoving        = gameObj.IsMoving;
     ret.ShapeType       = ConvertTool.ToCommunicationShapeType(gameObj.Shape);
 }
Esempio n. 25
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 );
            //}
        }
Esempio n. 26
0
 public ObstacleCommon( string name, GameObjInfo objInfo, Vector2 pos, float azi,
     string texAssetPath, Vector2 origin, float scale, Color color, float layerDepth, Vector2[] keyPoints )
 {
     this.name = name;
     this.objInfo = objInfo;
     this.pos = pos;
     this.azi = azi;
     this.sprite = new Sprite( BaseGame.RenderEngine, BaseGame.ContentMgr, texAssetPath, true );
     this.sprite.SetParameters( origin, pos, scale, azi, color, layerDepth, SpriteBlendMode.AlphaBlend );
     this.keyPoints = keyPoints;
     this.colMethod = new SpriteColMethod( new Sprite[] { this.sprite } );
 }
Esempio n. 27
0
 public TankContrSinTur(GameObjInfo objInfo,
                        Sprite[] collideSprites,
                        Vector2 initialPos, float initialRota,
                        float maxForwardSpeed, float maxBackwardSpeed, float maxTurnAngleSpeed,
                        float maxTurretAngleSpeed, float maxRaderAngleSpeed,
                        float fireCDTime)
     : base(objInfo, initialPos, Vector2.Zero, initialRota, 0f, collideSprites)
 {
     this.collideSprites = collideSprites;
     limit           = new TankLimitSinTur(maxForwardSpeed, maxBackwardSpeed, maxTurnAngleSpeed, maxTurretAngleSpeed, maxRaderAngleSpeed);
     this.fireCDTime = fireCDTime;
 }
Esempio n. 28
0
 public TankContrSinTur ( GameObjInfo objInfo,
     Sprite[] collideSprites,
     Vector2 initialPos, float initialRota,
     float maxForwardSpeed, float maxBackwardSpeed, float maxTurnAngleSpeed,
     float maxTurretAngleSpeed, float maxRaderAngleSpeed,
     float fireCDTime )
     : base( objInfo, initialPos, Vector2.Zero, initialRota, 0f, collideSprites )
 {
     this.collideSprites = collideSprites;
     limit = new TankLimitSinTur( maxForwardSpeed, maxBackwardSpeed, maxTurnAngleSpeed, maxTurretAngleSpeed, maxRaderAngleSpeed );
     this.fireCDTime = fireCDTime;
 }
Esempio n. 29
0
 public ObstacleCommon(string name, GameObjInfo objInfo, Vector2 pos, float azi,
                       string texAssetPath, Vector2 origin, float scale, Color color, float layerDepth, Vector2[] keyPoints)
 {
     this.name    = name;
     this.objInfo = objInfo;
     this.pos     = pos;
     this.azi     = azi;
     this.sprite  = new Sprite(BaseGame.RenderEngine, BaseGame.ContentMgr, texAssetPath, true);
     this.sprite.SetParameters(origin, pos, scale, azi, color, layerDepth, SpriteBlendMode.AlphaBlend);
     this.keyPoints = keyPoints;
     this.colMethod = new SpriteColMethod(new Sprite[] { this.sprite });
 }
Esempio n. 30
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);
            }
        }
Esempio n. 31
0
 void CollideHandler(CollisionResult result, GameObjInfo objB)
 {
     if (objB.ObjClass == "Border")
     {
     }
     else if (objB.ObjClass == "ShellNormal")
     {
     }
     else if (objB.ObjClass == "DuelTank")
     {
     }
 }
Esempio n. 32
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);
            }
        }
Esempio n. 33
0
        public ItemCommon( string name, string objClass, string script,
            string texPath, Vector2 texOrigin, float scale, Vector2[] keyPoints,
            Vector2 pos, float azi, Vector2 vel, float rotaVel )
        {
            this.name = name;
            objInfo = new GameObjInfo( objClass, script );
            sprite = new Sprite( BaseGame.RenderEngine, texPath, true );
            sprite.SetParameters( texOrigin, pos, scale, azi, Color.White, LayerDepth.GroundObj, SpriteBlendMode.AlphaBlend );
            sprite.UpdateTransformBounding();
            this.keyPoints = keyPoints;
            phiUpdater = new NonInertiasColUpdater( objInfo, pos, vel, azi, rotaVel, new Sprite[] { sprite } );

            phiUpdater.OnCollied += new OnCollidedEventHandler( phiUpdater_OnCollied );
            phiUpdater.OnOverlap += new OnCollidedEventHandler( phiUpdater_OnOverlap );
        }
Esempio n. 34
0
 void phiUpdater_OnOverlap( IGameObj sender, CollisionResult result, GameObjInfo objB )
 {
     if (OnOverlap != null)
         OnOverlap( this, result, objB );
 }
Esempio n. 35
0
        void controller_OnCollied( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {
            if (onCollide != null)
                onCollide( this, result, objB );

            if (OnCollide != null)
                OnCollide( result, objB );
        }
Esempio n. 36
0
        void controller_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
        {
            if (onCollide != null)
                //onCollide(this, result, objB);
                InfoRePath.CallEvent(this.MgPath, "onCollide", onCollide,  this, result, objB);

            if (OnCollide != null)
                //OnCollide(result, objB);
                InfoRePath.CallEvent(this.MgPath, "OnCollide", OnCollide, result, objB);
        }
Esempio n. 37
0
        void controller_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
        {
            if (onOverLap != null)
                //onOverLap(this, result, objB);
                InfoRePath.CallEvent(this.MgPath, "onOverLap", onOverLap, this, result, objB);

            if (OnOverLap != null)
                //OnOverLap(result, objB);
                InfoRePath.CallEvent(this.MgPath, "OnOverLap", OnOverLap,  result, objB);
        }
Esempio n. 38
0
 public TankSinTur(string name, GameObjInfo objInfo, string texPath, GameObjData skinData,
     float raderLength, float raderAng, Color raderColor, float raderAzi,
     float maxForwardSpeed, float maxBackwardSpeed, float maxRotaSpeed,
     float maxTurretRotaSpeed, float maxRaderRotaSpeed, float fireCDTime,
     Vector2 pos, float baseRota, float turretRota)
 {
     this.name = name;
     this.objInfo = objInfo;
     this.skin = new TankSkinSinTur(new TankSkinSinTurData(texPath, skinData));
     skin.Initial(pos, baseRota, turretRota);
     controller = new TankContrSinTur(objInfo, new Sprite[] { skin.Sprites[0] } , pos, baseRota, maxForwardSpeed, maxBackwardSpeed, maxRotaSpeed, maxTurretRotaSpeed, maxRaderRotaSpeed, Math.Max(0, fireCDTime));
     colChecker = controller;
     phisicalUpdater = controller;
     controller.onShoot += new EventHandler(controller_onShoot);
     controller.OnCollied += new OnCollidedEventHandler(controller_OnCollied);
     controller.OnOverlap += new OnCollidedEventHandler(controller_OnOverlap);
     controller.posAziChanged += new SmartTank.PhiCol.NonInertiasPhiUpdater.PosAziChangedEventHandler(controller_OnPosAziChanged);
     rader = new Rader(raderAng, raderLength, pos, raderAzi + baseRota, raderColor);
 }
Esempio n. 39
0
 public TankSinTur(string name, GameObjInfo objInfo, string texPath, GameObjData skinData,
     float raderLength, float raderAng, Color raderColor,
     float maxForwardSpeed, float maxBackwardSpeed, float maxRotaSpeed,
     float maxTurretRotaSpeed, float maxRaderRotaSpeed, float fireCDTime,
     Vector2 pos, float baseAzi)
     : this(name, objInfo, texPath, skinData,
     raderLength, raderAng, raderColor, 0, maxForwardSpeed, maxBackwardSpeed, maxRotaSpeed, maxTurretRotaSpeed,
     maxRaderRotaSpeed, fireCDTime, pos, 0, 0)
 {
 }
Esempio n. 40
0
        void controller_OnOverlap( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {
            if (onOverLap != null)
                onOverLap( this, result, objB );

            if (OnOverLap != null)
                OnOverLap( result, objB );
        }
Esempio n. 41
0
 void phiUpdater_OnCollied( IGameObj sender, CollisionResult result, GameObjInfo objB )
 {
     if (OnCollided != null)
         OnCollided( this, result, objB );
 }