Browse Source

feat: add the fuction of nowTime

tags/0.1.0
shangfengh 3 years ago
parent
commit
1cd52756b8
5 changed files with 12 additions and 4 deletions
  1. +2
    -2
      logic/GameClass/GameObj/Bullet/Bullet.Ghost.cs
  2. +7
    -1
      logic/GameClass/GameObj/Map/MapGameTimer.cs
  3. +1
    -0
      logic/Gaming/CharacterManager .cs
  4. +1
    -0
      logic/Preparation/Interface/ITimer.cs
  5. +1
    -1
      logic/Server/GameServer.cs

+ 2
- 2
logic/GameClass/GameObj/Bullet/Bullet.Ghost.cs View File

@@ -121,8 +121,8 @@ namespace GameClass.GameObj
public override bool IsRemoteAttack => false;

public override int CastTime => (int)BulletAttackRange / Speed;
public override int Backswing => 0;
public override int RecoveryFromHit => 0;
public override int Backswing => GameData.basicRecoveryFromHit;
public override int RecoveryFromHit => GameData.basicRecoveryFromHit;
public const int cd = GameData.basicCD;
public override int CD => cd;
public const int maxBulletNum = 1;


+ 7
- 1
logic/GameClass/GameObj/Map/MapGameTimer.cs View File

@@ -1,4 +1,5 @@
using System.Threading;
using System;
using System.Threading;
using Preparation.Interface;

namespace GameClass.GameObj
@@ -8,8 +9,12 @@ namespace GameClass.GameObj
// xfgg说:爱因斯坦说,每个坐标系都有与之绑定的时钟,(x, y, z, ict) 构成四维时空坐标,在洛伦兹变换下满足矢量性(狗头)
private readonly GameTimer timer = new();
public ITimer Timer => timer;

public class GameTimer : ITimer
{
private int startTime;
public int nowTime() => Environment.TickCount - startTime;

private bool isGaming = false;
public bool IsGaming
{
@@ -30,6 +35,7 @@ namespace GameClass.GameObj
if (isGaming)
return false;
isGaming = true;
startTime = Environment.TickCount;
}
Thread.Sleep(timeInMilliseconds);
isGaming = false;


+ 1
- 0
logic/Gaming/CharacterManager .cs View File

@@ -213,6 +213,7 @@ namespace Gaming
{
ghost.AddScore(GameData.TrickerScoreStudentDie);
Die(player);
return;
}
}
player.PlayerState = PlayerStateType.Addicted;


+ 1
- 0
logic/Preparation/Interface/ITimer.cs View File

@@ -4,6 +4,7 @@ namespace Preparation.Interface
public interface ITimer
{
bool IsGaming { get; set; }
public int nowTime();
public bool StartGame(int timeInMilliseconds);
}
}

+ 1
- 1
logic/Server/GameServer.cs View File

@@ -199,7 +199,7 @@ namespace Server
private MessageOfAll GetMessageOfAll()
{
MessageOfAll msg = new MessageOfAll();
//msg.GameTime
msg.GameTime = game.GameMap.Timer.nowTime();
msg.SubjectFinished = (int)game.GameMap.NumOfRepairedGenerators;
msg.StudentGraduated = (int)game.GameMap.NumOfEscapedStudent;
msg.StudentQuited = (int)game.GameMap.NumOfDeceasedStudent;


Loading…
Cancel
Save