| @@ -80,7 +80,7 @@ namespace GameClass.GameObj | |||
| return new BecomeInvisible(); | |||
| case ActiveSkillType.UseKnife: | |||
| return new UseKnife(); | |||
| case ActiveSkillType.CanBeginToCharge: | |||
| case ActiveSkillType.CanBeginToCharge: | |||
| return new CanBeginToCharge(); | |||
| case ActiveSkillType.Punish: | |||
| return new Punish(); | |||
| @@ -50,12 +50,13 @@ namespace GameClass.GameObj | |||
| // 移动,改变坐标 | |||
| public long MovingSetPos(XY moveVec, PlaceType place) | |||
| { | |||
| lock (gameObjLock) | |||
| { | |||
| FacingDirection = moveVec; | |||
| this.Position += moveVec; | |||
| this.place = place; | |||
| } | |||
| if (moveVec.x != 0 || moveVec.y != 0) | |||
| lock (gameObjLock) | |||
| { | |||
| FacingDirection = moveVec; | |||
| this.Position += moveVec; | |||
| this.place = place; | |||
| } | |||
| return moveVec * moveVec; | |||
| } | |||
| @@ -31,47 +31,48 @@ namespace Gaming | |||
| if ((!player.Commandable())) return false; | |||
| IActiveSkill skill = player.UseIActiveSkill(ActiveSkillType.CanBeginToCharge); | |||
| Debugger.Output(player, "can begin to charge!"); | |||
| new Thread | |||
| ( | |||
| () => | |||
| { | |||
| new FrameRateTaskExecutor<int>( | |||
| loopCondition: () => player.Commandable() && gameMap.Timer.IsGaming, | |||
| loopToDo: () => | |||
| { | |||
| gameMap.GameObjLockDict[GameObjType.Character].EnterReadLock(); | |||
| try | |||
| { | |||
| foreach (Character character in gameMap.GameObjDict[GameObjType.Character]) | |||
| { | |||
| if (character.IsGhost() != player.IsGhost() && XY.Distance(player.Position + new XY(player.FacingDirection, player.Radius), character.Position) <= character.Radius) | |||
| { | |||
| AttackManager.BeStunned(character, GameData.TimeOfGhostFaintingWhenCharge); | |||
| player.AddScore(GameData.StudentScoreTrickerBeStunned(GameData.TimeOfGhostFaintingWhenCharge)); | |||
| AttackManager.BeStunned(player, GameData.TimeOfStudentFaintingWhenCharge); | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| finally | |||
| { | |||
| gameMap.GameObjLockDict[GameObjType.Character].ExitReadLock(); | |||
| } | |||
| }, | |||
| timeInterval: GameData.frameDuration, | |||
| finallyReturn: () => 0, | |||
| maxTotalDuration: skill.DurationTime | |||
| ) | |||
| .Start(); | |||
| } | |||
| ) | |||
| { IsBackground = true }.Start(); | |||
| return ActiveSkillEffect(skill, player, () => | |||
| { | |||
| player.AddMoveSpeed(skill.DurationTime, 3.0); | |||
| new Thread | |||
| ( | |||
| () => | |||
| { | |||
| new FrameRateTaskExecutor<int>( | |||
| loopCondition: () => player.Commandable() && gameMap.Timer.IsGaming, | |||
| loopToDo: () => | |||
| { | |||
| gameMap.GameObjLockDict[GameObjType.Character].EnterReadLock(); | |||
| try | |||
| { | |||
| foreach (Character character in gameMap.GameObjDict[GameObjType.Character]) | |||
| { | |||
| if (character.IsGhost() != player.IsGhost() && Math.Max(XY.Distance(player.Position, character.Position), XY.Distance(player.Position + new XY(player.FacingDirection, player.Radius), character.Position)) <= character.Radius + player.Radius + GameData.tolerancesLength) | |||
| { | |||
| AttackManager.BeStunned(character, GameData.TimeOfGhostFaintingWhenCharge); | |||
| player.AddScore(GameData.StudentScoreTrickerBeStunned(GameData.TimeOfGhostFaintingWhenCharge)); | |||
| AttackManager.BeStunned(player, GameData.TimeOfStudentFaintingWhenCharge); | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| finally | |||
| { | |||
| gameMap.GameObjLockDict[GameObjType.Character].ExitReadLock(); | |||
| } | |||
| }, | |||
| timeInterval: GameData.frameDuration, | |||
| finallyReturn: () => 0, | |||
| maxTotalDuration: skill.DurationTime | |||
| ) | |||
| .Start(); | |||
| } | |||
| ) | |||
| { IsBackground = true }.Start(); | |||
| }, | |||
| () => | |||
| { | |||
| @@ -7,9 +7,11 @@ namespace Preparation.Utility | |||
| { | |||
| #region 基本常数 | |||
| public const int numOfStepPerSecond = 20; // 每秒行走的步数 | |||
| public const int tolerancesLength = 10; | |||
| public const int frameDuration = 50; // 每帧时长 | |||
| public const int checkInterval = 50; // 检查位置标志、补充子弹的帧时长 | |||
| public const long gameDuration = 600000; // 游戏时长600000ms = 10min | |||
| public const int MinSpeed = 1; // 最小速度 | |||
| @@ -63,7 +65,7 @@ namespace Preparation.Utility | |||
| #endregion | |||
| #region 角色相关 | |||
| public const int numOfStudent = 4; | |||
| public const int characterRadius = numOfPosGridPerCell / 2 / 5 * 4; // 人物半径 | |||
| public const int characterRadius = numOfPosGridPerCell * 4 / 10; // 人物半径 | |||
| public const int basicTreatSpeed = 100; | |||
| public const int basicFixSpeed = 100; | |||
| @@ -79,7 +81,12 @@ namespace Preparation.Utility | |||
| public const int basicTreatmentDegree = 1500000; | |||
| public const int basicTimeOfRescue = 1000; | |||
| public const int basicMoveSpeed = 9000;//DEBUG //1270;TRUE // 基本移动速度,单位:s-1 | |||
| #if DEBUG | |||
| public const int basicMoveSpeed = 9000;// 基本移动速度,单位:s-1 | |||
| #else | |||
| public const int basicMoveSpeed = 1270; | |||
| #endif | |||
| public const int characterMaxSpeed = 12000; // 最大速度 | |||
| public const double basicConcealment = 1.0; | |||
| @@ -177,7 +184,7 @@ namespace Preparation.Utility | |||
| public const int PropRadius = numOfPosGridPerCell / 2; | |||
| public const int PropMoveSpeed = 3000; | |||
| public const int PropMaxMoveDistance = 15 * numOfPosGridPerCell; | |||
| public const long PropProduceTime = 10000; | |||
| public const long PropProduceTime = 20000; | |||
| public const int PropDuration = 10000; | |||
| public const int ApPropAdd = basicApOfGhost * 12 / 10; | |||
| @@ -19,8 +19,16 @@ namespace Preparation.Utility | |||
| } | |||
| public XY(XY Direction, double length) | |||
| { | |||
| this.x = (int)(length * Math.Cos(Direction.Angle())); | |||
| this.y = (int)(length * Math.Sin(Direction.Angle())); | |||
| if (Direction.x == 0 && Direction.y == 0) | |||
| { | |||
| this.x = 0; | |||
| this.y = 0; | |||
| } | |||
| else | |||
| { | |||
| this.x = (int)(length * Math.Cos(Direction.Angle())); | |||
| this.y = (int)(length * Math.Sin(Direction.Angle())); | |||
| } | |||
| } | |||
| public override string ToString() | |||
| { | |||