-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Control panel formatting, working input modifiers, elevator and arm b…
…ehavior
- Loading branch information
1 parent
bbece64
commit ffc546f
Showing
7 changed files
with
133 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 19 additions & 28 deletions
47
fission/src/systems/simulation/behavior/GenericArmBehavior.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,25 @@ | ||
// import HingeDriver from "../driver/HingeDriver"; | ||
// import WheelDriver from "../driver/WheelDriver"; | ||
// import HingeStimulus from "../stimulus/HingeStimulus"; | ||
// import WheelRotationStimulus from "../stimulus/WheelStimulus"; | ||
// import Behavior from "./Behavior"; | ||
// import InputSystem from "@/systems/input/InputSystem"; | ||
import HingeDriver from "../driver/HingeDriver"; | ||
import HingeStimulus from "../stimulus/HingeStimulus"; | ||
import Behavior from "./Behavior"; | ||
import InputSystem from "@/systems/input/InputSystem"; | ||
|
||
// class ArcadeDriveBehavior extends Behavior { | ||
// private _hingeDriver: HingeDriver; | ||
class GenericArmBehavior extends Behavior { | ||
private _hingeDriver: HingeDriver; | ||
|
||
// private driveSpeed = 30; | ||
// private turnSpeed = 30; | ||
private _rotationalSpeed = 30; | ||
|
||
// constructor(hingeDriver: HingeDriver, hingeStimulus: HingeStimulus) { | ||
// super(leftWheels.concat(rightWheels), leftStimuli.concat(rightStimuli)); | ||
// this.leftWheels = leftWheels; | ||
// this.rightWheels = rightWheels; | ||
// } | ||
constructor(hingeDriver: HingeDriver, hingeStimulus: HingeStimulus) { | ||
super([hingeDriver], [hingeStimulus]); | ||
this._hingeDriver = hingeDriver; | ||
} | ||
|
||
// driveSpeeds(linearVelocity: number, rotationVelocity: number) { | ||
// let leftSpeed = linearVelocity + rotationVelocity; | ||
// let rightSpeed = linearVelocity - rotationVelocity; | ||
|
||
// this.leftWheels.forEach((wheel) => wheel.targetWheelSpeed = leftSpeed); | ||
// this.rightWheels.forEach((wheel) => wheel.targetWheelSpeed = rightSpeed); | ||
// } | ||
rotateArm(rotationalVelocity: number) { | ||
this._hingeDriver.targetVelocity = rotationalVelocity; | ||
} | ||
|
||
// public Update(_: number): void { | ||
// this.driveSpeeds(InputSystem.getAxis("arcadeForward", "arcadeBackward")*this.driveSpeed, | ||
// InputSystem.getAxis("arcadeRight", "arcadeLeft")*this.turnSpeed); | ||
// } | ||
// } | ||
public Update(_: number): void { | ||
this.rotateArm(InputSystem.getAxis("armPositive", "armNegative")*this._rotationalSpeed); | ||
} | ||
} | ||
|
||
// export default ArcadeDriveBehavior; | ||
export default GenericArmBehavior; |
28 changes: 28 additions & 0 deletions
28
fission/src/systems/simulation/behavior/GenericElevatorBehavior.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import SliderDriver from "../driver/SliderDriver"; | ||
import SliderStimulus from "../stimulus/SliderStimulus"; | ||
import Behavior from "./Behavior"; | ||
import InputSystem from "@/systems/input/InputSystem"; | ||
|
||
class GenericElevatorBehavior extends Behavior { | ||
private _sliderDriver: SliderDriver; | ||
|
||
private _linearSpeed = 1; | ||
|
||
private _inverted: boolean; | ||
|
||
constructor(sliderDriver: SliderDriver, sliderStimulus: SliderStimulus, inverted: boolean) { | ||
super([sliderDriver], [sliderStimulus]); | ||
this._sliderDriver = sliderDriver; | ||
this._inverted = inverted; | ||
} | ||
|
||
moveElevator(positionDelta: number) { | ||
this._sliderDriver.targetPosition += positionDelta * (this._inverted ? -1 : 1); | ||
} | ||
|
||
public Update(deltaT: number): void { | ||
this.moveElevator(InputSystem.getAxis("elevatorPositive", "elevatorNegative")*this._linearSpeed*deltaT); | ||
} | ||
} | ||
|
||
export default GenericElevatorBehavior; |
Oops, something went wrong.