Slash-The-Hordes/assets/Scripts/Game/Input/MultiInput.ts
2022-11-14 16:35:47 +01:00

21 lines
474 B
TypeScript

import { Vec2 } from "cc";
import { IInput } from "./IInput";
export class MultiInput implements IInput {
private inputs: IInput[];
public constructor(inputs: IInput[]) {
this.inputs = inputs;
}
public getAxis(): Vec2 {
for (let i = 0; i < this.inputs.length; i++) {
if (!this.inputs[i].getAxis().equals(Vec2.ZERO)) {
return this.inputs[i].getAxis();
}
}
return new Vec2();
}
}