replaced files
This commit is contained in:
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { Delegate, Helper, Template, UpdateController } from "@24tools/playable_template";
|
||||
import { Object3D, Vector3 } from "three";
|
||||
import { ThreeC } from "../../../ThreeC";
|
||||
import { CameraC } from "../../../CameraC";
|
||||
import { ThreeC } from "../core/ThreeC";
|
||||
import { CameraC } from "./CameraC";
|
||||
|
||||
export class FollowCameraC {
|
||||
private static updateDelegate: Delegate<number>;
|
||||
@@ -1,6 +1,6 @@
|
||||
import { EasyEvent, UpdateController } from "@24tools/playable_template";
|
||||
import { Box3, Object3D, Vector3 } from "three";
|
||||
import { Player } from "../Presets/Player";
|
||||
import { Player } from "../Player/Player";
|
||||
import {
|
||||
findInteractiveZoneFromMap,
|
||||
INTERACTIVE_ZONE_NAME,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { EasyEvent, JoystickC, UpdateController } from "@24tools/playable_template";
|
||||
import { Vector3 } from "three";
|
||||
import { PhysicsTriggerC } from "./PhysicsTriggerC";
|
||||
import { PropC, PropRegistry } from "./PropC";
|
||||
import { Player } from "../Presets/Player";
|
||||
import { PropC, PropRegistry } from "../Props/PropC";
|
||||
import { Player } from "../Player/Player";
|
||||
|
||||
export class GatherC {
|
||||
static readonly onCombatIdle = new EasyEvent<{}>();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Box3, BoxGeometry, Mesh, Object3D, Vector3 } from "three";
|
||||
import { ThreeC } from "../ThreeC";
|
||||
import { PhysicsBody, PhysicsLayer } from "../PhysicsC";
|
||||
import { ThreeC } from "../core/ThreeC";
|
||||
import { PhysicsBody, PhysicsLayer } from "../core/PhysicsC";
|
||||
import { PhysicsTriggerC } from "./PhysicsTriggerC";
|
||||
import { PropC } from "./PropC";
|
||||
import { findDamageStateLayers } from "./PropDamageLayers";
|
||||
import { resolvePropType } from "../Resources/PropDropTable";
|
||||
import { PropC } from "../Props/PropC";
|
||||
import { findDamageStateLayers } from "../Props/PropDamageLayers";
|
||||
import { resolvePropType } from "../Props/PropDropTable";
|
||||
|
||||
import { InteractiveZoneC } from "./InteractiveZoneC";
|
||||
import { ToolZoneC } from "./ToolZoneC";
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
} from "@24tools/playable_template";
|
||||
import { Box3, Object3D, Vector3 } from "three";
|
||||
import { Body } from "cannon-es";
|
||||
import { PLAYER_COLLIDER_RADIUS } from "../PhysicsC";
|
||||
import { PLAYER_COLLIDER_RADIUS } from "../core/PhysicsC";
|
||||
|
||||
const PLAYER_RADIUS = PLAYER_COLLIDER_RADIUS;
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { EasyEvent, UpdateController } from "@24tools/playable_template";
|
||||
import { AnimationAction, AnimationClip, AnimationMixer, LoopOnce, LoopRepeat, Object3D, Vector3 } from "three";
|
||||
import { clone } from "three/examples/jsm/utils/SkeletonUtils";
|
||||
import { ThreeC } from "../../ThreeC";
|
||||
import { ThreeC } from "../../core/ThreeC";
|
||||
import { GLTF } from "three/examples/jsm/loaders/GLTFLoader";
|
||||
import { Easing, Group, Tween } from "@tweenjs/tween.js";
|
||||
|
||||
+21
-23
@@ -1,10 +1,30 @@
|
||||
import { Delegate, JoystickC } from "@24tools/playable_template";
|
||||
import { Vector3 } from "three";
|
||||
import { IMoveInput } from "./MoveInput";
|
||||
import { FollowCameraC } from "../Movment/CameraMovment/FollowCamera";
|
||||
import { FollowCameraC } from "../../Camera/FollowCamera";
|
||||
|
||||
export class PlayerInput implements IMoveInput {
|
||||
private static threshold = 0.25;
|
||||
protected currentDirection = new Vector3();
|
||||
private moveDelegate: Delegate<any>;
|
||||
private stopDelegate: Delegate<any>;
|
||||
private startDelegate: Delegate<any>;
|
||||
inputActive = false;
|
||||
|
||||
constructor() {
|
||||
this.moveDelegate = JoystickC.onJoysticMove.addDelegate(this.onTouchMove.bind(this));
|
||||
JoystickC.onJoysticDown.addListener(this.moveDelegate);
|
||||
this.stopDelegate = JoystickC.onJoysticEnd.addDelegate(this.onTouchUp.bind(this));
|
||||
this.startDelegate = JoystickC.onJoysticStart.addDelegate(this.onTouchDown.bind(this));
|
||||
}
|
||||
|
||||
get CurrentDirection() {
|
||||
return this.currentDirection;
|
||||
}
|
||||
|
||||
get IsActive() {
|
||||
return this.inputActive;
|
||||
}
|
||||
|
||||
public static initJoystick() {
|
||||
const screenSize = window.screenSize;
|
||||
@@ -21,28 +41,6 @@ export class PlayerInput implements IMoveInput {
|
||||
JoystickC.init(options);
|
||||
}
|
||||
|
||||
protected currentDirection = new Vector3();
|
||||
private moveDelegate: Delegate<any>;
|
||||
private stopDelegate: Delegate<any>;
|
||||
private startDelegate: Delegate<any>;
|
||||
|
||||
get CurrentDirection() {
|
||||
return this.currentDirection;
|
||||
}
|
||||
|
||||
get IsActive() {
|
||||
return this.inputActive;
|
||||
}
|
||||
|
||||
inputActive = false;
|
||||
|
||||
constructor() {
|
||||
this.moveDelegate = JoystickC.onJoysticMove.addDelegate(this.onTouchMove.bind(this));
|
||||
JoystickC.onJoysticDown.addListener(this.moveDelegate);
|
||||
this.stopDelegate = JoystickC.onJoysticEnd.addDelegate(this.onTouchUp.bind(this));
|
||||
this.startDelegate = JoystickC.onJoysticStart.addDelegate(this.onTouchDown.bind(this));
|
||||
}
|
||||
|
||||
onTouchMove(payload: any) {
|
||||
this.getDirection(payload, this.currentDirection);
|
||||
if (this.currentDirection.length() <= PlayerInput.threshold) {
|
||||
@@ -6,6 +6,11 @@ export class MoveC {
|
||||
private speed: number;
|
||||
private readonly moveDirection = new Vector3();
|
||||
|
||||
constructor(input: IMoveInput, speed = 5) {
|
||||
this.input = input;
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
get Direction() {
|
||||
return this.moveDirection;
|
||||
}
|
||||
@@ -18,10 +23,6 @@ export class MoveC {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
constructor(input: IMoveInput, speed = 5) {
|
||||
this.input = input;
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
update(_delta: number) {
|
||||
this.moveDirection.copy(this.input.CurrentDirection).multiplyScalar(this.speed);
|
||||
@@ -1,18 +1,18 @@
|
||||
import { Delegate, ResourcesC, Template, UpdateController } from "@24tools/playable_template";
|
||||
import { Character } from "./Character/Character";
|
||||
import { ResourcesType } from "./Enums/ResourcesType";
|
||||
import { MeshType } from "./Enums/MeshType";
|
||||
import { ResourcesType } from "../Enums/ResourcesType";
|
||||
import { MeshType } from "../Enums/MeshType";
|
||||
import { GLTF } from "three/examples/jsm/loaders/GLTFLoader";
|
||||
import { PhysicsBody, PhysicsLayer, PLAYER_COLLIDER_RADIUS } from "../PhysicsC";
|
||||
import { PhysicsBody, PhysicsLayer, PLAYER_COLLIDER_RADIUS } from "../core/PhysicsC";
|
||||
import { Object3D, Vector3 } from "three";
|
||||
import { ThreeC } from "../ThreeC";
|
||||
import { ThreeC } from "../core/ThreeC";
|
||||
import { PlayerInput } from "./Input/PlayerInput";
|
||||
import { MoveC } from "./Movment/MoveC";
|
||||
import { Vector3CToT } from "./Helper";
|
||||
import { RotationC } from "./Movment/RotationC";
|
||||
import { FollowCameraC } from "./Movment/CameraMovment/FollowCamera";
|
||||
import { MoveC } from "./Movement/MoveC";
|
||||
import { Vector3CToT } from "../utils/Helper";
|
||||
import { RotationC } from "./Movement/RotationC";
|
||||
import { FollowCameraC } from "../Camera/FollowCamera";
|
||||
import { PhysicsTriggerC } from "../Map/PhysicsTriggerC";
|
||||
import { PropHpUIC } from "../Map/PropHpUIC";
|
||||
import { PropHpUIC } from "../Props/PropHpUIC";
|
||||
import { PlayerContext } from "./PlayerState/PlayerContext";
|
||||
import { PlayerStateMachine } from "./PlayerState/PlayerStateMachine";
|
||||
import { PlayerStateType } from "./PlayerState/PlayerStateType";
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
import { Object3D, Vector3 } from "three";
|
||||
import { Character } from "../Character/Character";
|
||||
import { MoveC } from "../Movment/MoveC";
|
||||
import { RotationC } from "../Movment/RotationC";
|
||||
import { PhysicsBody } from "../../PhysicsC";
|
||||
import { MoveC } from "../Movement/MoveC";
|
||||
import { RotationC } from "../Movement/RotationC";
|
||||
import { PhysicsBody } from "../../core/PhysicsC";
|
||||
import { PlayerStateMachine } from "./PlayerStateMachine";
|
||||
import { PlayerStateType } from "./PlayerStateType";
|
||||
import { BaseAnimation } from "../Enums/BaseAnimation";
|
||||
import { BaseAnimation } from "../../Enums/BaseAnimation";
|
||||
import { COMBAT_EXIT_FADE } from "./combatConstants";
|
||||
|
||||
export class PlayerContext {
|
||||
+5
-5
@@ -6,11 +6,7 @@ export class PlayerStateMachine {
|
||||
private activeState: IPlayerState;
|
||||
private currentStateType: PlayerStateType;
|
||||
private readonly states: Map<PlayerStateType, IPlayerState>;
|
||||
|
||||
get currentState(): PlayerStateType {
|
||||
return this.currentStateType;
|
||||
}
|
||||
|
||||
|
||||
constructor(
|
||||
private readonly context: PlayerContext,
|
||||
states: Map<PlayerStateType, IPlayerState>,
|
||||
@@ -22,6 +18,10 @@ export class PlayerStateMachine {
|
||||
this.activeState.enter(this.context);
|
||||
}
|
||||
|
||||
get currentState(): PlayerStateType {
|
||||
return this.currentStateType;
|
||||
}
|
||||
|
||||
setState(stateType: PlayerStateType) {
|
||||
if (this.currentStateType === stateType) return;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { BaseAnimation } from "../../Enums/BaseAnimation";
|
||||
import { BaseAnimation } from "../../../Enums/BaseAnimation";
|
||||
import { IPlayerState } from "../IPlayerState";
|
||||
import { PlayerContext } from "../PlayerContext";
|
||||
import { PlayerStateType } from "../PlayerStateType";
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { BaseAnimation } from "../../Enums/BaseAnimation";
|
||||
import { BaseAnimation } from "../../../Enums/BaseAnimation";
|
||||
import {
|
||||
ATTACK_STRIKE_MARKS,
|
||||
LOOT_ENTER_FADE,
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { Vector3 } from "three";
|
||||
import { BaseAnimation } from "../../Enums/BaseAnimation";
|
||||
import { Vector3CToT, Vector3TToC } from "../../Helper";
|
||||
import { FollowCameraC } from "../../Movment/CameraMovment/FollowCamera";
|
||||
import { BaseAnimation } from "../../../Enums/BaseAnimation";
|
||||
import { Vector3CToT, Vector3TToC } from "../../../utils/Helper";
|
||||
import { FollowCameraC } from "../../../Camera/FollowCamera";
|
||||
import { RUN_ENTER_FADE } from "../combatConstants";
|
||||
import { IPlayerState } from "../IPlayerState";
|
||||
import { PlayerContext } from "../PlayerContext";
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { BaseAnimation } from "../../Enums/BaseAnimation";
|
||||
import { BaseAnimation } from "../../../Enums/BaseAnimation";
|
||||
import { TURN_IDLE_FADE } from "../combatConstants";
|
||||
import { IPlayerState } from "../IPlayerState";
|
||||
import { PlayerContext } from "../PlayerContext";
|
||||
@@ -1,10 +1,10 @@
|
||||
import { EasyEvent, UpdateController } from "@24tools/playable_template";
|
||||
import { Euler, Material, Mesh, Object3D, Vector3 } from "three";
|
||||
import { PhysicsBody } from "../PhysicsC";
|
||||
import { PropType } from "./PropType";
|
||||
import { PhysicsTriggerC } from "./PhysicsTriggerC";
|
||||
import { PROP_DROPS } from "../Resources/PropDropTable";
|
||||
import { createDropPlan, PropDropPlan } from "../Resources/PropDropPlanner";
|
||||
import { PhysicsBody } from "../core/PhysicsC";
|
||||
import { PropType } from "../Enums/PropType";
|
||||
import { PhysicsTriggerC } from "../Map/PhysicsTriggerC";
|
||||
import { PROP_DROPS } from "./PropDropTable";
|
||||
import { createDropPlan, PropDropPlan } from "./PropDropPlanner";
|
||||
import { ResourceSpawnC } from "../Resources/ResourceSpawnC";
|
||||
import { PropHpUIC } from "./PropHpUIC";
|
||||
import { PropHpBar } from "./PropHpBar";
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { ResourceType } from "./ResourceType";
|
||||
import { ResourceType } from "../Enums/ResourceType";
|
||||
|
||||
function randomInt(min: number, max: number) {
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PropType } from "../Map/PropType";
|
||||
import { ResourceType } from "./ResourceType";
|
||||
import { PropType } from "../Enums/PropType";
|
||||
import { ResourceType } from "../Enums/ResourceType";
|
||||
|
||||
export type DropRule = {
|
||||
resource: ResourceType;
|
||||
@@ -13,8 +13,8 @@ import {
|
||||
} from "three";
|
||||
import { ResourcesC } from "@24tools/playable_template";
|
||||
import { GLTF } from "three/examples/jsm/loaders/GLTFLoader";
|
||||
import { ThreeC } from "../ThreeC";
|
||||
import { ResourcesType } from "../Presets/Enums/ResourcesType";
|
||||
import { ThreeC } from "../core/ThreeC";
|
||||
import { ResourcesType } from "../Enums/ResourcesType";
|
||||
import { PropC } from "./PropC";
|
||||
|
||||
const HP_BAR_MESH = "hpBar";
|
||||
@@ -61,14 +61,6 @@ export class PropHpBar {
|
||||
private visible = false;
|
||||
private hasTakenDamage = false;
|
||||
|
||||
static getPrefab(): Object3D | null {
|
||||
const fromScene = ThreeC.getObject(HP_BAR_MESH);
|
||||
if (fromScene) return fromScene;
|
||||
|
||||
const gltf = ResourcesC.getResource<GLTF>(ResourcesType.Mesh, HP_BAR_MESH);
|
||||
return gltf?.scene ?? null;
|
||||
}
|
||||
|
||||
constructor(prop: PropC, parent: Object3D) {
|
||||
const template = PropHpBar.getPrefab();
|
||||
if (!template) {
|
||||
@@ -108,6 +100,14 @@ export class PropHpBar {
|
||||
this.applyWidths();
|
||||
}
|
||||
|
||||
static getPrefab(): Object3D | null {
|
||||
const fromScene = ThreeC.getObject(HP_BAR_MESH);
|
||||
if (fromScene) return fromScene;
|
||||
|
||||
const gltf = ResourcesC.getResource<GLTF>(ResourcesType.Mesh, HP_BAR_MESH);
|
||||
return gltf?.scene ?? null;
|
||||
}
|
||||
|
||||
onDamage() {
|
||||
this.hasTakenDamage = true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Object3D } from "three";
|
||||
import { UpdateController } from "@24tools/playable_template";
|
||||
import { ThreeC } from "../ThreeC";
|
||||
import { ThreeC } from "../core/ThreeC";
|
||||
import { PropC } from "./PropC";
|
||||
import { PropHpBar } from "./PropHpBar";
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { BatchedRenderer, QuarksLoader, QuarksUtil } from "three.quarks";
|
||||
import { Object3D, Euler, Vector3 } from "three";
|
||||
import { ResourcesC, UpdateController } from "@24tools/playable_template";
|
||||
import { ThreeC } from "../ThreeC";
|
||||
import { ThreeC } from "../core/ThreeC";
|
||||
import { TimeC } from "../Timers/TimeC";
|
||||
import { VFXType } from "../Enums/VFXType";
|
||||
import { ResourcesType } from "../Presets/Enums/ResourcesType";
|
||||
import { ResourcesType } from "../Enums/ResourcesType";
|
||||
|
||||
export class PropVfxC {
|
||||
static batchRenderer: BatchedRenderer;
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ResourceType } from "./ResourceType";
|
||||
import { ResourceType } from "../Enums/ResourceType";
|
||||
|
||||
export const RESOURCE_PLACEHOLDER_COLORS: Record<ResourceType, string> = {
|
||||
[ResourceType.Wood]: "#6b4423",
|
||||
|
||||
@@ -5,12 +5,12 @@ import { GatherC } from "../Map/GatherC";
|
||||
import { DepositZoneC } from "../Map/DepositZoneC";
|
||||
import { InteractiveZoneC } from "../Map/InteractiveZoneC";
|
||||
import { ToolZoneC } from "../Map/ToolZoneC";
|
||||
import { Player } from "../Presets/Player";
|
||||
import { ThreeC } from "../ThreeC";
|
||||
import { Player } from "../Player/Player";
|
||||
import { ThreeC } from "../core/ThreeC";
|
||||
import { TickScheduler, ScheduledCall } from "../Timers/TickScheduler";
|
||||
import { ResourceInventoryC } from "./ResourceInventoryC";
|
||||
import { ResourceScreenFly } from "./ResourceScreenFly";
|
||||
import { ResourceType } from "./ResourceType";
|
||||
import { ResourceType } from "../Enums/ResourceType";
|
||||
import { ResourceUIC } from "./ResourceUIC";
|
||||
|
||||
/** Screen-space flight duration (icon → deposit zone). Сповільнено для ефекту «поглинання». */
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { UpdateController } from "@24tools/playable_template";
|
||||
import { Easing, Group, Tween } from "@tweenjs/tween.js";
|
||||
import { Object3D, Vector3 } from "three";
|
||||
import { ThreeC } from "../ThreeC";
|
||||
import { ThreeC } from "../core/ThreeC";
|
||||
import { TickScheduler, ScheduledCall } from "../Timers/TickScheduler";
|
||||
import { ResourceInventoryC } from "./ResourceInventoryC";
|
||||
import { ResourceScreenFly } from "./ResourceScreenFly";
|
||||
import { ResourceType } from "./ResourceType";
|
||||
import { ResourceType } from "../Enums/ResourceType";
|
||||
import { ResourceUIC } from "./ResourceUIC";
|
||||
|
||||
const FALL_MS = 300;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { EasyEvent } from "@24tools/playable_template";
|
||||
import { ResourceType } from "./ResourceType";
|
||||
import { ResourceType } from "../Enums/ResourceType";
|
||||
|
||||
export class ResourceInventoryC {
|
||||
private static amounts = new Map<ResourceType, number>();
|
||||
|
||||
@@ -7,10 +7,10 @@ import {
|
||||
Vector3,
|
||||
} from "three";
|
||||
import { GLTF } from "three/examples/jsm/loaders/GLTFLoader";
|
||||
import { CameraC } from "../CameraC";
|
||||
import { ResourcesType } from "../Presets/Enums/ResourcesType";
|
||||
import { ThreeC } from "../ThreeC";
|
||||
import { ResourceType } from "./ResourceType";
|
||||
import { CameraC } from "../Camera/CameraC";
|
||||
import { ResourcesType } from "../Enums/ResourcesType";
|
||||
import { ThreeC } from "../core/ThreeC";
|
||||
import { ResourceType } from "../Enums/ResourceType";
|
||||
|
||||
export type ScreenPoint = {
|
||||
x: number;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Vector3 } from "three";
|
||||
import { PropC } from "../Map/PropC";
|
||||
import { PropC } from "../Props/PropC";
|
||||
import { ResourceFlyC } from "./ResourceFlyC";
|
||||
import { ResourceType } from "./ResourceType";
|
||||
import { ResourceType } from "../Enums/ResourceType";
|
||||
|
||||
export class ResourceSpawnC {
|
||||
static spawnFromProp(prop: PropC, type: ResourceType, count: number) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { UI_IMAGES } from "../../resources/images/uiImages";
|
||||
import { ResourceInventoryC } from "./ResourceInventoryC";
|
||||
import { ResourceType } from "./ResourceType";
|
||||
import { ResourceType } from "../Enums/ResourceType";
|
||||
import { RESOURCE_PLACEHOLDER_COLORS } from "./ResourceConfig";
|
||||
|
||||
type ResourceUIEntry = {
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
import { ThreeC } from "./ThreeC";
|
||||
import { Player } from "./Presets/Player";
|
||||
import { Map } from "./Map/Map";
|
||||
import { GatherC } from "./Map/GatherC";
|
||||
import { DepositZoneC } from "./Map/DepositZoneC";
|
||||
import { ResourceUIC } from "./Resources/ResourceUIC";
|
||||
import { ResourceFlyC } from "./Resources/ResourceFlyC";
|
||||
import { ResourceDepositC } from "./Resources/ResourceDepositC";
|
||||
import { PropHpUIC } from "./Map/PropHpUIC";
|
||||
import { PropVfxC } from "./Map/PropVfxC";
|
||||
import { InvasionProgressUIC } from "./UI/InvasionProgressUIC";
|
||||
import { PreGameplayUIC } from "./UI/PreGameplayUIC";
|
||||
|
||||
export class TestSceneC {
|
||||
static init() {
|
||||
InvasionProgressUIC.init();
|
||||
ResourceUIC.init();
|
||||
PreGameplayUIC.init();
|
||||
ResourceFlyC.init();
|
||||
PropHpUIC.init();
|
||||
PropVfxC.Init();
|
||||
Map.init();
|
||||
PropHpUIC.bringOverlayToFront();
|
||||
GatherC.init();
|
||||
Player.init();
|
||||
PropHpUIC.bringOverlayToFront();
|
||||
|
||||
const mapObject = ThreeC.getObject("map");
|
||||
if (mapObject) {
|
||||
DepositZoneC.init(mapObject);
|
||||
}
|
||||
|
||||
ResourceDepositC.init();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
Delegate,
|
||||
Physics_internal,
|
||||
UpdateController,
|
||||
} from "@24tools/playable_template";
|
||||
import { Physics_internal } from "@24tools/playable_template";
|
||||
import { Box3, Mesh, Object3D, Quaternion as ThreeQuaternion, Vector3 } from "three";
|
||||
import { Body, Box, Shape, Sphere, Vec3 } from "cannon-es";
|
||||
|
||||
@@ -18,7 +14,6 @@ export const PLAYER_COLLIDER_RADIUS = 0.5;
|
||||
|
||||
export class PhysicsBody {
|
||||
private body: Body;
|
||||
private pair: PhysicsObjPair | null = null;
|
||||
|
||||
constructor(
|
||||
threeObj: Object3D,
|
||||
@@ -89,12 +84,6 @@ export class PhysicsBody {
|
||||
return this;
|
||||
}
|
||||
|
||||
disablePhysicsPair() {
|
||||
if (this.pair) {
|
||||
this.pair.destroyed = true;
|
||||
}
|
||||
}
|
||||
|
||||
getPhysicsBody() {
|
||||
return this.body;
|
||||
}
|
||||
@@ -106,32 +95,4 @@ export class PhysicsBody {
|
||||
|
||||
(this.body as any) = null;
|
||||
}
|
||||
}
|
||||
|
||||
export class PhysicsObjPair {
|
||||
threeObj: Object3D;
|
||||
physicsObj: Body;
|
||||
destroyed: boolean;
|
||||
delegateId: null | Delegate<number>;
|
||||
|
||||
constructor(threeObj: Object3D, physicsObj: Body) {
|
||||
this.threeObj = threeObj;
|
||||
this.physicsObj = physicsObj;
|
||||
this.destroyed = false;
|
||||
|
||||
this.delegateId = UpdateController.Instance.onUpdate.addDelegate(() => {
|
||||
this.update();
|
||||
});
|
||||
}
|
||||
|
||||
update() {
|
||||
if (this.destroyed) return;
|
||||
|
||||
if (this.threeObj && this.physicsObj) {
|
||||
// @ts-ignore
|
||||
this.threeObj.position.copy(this.physicsObj.position);
|
||||
// @ts-ignore
|
||||
this.threeObj.quaternion.copy(this.physicsObj.quaternion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { ThreeC } from "./ThreeC";
|
||||
import { Player } from "../Player/Player";
|
||||
import { Map } from "../Map/Map";
|
||||
import { GatherC } from "../Map/GatherC";
|
||||
import { DepositZoneC } from "../Map/DepositZoneC";
|
||||
import { ResourceUIC } from "../Resources/ResourceUIC";
|
||||
import { ResourceFlyC } from "../Resources/ResourceFlyC";
|
||||
import { ResourceDepositC } from "../Resources/ResourceDepositC";
|
||||
import { PropHpUIC } from "../Props/PropHpUIC";
|
||||
import { PropVfxC } from "../Props/PropVfxC";
|
||||
import { InvasionProgressUIC } from "../UI/InvasionProgressUIC";
|
||||
import { PreGameplayUIC } from "../UI/PreGameplayUIC";
|
||||
|
||||
export class TestSceneC {
|
||||
static init() {
|
||||
InvasionProgressUIC.init();
|
||||
ResourceUIC.init();
|
||||
PreGameplayUIC.init();
|
||||
ResourceFlyC.init();
|
||||
PropHpUIC.init();
|
||||
PropVfxC.Init();
|
||||
Map.init();
|
||||
PropHpUIC.bringOverlayToFront();
|
||||
GatherC.init();
|
||||
Player.init();
|
||||
PropHpUIC.bringOverlayToFront();
|
||||
|
||||
const mapObject = ThreeC.getObject("map");
|
||||
if (mapObject) {
|
||||
DepositZoneC.init(mapObject);
|
||||
}
|
||||
|
||||
ResourceDepositC.init();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TestSceneC } from "../controllers/TestSceneC";
|
||||
import { TestSceneC } from "../controllers/core/TestSceneC";
|
||||
import { SoundC, Template } from "@24tools/playable_template";
|
||||
|
||||
export const afterResourcesLoadedCb: (() => void) | undefined = () => {
|
||||
|
||||
@@ -9,10 +9,10 @@ import {
|
||||
FilterScene,
|
||||
InstallBanner,
|
||||
} from "@24tools/playable_template";
|
||||
import { CameraC } from "../controllers/CameraC";
|
||||
import { ThreeC } from "../controllers/ThreeC";
|
||||
import { Player } from "../controllers/Presets/Player";
|
||||
import { PlayerInput } from "../controllers/Presets/Input/PlayerInput";
|
||||
import { CameraC } from "../controllers/Camera/CameraC";
|
||||
import { ThreeC } from "../controllers/core/ThreeC";
|
||||
import { Player } from "../controllers/Player/Player";
|
||||
import { PlayerInput } from "../controllers/Player/Input/PlayerInput";
|
||||
import { Color } from "three";
|
||||
import { Vec3 } from "cannon-es";
|
||||
export const beforeResourcesLoadedCb = () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Template3d } from "@24tools/playable_template";
|
||||
import { CameraC } from "../controllers/CameraC";
|
||||
import { CameraC } from "../controllers/Camera/CameraC";
|
||||
|
||||
export const resizeCb = () => {
|
||||
Template3d.resize();
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user