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; protected int ap;
public int AP public int AP
{ {
get => Interlocked.CompareExchange(ref ap, 0, 1);
get => Interlocked.CompareExchange(ref ap, 0, 0);
} }
public void AddAP(int addAp) 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; private int isMoving = 0;
public int IsMoving public int IsMoving
{ {
get => Interlocked.CompareExchange(ref isMoving, 0, 1);
get => Interlocked.CompareExchange(ref isMoving, 0, 0);
set => Interlocked.Exchange(ref isMoving, value); set => Interlocked.Exchange(ref isMoving, value);
} }


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


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

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


Loading…
Cancel
Save