public void SetScene(Scene scene) { if (this.leftCollider != null) { this.leftCollider.BeginCollision -= this.Collider_LeftBeginCollision; this.leftCollider.EndCollision -= this.Collider_LeftEndCollision; } if (this.rightCollider != null) { this.rightCollider.BeginCollision -= this.Collider_RightBeginCollision; this.rightCollider.EndCollision -= this.Collider_RightEndCollision; } if (this.bodyCollider != null) { this.bodyCollider.BeginCollision -= this.Collider_BodyBeginCollision; } this.leftCollided = false; this.rightCollided = false; this.gameOver = false; this.scene = scene; this.enginesComponent = this.scene.EntityManager.FindFirstComponentOfType <EnginesComponent>(); this.landerBody = this.scene.EntityManager.Find("lander.body").FindComponent <RigidBody2D>(); this.bodyCollider = this.scene.EntityManager.Find("lander.body").FindComponent <Collider2D>(false); this.leftCollider = this.scene.EntityManager.Find("lander.leftLeft").FindComponent <Collider2D>(false); this.rightCollider = this.scene.EntityManager.Find("lander.rightLeg").FindComponent <Collider2D>(false); this.bodyCollider.BeginCollision += this.Collider_BodyBeginCollision; this.leftCollider.BeginCollision += this.Collider_LeftBeginCollision; this.leftCollider.EndCollision += this.Collider_LeftEndCollision; this.rightCollider.BeginCollision += this.Collider_RightBeginCollision; this.rightCollider.EndCollision += this.Collider_RightEndCollision; }
public void SetScene(Scene scene) { this.scene = scene; this.enginesComponent = this.scene.EntityManager.FindFirstComponentOfType <EnginesComponent>(); }