コード例 #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;
 }
コード例 #2
0
ファイル: WarShip.cs プロジェクト: ingex0/smarttank
 public void CallOnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnOverLap != null)
     {
         OnOverLap(Sender, result, objB);
     }
 }
コード例 #3
0
ファイル: WarShip.cs プロジェクト: ingex0/smarttank
 void phisicalUpdater_OnOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnOverLap != null)
     {
         InfoRePath.CallEvent(this.mgPath, "OnOverlap", OnOverLap, this, result, objB);
     }
 }
コード例 #4
0
ファイル: WarShip.cs プロジェクト: ingex0/smarttank
 public void CallOnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnCollied != null)
     {
         OnCollied(Sender, result, objB);
     }
 }
コード例 #5
0
ファイル: CopyInfo.cs プロジェクト: wyj-source/THUAI4
        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);
        }
コード例 #6
0
ファイル: WarShip.cs プロジェクト: ingex0/smarttank
 void phisicalUpdater_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnCollied != null)
     {
         InfoRePath.CallEvent(this.mgPath, "OnCollied", OnCollied, this, result, objB);
     }
 }
コード例 #7
0
 void phiUpdater_OnCollied(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (onCollided != null)
     {
         onCollided(this, result, objB);
     }
 }
コード例 #8
0
ファイル: StarwarLogic.cs プロジェクト: ingex0/smarttank
        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();
            }
        }
コード例 #9
0
ファイル: StarwarLogic.cs プロジェクト: ingex0/smarttank
        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);
            }
        }
コード例 #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);
            }
            }
        }
コード例 #11
0
 void phiUpdater_OnOverlap(IGameObj sender, CollisionResult result, GameObjInfo objB)
 {
     if (OnOverlap != null)
     {
         OnOverlap(this, result, objB);
     }
 }
コード例 #12
0
 void Shell_onOverlap(IGameObj Sender, CollisionResult result, GameObjInfo objB)
 {
     if (objB.ObjClass == "Border")
     {
         NiceShootSum = Math.Max(0, NiceShootSum - 10);
     }
     //camera.Focus( tank );
 }
コード例 #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;
 }
コード例 #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);
     }
 }
コード例 #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);
     }
 }
コード例 #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");
        }
コード例 #17
0
        public static GameObjInfo BirthPoint(BirthPoint birthPoint)                     //转换成出生点
        {
            GameObjInfo ret = new GameObjInfo();

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

            return(ret);
        }
コード例 #18
0
        public static GameObjInfo Wall(Wall wall)                               //转换成墙
        {
            GameObjInfo ret = new GameObjInfo();

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

            return(ret);
        }
コード例 #19
0
ファイル: StarwarLogic.cs プロジェクト: ingex0/smarttank
        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);
            }
        }
コード例 #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)
 {
 }
コード例 #21
0
ファイル: HeroScript.cs プロジェクト: wyj-source/THUAI4
 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;
 }
コード例 #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;
 }
コード例 #23
0
ファイル: PropManager.cs プロジェクト: wyj-source/THUAI4
    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);
    }
コード例 #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);
 }
コード例 #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 );
            //}
        }
コード例 #26
0
ファイル: ObstacleCommon.cs プロジェクト: ingex0/smarttank
 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 } );
 }
コード例 #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;
 }
コード例 #28
0
ファイル: TankControlSinTur.cs プロジェクト: ingex0/smarttank
 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;
 }
コード例 #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 });
 }
コード例 #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);
            }
        }
コード例 #31
0
ファイル: DuelerNoFirst.cs プロジェクト: ingex0/smarttank
 void CollideHandler(CollisionResult result, GameObjInfo objB)
 {
     if (objB.ObjClass == "Border")
     {
     }
     else if (objB.ObjClass == "ShellNormal")
     {
     }
     else if (objB.ObjClass == "DuelTank")
     {
     }
 }
コード例 #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);
            }
        }
コード例 #33
0
ファイル: ItemCommon.cs プロジェクト: ingex0/smarttank
        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 );
        }
コード例 #34
0
ファイル: ItemCommon.cs プロジェクト: ingex0/smarttank
 void phiUpdater_OnOverlap( IGameObj sender, CollisionResult result, GameObjInfo objB )
 {
     if (OnOverlap != null)
         OnOverlap( this, result, objB );
 }
コード例 #35
0
ファイル: TankSinTur.cs プロジェクト: ingex0/smarttank
        void controller_OnCollied( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {
            if (onCollide != null)
                onCollide( this, result, objB );

            if (OnCollide != null)
                OnCollide( result, objB );
        }
コード例 #36
0
ファイル: TankSinTur.cs プロジェクト: ingex0/smarttank
        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);
        }
コード例 #37
0
ファイル: TankSinTur.cs プロジェクト: ingex0/smarttank
        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);
        }
コード例 #38
0
ファイル: TankSinTur.cs プロジェクト: ingex0/smarttank
 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);
 }
コード例 #39
0
ファイル: TankSinTur.cs プロジェクト: ingex0/smarttank
 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)
 {
 }
コード例 #40
0
ファイル: TankSinTur.cs プロジェクト: ingex0/smarttank
        void controller_OnOverlap( IGameObj Sender, CollisionResult result, GameObjInfo objB )
        {
            if (onOverLap != null)
                onOverLap( this, result, objB );

            if (OnOverLap != null)
                OnOverLap( result, objB );
        }
コード例 #41
0
ファイル: ItemCommon.cs プロジェクト: ingex0/smarttank
 void phiUpdater_OnCollied( IGameObj sender, CollisionResult result, GameObjInfo objB )
 {
     if (OnCollided != null)
         OnCollided( this, result, objB );
 }