add category for platform
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
import { ConfigUiParamsCategories } from "@24tools/ads_common";
|
||||||
|
|
||||||
|
export const characterSettings: ConfigUiParamsCategories[] = [
|
||||||
|
{
|
||||||
|
id: "character",
|
||||||
|
name: "Character settings",
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
id: "movement_speed",
|
||||||
|
name: "Movement speed",
|
||||||
|
type: "int",
|
||||||
|
values: [
|
||||||
|
0,
|
||||||
|
10,
|
||||||
|
3
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -5,10 +5,12 @@ import { analytics } from "./analytics";
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
import { installBanner } from "./installBanner";
|
import { installBanner } from "./installBanner";
|
||||||
import { globalSettings } from "./globalSettings";
|
import { globalSettings } from "./globalSettings";
|
||||||
|
import { characterSettings } from "./characterSettings";
|
||||||
|
|
||||||
export const configUIParams: ConfigUiParamsCategories[][] = [
|
export const configUIParams: ConfigUiParamsCategories[][] = [
|
||||||
analytics,
|
analytics,
|
||||||
installBanner,
|
installBanner,
|
||||||
globalSettings,
|
globalSettings,
|
||||||
|
characterSettings,
|
||||||
sounds,
|
sounds,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Vector3 } from "three";
|
|||||||
|
|
||||||
export class MoveC {
|
export class MoveC {
|
||||||
private readonly input: IMoveInput;
|
private readonly input: IMoveInput;
|
||||||
private readonly speed: number;
|
private speed: number;
|
||||||
private readonly moveDirection = new Vector3();
|
private readonly moveDirection = new Vector3();
|
||||||
|
|
||||||
get Direction() {
|
get Direction() {
|
||||||
@@ -14,6 +14,10 @@ export class MoveC {
|
|||||||
return this.moveDirection.length() / this.speed;
|
return this.moveDirection.length() / this.speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setSpeed(speed: number) {
|
||||||
|
this.speed = speed;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(input: IMoveInput, speed = 5) {
|
constructor(input: IMoveInput, speed = 5) {
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Delegate, ResourcesC, UpdateController } from "@24tools/playable_template";
|
import { Delegate, ResourcesC, Template, UpdateController } from "@24tools/playable_template";
|
||||||
import { Character } from "./Character/Character";
|
import { Character } from "./Character/Character";
|
||||||
import { ResourcesType } from "./Enums/ResourcesType";
|
import { ResourcesType } from "./Enums/ResourcesType";
|
||||||
import { MeshType } from "./Enums/MeshType";
|
import { MeshType } from "./Enums/MeshType";
|
||||||
@@ -53,7 +53,7 @@ export class Player {
|
|||||||
PhysicsTriggerC.setPlayerBody(this.physics.getPhysicsBody());
|
PhysicsTriggerC.setPlayerBody(this.physics.getPhysicsBody());
|
||||||
|
|
||||||
this.input = new PlayerInput();
|
this.input = new PlayerInput();
|
||||||
const moveSpeed = 3;
|
const moveSpeed = Template.getValue<number>("character", "movement_speed");
|
||||||
const rotationSpeed = 8;
|
const rotationSpeed = 8;
|
||||||
this.movement = new MoveC(this.input, moveSpeed);
|
this.movement = new MoveC(this.input, moveSpeed);
|
||||||
this.rotation = new RotationC(this.container, rotationSpeed);
|
this.rotation = new RotationC(this.container, rotationSpeed);
|
||||||
@@ -91,6 +91,10 @@ export class Player {
|
|||||||
return this.container.getWorldPosition(new Vector3());
|
return this.container.getWorldPosition(new Vector3());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static setMoveSpeed(speed: number) {
|
||||||
|
this.movement?.setSpeed(speed);
|
||||||
|
}
|
||||||
|
|
||||||
static isMoving() {
|
static isMoving() {
|
||||||
return this.movement.Direction.lengthSq() > 0;
|
return this.movement.Direction.lengthSq() > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
} from "@24tools/playable_template";
|
} from "@24tools/playable_template";
|
||||||
import { CameraC } from "../controllers/CameraC";
|
import { CameraC } from "../controllers/CameraC";
|
||||||
import { ThreeC } from "../controllers/ThreeC";
|
import { ThreeC } from "../controllers/ThreeC";
|
||||||
|
import { Player } from "../controllers/Presets/Player";
|
||||||
import { PlayerInput } from "../controllers/Presets/Input/PlayerInput";
|
import { PlayerInput } from "../controllers/Presets/Input/PlayerInput";
|
||||||
import { Color } from "three";
|
import { Color } from "three";
|
||||||
import { Vec3 } from "cannon-es";
|
import { Vec3 } from "cannon-es";
|
||||||
@@ -73,5 +74,12 @@ export const beforeResourcesLoadedCb = () => {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (category === "character") {
|
||||||
|
if (variable === "movement_speed") {
|
||||||
|
Player.setMoveSpeed(Number(value));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user