Browse Source

fix: 🐛 finish the fuction of Clipping

tags/0.1.0
shangfengh 2 years ago
parent
commit
3117e02407
2 changed files with 13 additions and 11 deletions
  1. +2
    -0
      logic/GameClass/GameObj/Character/Character.cs
  2. +11
    -11
      logic/Gaming/ActionManager.cs

+ 2
- 0
logic/GameClass/GameObj/Character/Character.cs View File

@@ -615,6 +615,8 @@ namespace GameClass.GameObj
{
return true;
}
if (targetObj.Type == GameObjType.Character && XY.Distance(targetObj.Position, this.Position) < this.Radius + targetObj.Radius)
return true;
return false;
}
}


+ 11
- 11
logic/Gaming/ActionManager.cs View File

@@ -326,16 +326,16 @@ namespace Gaming
(Math.Abs(player.Position.x - windowForClimb.Position.x) > GameData.numOfPosGridPerCell / 2) ? (GameData.numOfPosGridPerCell / 2 * (player.Position.x > windowForClimb.Position.x ? 1 : -1)) : 0,
(Math.Abs(player.Position.y - windowForClimb.Position.y) > GameData.numOfPosGridPerCell / 2) ? (GameData.numOfPosGridPerCell / 2 * (player.Position.y > windowForClimb.Position.y ? 1 : -1)) : 0);

Character? characterInWindow = (Character?)gameMap.OneInTheSameCell(windowForClimb.Position - 2 * windowToPlayer, GameObjType.Character);
if (characterInWindow != null)
{
if (player.IsGhost() && !characterInWindow.IsGhost())
characterManager.BeAttacked((Student)(characterInWindow), player.Attack(characterInWindow.Position, PlaceType.Null));
return false;
}
/* Character? characterInWindow = (Character?)gameMap.OneInTheSameCell(windowForClimb.Position - 2 * windowToPlayer, GameObjType.Character);
if (characterInWindow != null)
{
if (player.IsGhost() && !characterInWindow.IsGhost())
characterManager.BeAttacked((Student)(characterInWindow), player.Attack(characterInWindow.Position, PlaceType.Null));
return false;
}*/

Wall addWall = new Wall(windowForClimb.Position - 2 * windowToPlayer);
gameMap.Add(addWall);
//Wall addWall = new Wall(windowForClimb.Position - 2 * windowToPlayer);
// gameMap.Add(addWall);

player.PlayerState = PlayerStateType.ClimbingThroughWindows;
windowForClimb.WhoIsClimbing = player;
@@ -360,7 +360,7 @@ namespace Gaming
player.ReSetPos(windowToPlayer + windowForClimb.Position, PlaceType.Window);
player.MoveSpeed = player.SpeedOfClimbingThroughWindows;

moveEngine.MoveObj(player, (int)(windowToPlayer.Length() * 1000 / player.MoveSpeed), (-1 * windowToPlayer).Angle());
moveEngine.MoveObj(player, (int)(windowToPlayer.Length() * 3.0 * 1000 / player.MoveSpeed), (-1 * windowToPlayer).Angle());

new FrameRateTaskExecutor<int>(
loopCondition: () => player.PlayerState == PlayerStateType.ClimbingThroughWindows && gameMap.Timer.IsGaming,
@@ -376,7 +376,7 @@ namespace Gaming
player.ReSetPos(PosJumpOff, gameMap.GetPlaceType(PosJumpOff));
player.MoveSpeed = player.ReCalculateBuff(BuffType.AddSpeed, player.OrgMoveSpeed, GameData.MaxSpeed, GameData.MinSpeed);
windowForClimb.WhoIsClimbing = null;
gameMap.Remove(addWall);
// gameMap.Remove(addWall);
if (player.PlayerState == PlayerStateType.ClimbingThroughWindows)
{
player.PlayerState = PlayerStateType.Null;


Loading…
Cancel
Save