//复位 public void AskPause(Camp c) { Pause(); Round -= 50; if (Round < 0) { Round = 0; } bool Aget = false, Bget = false; switch (c) { case Camp.CampA: Bget = true; ++APauseNum; break; case Camp.CampB: Aget = true; ++BPauseNum; break; } if (CarA.People != null) { int currNum = CarA.People.Number; if (Aget) { int s = (CarA.People.Score() > BPauseNum * 50) ? CarA.People.Score() : BPauseNum * 50; addScore(Camp.CampA, s); } CarA.FinishCarry(false); NewPassenger(currNum); } else if (Aget) { addScore(Camp.CampA, BPauseNum * 50); } if (CarB.People != null) { int currNum = CarB.People.Number; if (Bget) { int s = (CarB.People.Score() > APauseNum * 50) ? CarB.People.Score() : APauseNum * 50; addScore(Camp.CampB, s); } CarB.FinishCarry(false); NewPassenger(currNum); } else if (Bget) { addScore(Camp.CampB, APauseNum * 50); } }
public void Update()//每回合执行 { if (state == GameState.Normal) { Round++; //GetInfoFromCameraAndUpdate(); CheckPassengerNumber(); #region PunishmentPhase //if (!CarDotValid(CarA.Pos)) CarA.Stop(); //if (!CarDotValid(CarB.Pos)) CarB.Stop(); #endregion //上车 for (int i = 0; i != CurrPassengerNumber; ++i) { Passenger p = Passengers[i]; if (p.Owner != Camp.None) { continue; //已经上车了 } if (CarA.UnderStop == false && CarA.People == null && GetDistance(p.StartDestPos.StartPos, CarA.Pos) < MinCarryDistance) { CarA.StartCarry(p); p.Owner = Camp.CampA; } else if (CarB.UnderStop == false && CarB.People == null && GetDistance(p.StartDestPos.StartPos, CarB.Pos) < MinCarryDistance) { CarB.StartCarry(p); p.Owner = Camp.CampB; } } //下车 if (CarA.People != null && GetDistance(CarA.People.StartDestPos.DestPos, CarA.Pos) < MinCarryDistance) { int currNum = CarA.People.Number; CarA.FinishCarry(); NewPassenger(currNum); } if (CarB.People != null && GetDistance(CarB.People.StartDestPos.DestPos, CarB.Pos) < MinCarryDistance) { int currNum = CarB.People.Number; CarB.FinishCarry(); NewPassenger(currNum); } if ((Round >= 1200 && DebugMode == false) || (Round >= 1000000 && DebugMode == true)) //结束比赛 { End(); } } //byte[] message = PackMessage(); //SendMessage }
public void nextStage() { ++GameCount; if (GameCount >= 3) { MaxRound = 600; } else { MaxRound = 1200; } CarA.FinishCarry(false); CarB.FinishCarry(false); Round = 0; state = GameState.Unstart; InitialPassenger(100); DebugMode = false; if (FoulTimeFS != null) { byte[] data = Encoding.Default.GetBytes($"nextStage\r\n"); FoulTimeFS.Write(data, 0, data.Length); } }