예제 #1
0
파일: NPC.cs 프로젝트: sxtgyrq/VRPGame
 private void NPCAutoControlCollect(RoleInGame role)
 {
     if (role.playerType == RoleInGame.PlayerType.NPC)
     {
         if (role.getCar().ability.costVolume >= role.getCar().ability.Volume)
         {
             SetNPCToDoSomeThing((NPC)role, NPCAction.Attack);
         }
         else
         {
             SetNPCToDoSomeThing((NPC)role, NPCAction.Collect);
         }
     }
 }
예제 #2
0
파일: NPC.cs 프로젝트: sxtgyrq/VRPGame
 private string NPCAutoControlTax(RoleInGame role)
 {
     if (role.playerType == RoleInGame.PlayerType.NPC)
     {
         if (role.getCar().ability.costBusiness >= role.getCar().ability.Business)
         {
             return(this.SetNPCToDoSomeThing((NPC)role, NPCAction.Attack));
         }
         else
         {
             return(this.SetNPCToDoSomeThing((NPC)role, NPCAction.Tax));
         }
     }
     else
     {
         return("");
     }
 }
예제 #3
0
파일: Magic.cs 프로젝트: sxtgyrq/VRPGame
        internal void confusePrepareMagicChanged(RoleInGame role, ref List <string> notifyMsgs)
        {
            foreach (var item in this._Players)
            {
                if (item.Value.playerType == RoleInGame.PlayerType.player)
                {
                    var player = (Player)item.Value;
                    var url    = player.FromUrl;
                    var On     = !string.IsNullOrEmpty(role.getCar().isControllingKey);
                    if (this._Players.ContainsKey(role.getCar().isControllingKey))
                    {
                        var victim = this._Players[role.getCar().isControllingKey];
                        if (On)
                        {
                            var    carPosition = Program.dt.GetFpByIndex(role.getCar().targetFpIndex);
                            double startX, startY;
                            CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(carPosition.Longitude, carPosition.Latitde, out startX, out startY);
                            var    targetPosition = Program.dt.GetFpByIndex(victim.StartFPIndex);
                            double endX, endY;
                            CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(targetPosition.Longitude, targetPosition.Latitde, out endX, out endY);

                            ConfusePrepareNotify an = new ConfusePrepareNotify()
                            {
                                c           = "ConfusePrepareNotify",
                                WebSocketID = player.WebSocketID,
                                Key         = role.Key,
                                On          = On,
                                StartX      = Convert.ToInt32(startX * 256),
                                StartY      = Convert.ToInt32(startY * 256),
                                EndX        = Convert.ToInt32(endX * 256),
                                EndY        = Convert.ToInt32(endY * 256)
                            };

                            var sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(an);
                            notifyMsgs.Add(url);
                            notifyMsgs.Add(sendMsg);
                        }
                        else
                        {
                        }
                    }
                }
            }
        }
예제 #4
0
파일: Car.cs 프로젝트: sxtgyrq/VRPGame
 private void addPlayerCarRecord(Player self, RoleInGame other, ref List <string> msgsWithUrl)
 {
     //这是发送给self的消息
     //throw new NotImplementedException();
     if (self.othersContainsKey(other.Key))
     {
         //for (var indexOfCar = 0; indexOfCar < 5; indexOfCar++)
         {
             if (self.GetOthers(other.Key).getCarState() == other.getCar().changeState)
             {
             }
             else
             {
                 if (other.getCar().animateData == null)
                 {
                 }
                 else
                 {
                     var deltaT = (DateTime.Now - other.getCar().animateData.recordTime).TotalMilliseconds;
                     var result = new
                     {
                         deltaT      = deltaT > Int32.MaxValue ? Int32.MaxValue : Convert.ToInt32(deltaT),
                         animateData = other.getCar().animateData.animateData,
                         start       = other.getCar().animateData.start,
                         isParking   = other.getCar().animateData.isParking
                     };
                     var obj = new BradCastAnimateOfOthersCar2
                     {
                         c           = "BradCastAnimateOfOthersCar2",
                         Animate     = result,
                         WebSocketID = self.WebSocketID,
                         carID       = getCarName() + "_" + other.Key,
                         parentID    = other.Key,
                     };
                     var json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
                     msgsWithUrl.Add(self.FromUrl);
                     msgsWithUrl.Add(json);
                 }
                 self.GetOthers(other.Key).setCarState(other.getCar().changeState);
             }
         }
     }
 }