Skip to content

Commit

Permalink
Fixes #20 - on entity death, remove entity collision & hover/pick eve…
Browse files Browse the repository at this point in the history
…nts so it doesnt prevent player picking up an dropped item
  • Loading branch information
orion3dgames committed Aug 9, 2023
1 parent bea9d48 commit ea45867
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/shared/Entities/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ export class Entity {
}

// what to do when an entity dies
if (this.health < 0 && !this.isDead) {
console.log("ENTITY IS DEAD REMOVE ACTION MANAGER");
if (this.health < 1 && !this.isDead) {
this.isDead = true;
global.T5C.selectedEntity = null;
this.meshController.selectedMesh.isVisible = false;
this.meshController.mesh.actionManager.dispose();
this.meshController.mesh.actionManager = null;
}

// tween entity
Expand Down
1 change: 0 additions & 1 deletion src/shared/Entities/Entity/EntityMesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ export class EntityMesh {
// register hover over player
this.mesh.actionManager.registerAction(
new ExecuteCodeAction(ActionManager.OnPointerOverTrigger, (ev) => {
console.log("ACTION MANAGER HOVER");
let mesh = ev.meshUnderPointer;
for (const childMesh of mesh.getChildMeshes()) {
childMesh.overlayColor = new Color3(1, 1, 1);
Expand Down
7 changes: 0 additions & 7 deletions src/shared/Entities/Item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,10 @@ export class Item {
this.mesh.actionManager.registerAction(
new ExecuteCodeAction(ActionManager.OnPointerOverTrigger, (ev) => {
let mesh = ev.meshUnderPointer;
console.log(mesh.name);
for (const childMesh of mesh.getChildMeshes()) {
childMesh.overlayColor = new Color3(1, 1, 1);
childMesh.overlayAlpha = 0.3;
childMesh.renderOverlay = true;
//this.ui._hightlight.addMesh(childMesh as Mesh, new Color3(0, 1, 0));
/*childMesh.outlineColor = new BABYLON.Color3(0, 1, 0);
childMesh.outlineWidth = 0.1;
childMesh.renderOutline = true;*/
}
})
);
Expand All @@ -154,8 +149,6 @@ export class Item {
let mesh = ev.meshUnderPointer;
for (const childMesh of mesh.getChildMeshes()) {
childMesh.renderOverlay = false;
//childMesh.renderOutline = false;
//this.ui._hightlight.removeMesh(childMesh as Mesh);
}
})
);
Expand Down

0 comments on commit ea45867

Please sign in to comment.