FututeWand初步
This commit is contained in:
@@ -13,6 +13,11 @@ namespace Cielonos.MainGame
|
||||
public float angularSpeed;
|
||||
public float angularAcceleration;
|
||||
|
||||
public float returnMoveSpeed = -1f;
|
||||
public float returnMoveAcceleration = -1f;
|
||||
public float returnAngularSpeed = -1f;
|
||||
public float returnAngularAcceleration = -1f;
|
||||
|
||||
public bool isReturning;
|
||||
public float catchRadius;
|
||||
public float autoReturnTime; // Time in seconds after which it automatically returns if not triggered manually
|
||||
@@ -112,15 +117,33 @@ namespace Cielonos.MainGame
|
||||
return this;
|
||||
}
|
||||
|
||||
public BoomerangMoveSubmodule WithReturnParameters(float speed, float acceleration, float angularSpeed, float angularAcceleration)
|
||||
{
|
||||
this.returnMoveSpeed = speed;
|
||||
this.returnMoveAcceleration = acceleration;
|
||||
this.returnAngularSpeed = angularSpeed;
|
||||
this.returnAngularAcceleration = angularAcceleration;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void TriggerReturn(float moveSpeed = -1f, float moveAcceleration = -1f, float angularSpeed = -1f, float angularAcceleration = -1f)
|
||||
{
|
||||
if (isReturning || !canMove) return;
|
||||
isReturning = true;
|
||||
target = owner.creator; // Start tracing the player/creator
|
||||
if (moveSpeed >= 0f) this.moveSpeed = moveSpeed;
|
||||
if (moveAcceleration >= 0f) this.moveAcceleration = moveAcceleration;
|
||||
if (angularSpeed >= 0f) this.angularSpeed = angularSpeed;
|
||||
if (angularAcceleration >= 0f) this.angularAcceleration = angularAcceleration;
|
||||
|
||||
float targetSpeed = moveSpeed >= 0f ? moveSpeed : returnMoveSpeed;
|
||||
if (targetSpeed >= 0f) this.moveSpeed = targetSpeed;
|
||||
|
||||
float targetAcceleration = moveAcceleration >= 0f ? moveAcceleration : returnMoveAcceleration;
|
||||
if (targetAcceleration >= 0f) this.moveAcceleration = targetAcceleration;
|
||||
|
||||
float targetAngularSpeed = angularSpeed >= 0f ? angularSpeed : returnAngularSpeed;
|
||||
if (targetAngularSpeed >= 0f) this.angularSpeed = targetAngularSpeed;
|
||||
|
||||
float targetAngularAcceleration = angularAcceleration >= 0f ? angularAcceleration : returnAngularAcceleration;
|
||||
if (targetAngularAcceleration >= 0f) this.angularAcceleration = targetAngularAcceleration;
|
||||
|
||||
autoConnect = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user