Browse Source

fix: 🐛 fix a bug about Interlocked.CompareExchange

tags/v0.1.0
shangfengh 2 years ago
parent
commit
b159779ecf
3 changed files with 6 additions and 6 deletions
  1. +1
    -1
      logic/GameClass/GameObj/Bullet/Bullet.cs
  2. +2
    -2
      logic/GameClass/GameObj/Moveable.cs
  3. +3
    -3
      logic/Preparation/Interface/ISkill.cs

+ 1
- 1
logic/GameClass/GameObj/Bullet/Bullet.cs View File

@@ -14,7 +14,7 @@ namespace GameClass.GameObj
protected int ap;
public int AP
{
get => Interlocked.CompareExchange(ref ap, 0, 1);
get => Interlocked.CompareExchange(ref ap, 0, 0);
}
public void AddAP(int addAp)
{


+ 2
- 2
logic/GameClass/GameObj/Moveable.cs View File

@@ -50,7 +50,7 @@ namespace GameClass.GameObj
private int isMoving = 0;
public int IsMoving
{
get => Interlocked.CompareExchange(ref isMoving, 0, 1);
get => Interlocked.CompareExchange(ref isMoving, 0, 0);
set => Interlocked.Exchange(ref isMoving, value);
}

@@ -157,7 +157,7 @@ namespace GameClass.GameObj
/// </summary>
public int MoveSpeed
{
get => Interlocked.CompareExchange(ref moveSpeed, 0, 1);
get => Interlocked.CompareExchange(ref moveSpeed, 0, 0);
set => Interlocked.Exchange(ref moveSpeed, value);
}
/// <summary>


+ 3
- 3
logic/Preparation/Interface/ISkill.cs View File

@@ -34,7 +34,7 @@ namespace Preparation.Interface
{
get
{
return Interlocked.CompareExchange(ref timeUntilActiveSkillAvailable, 0, 1);
return Interlocked.CompareExchange(ref timeUntilActiveSkillAvailable, 0, 0);
}
set
{
@@ -47,7 +47,7 @@ namespace Preparation.Interface
public int isBeingUsed = 0;//实为bool
public int IsBeingUsed
{
get => Interlocked.CompareExchange(ref isBeingUsed, 0, 1);
get => Interlocked.CompareExchange(ref isBeingUsed, 0, 0);
set => Interlocked.Exchange(ref isBeingUsed, value);
}
}
@@ -169,7 +169,7 @@ namespace Preparation.Interface
private int degreeOfMeditation = 0;
public int DegreeOfMeditation
{
get => Interlocked.CompareExchange(ref degreeOfMeditation, 0, 1);
get => Interlocked.CompareExchange(ref degreeOfMeditation, 0, 0);
set => Interlocked.Exchange(ref degreeOfMeditation, value);
}
}


Loading…
Cancel
Save