replaced files

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