Skip to content

Commit

Permalink
Scene: Remove actors from Game class onDestroyed()
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGrieb committed Nov 16, 2023
1 parent 9bdf5ac commit 65a2d36
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client/src/scene/Scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NetworkEvents } from "../network/Client";
import { Camera } from "./Camera";
import { Line } from "./Line";
import { SceneObject } from "./SceneObject";
import { ActorGroup } from "./ActorGroup";

export abstract class Scene {
protected static ExitReceipt = new (class {})();
Expand Down Expand Up @@ -76,10 +77,10 @@ export abstract class Scene {

public onDestroyed(newScene: Scene): typeof Scene.ExitReceipt {
this.sceneObjects.forEach((object) => {
if (object instanceof Actor) {
if (object instanceof Actor || object instanceof ActorGroup) {
const actor = object as Actor;
actor.call("mouse_exit");
actor.onDestroyed();
this.removeActor(object);
}
});

Expand Down

0 comments on commit 65a2d36

Please sign in to comment.