1. 修正了相机在变焦时不能保持在目标中心的问题
2. 增加检查,以确保碰撞器被触发时enabled也开启
This commit is contained in:
Vendored
+3
@@ -1301,6 +1301,9 @@ declare class Vector2Ext {
|
|||||||
static transform(sourceArray: Vector2[], matrix: Matrix2D, destinationArray: Vector2[]): void;
|
static transform(sourceArray: Vector2[], matrix: Matrix2D, destinationArray: Vector2[]): void;
|
||||||
static round(vec: Vector2): Vector2;
|
static round(vec: Vector2): Vector2;
|
||||||
}
|
}
|
||||||
|
declare class WebGLUtils {
|
||||||
|
static getContext(): CanvasRenderingContext2D;
|
||||||
|
}
|
||||||
declare class Layout {
|
declare class Layout {
|
||||||
clientArea: Rectangle;
|
clientArea: Rectangle;
|
||||||
safeArea: Rectangle;
|
safeArea: Rectangle;
|
||||||
|
|||||||
@@ -1651,8 +1651,8 @@ var Camera = (function (_super) {
|
|||||||
Camera.prototype.update = function () {
|
Camera.prototype.update = function () {
|
||||||
var cameraBounds = new Rectangle(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
|
var cameraBounds = new Rectangle(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
|
||||||
var halfScreen = Vector2.multiply(new Vector2(cameraBounds.width, cameraBounds.height), new Vector2(0.5));
|
var halfScreen = Vector2.multiply(new Vector2(cameraBounds.width, cameraBounds.height), new Vector2(0.5));
|
||||||
this._worldSpaceDeadZone.x = this.position.x - halfScreen.x + this.deadzone.x + this.focusOffset.x;
|
this._worldSpaceDeadZone.x = this.position.x - halfScreen.x * SceneManager.scene.scaleX + this.deadzone.x + this.focusOffset.x;
|
||||||
this._worldSpaceDeadZone.y = this.position.y - halfScreen.y + this.deadzone.y + this.focusOffset.y;
|
this._worldSpaceDeadZone.y = this.position.y - halfScreen.y * SceneManager.scene.scaleY + this.deadzone.y + this.focusOffset.y;
|
||||||
this._worldSpaceDeadZone.width = this.deadzone.width;
|
this._worldSpaceDeadZone.width = this.deadzone.width;
|
||||||
this._worldSpaceDeadZone.height = this.deadzone.height;
|
this._worldSpaceDeadZone.height = this.deadzone.height;
|
||||||
if (this.targetEntity)
|
if (this.targetEntity)
|
||||||
@@ -2156,7 +2156,7 @@ var ProjectileMover = (function (_super) {
|
|||||||
var neighbors = Physics.boxcastBroadphase(this._collider.bounds, this._collider.collidesWithLayers);
|
var neighbors = Physics.boxcastBroadphase(this._collider.bounds, this._collider.collidesWithLayers);
|
||||||
for (var i = 0; i < neighbors.colliders.length; i++) {
|
for (var i = 0; i < neighbors.colliders.length; i++) {
|
||||||
var neighbor = neighbors.colliders[i];
|
var neighbor = neighbors.colliders[i];
|
||||||
if (this._collider.overlaps(neighbor)) {
|
if (this._collider.overlaps(neighbor) && neighbor.enabled) {
|
||||||
didCollide = true;
|
didCollide = true;
|
||||||
this.notifyTriggerListeners(this._collider, neighbor);
|
this.notifyTriggerListeners(this._collider, neighbor);
|
||||||
}
|
}
|
||||||
@@ -6416,6 +6416,15 @@ var Vector2Ext = (function () {
|
|||||||
};
|
};
|
||||||
return Vector2Ext;
|
return Vector2Ext;
|
||||||
}());
|
}());
|
||||||
|
var WebGLUtils = (function () {
|
||||||
|
function WebGLUtils() {
|
||||||
|
}
|
||||||
|
WebGLUtils.getContext = function () {
|
||||||
|
var canvas = document.getElementsByTagName('canvas')[0];
|
||||||
|
return canvas.getContext('2d');
|
||||||
|
};
|
||||||
|
return WebGLUtils;
|
||||||
|
}());
|
||||||
var Layout = (function () {
|
var Layout = (function () {
|
||||||
function Layout() {
|
function Layout() {
|
||||||
this.clientArea = new Rectangle(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
|
this.clientArea = new Rectangle(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+3
@@ -1301,6 +1301,9 @@ declare class Vector2Ext {
|
|||||||
static transform(sourceArray: Vector2[], matrix: Matrix2D, destinationArray: Vector2[]): void;
|
static transform(sourceArray: Vector2[], matrix: Matrix2D, destinationArray: Vector2[]): void;
|
||||||
static round(vec: Vector2): Vector2;
|
static round(vec: Vector2): Vector2;
|
||||||
}
|
}
|
||||||
|
declare class WebGLUtils {
|
||||||
|
static getContext(): CanvasRenderingContext2D;
|
||||||
|
}
|
||||||
declare class Layout {
|
declare class Layout {
|
||||||
clientArea: Rectangle;
|
clientArea: Rectangle;
|
||||||
safeArea: Rectangle;
|
safeArea: Rectangle;
|
||||||
|
|||||||
+12
-3
@@ -1651,8 +1651,8 @@ var Camera = (function (_super) {
|
|||||||
Camera.prototype.update = function () {
|
Camera.prototype.update = function () {
|
||||||
var cameraBounds = new Rectangle(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
|
var cameraBounds = new Rectangle(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
|
||||||
var halfScreen = Vector2.multiply(new Vector2(cameraBounds.width, cameraBounds.height), new Vector2(0.5));
|
var halfScreen = Vector2.multiply(new Vector2(cameraBounds.width, cameraBounds.height), new Vector2(0.5));
|
||||||
this._worldSpaceDeadZone.x = this.position.x - halfScreen.x + this.deadzone.x + this.focusOffset.x;
|
this._worldSpaceDeadZone.x = this.position.x - halfScreen.x * SceneManager.scene.scaleX + this.deadzone.x + this.focusOffset.x;
|
||||||
this._worldSpaceDeadZone.y = this.position.y - halfScreen.y + this.deadzone.y + this.focusOffset.y;
|
this._worldSpaceDeadZone.y = this.position.y - halfScreen.y * SceneManager.scene.scaleY + this.deadzone.y + this.focusOffset.y;
|
||||||
this._worldSpaceDeadZone.width = this.deadzone.width;
|
this._worldSpaceDeadZone.width = this.deadzone.width;
|
||||||
this._worldSpaceDeadZone.height = this.deadzone.height;
|
this._worldSpaceDeadZone.height = this.deadzone.height;
|
||||||
if (this.targetEntity)
|
if (this.targetEntity)
|
||||||
@@ -2156,7 +2156,7 @@ var ProjectileMover = (function (_super) {
|
|||||||
var neighbors = Physics.boxcastBroadphase(this._collider.bounds, this._collider.collidesWithLayers);
|
var neighbors = Physics.boxcastBroadphase(this._collider.bounds, this._collider.collidesWithLayers);
|
||||||
for (var i = 0; i < neighbors.colliders.length; i++) {
|
for (var i = 0; i < neighbors.colliders.length; i++) {
|
||||||
var neighbor = neighbors.colliders[i];
|
var neighbor = neighbors.colliders[i];
|
||||||
if (this._collider.overlaps(neighbor)) {
|
if (this._collider.overlaps(neighbor) && neighbor.enabled) {
|
||||||
didCollide = true;
|
didCollide = true;
|
||||||
this.notifyTriggerListeners(this._collider, neighbor);
|
this.notifyTriggerListeners(this._collider, neighbor);
|
||||||
}
|
}
|
||||||
@@ -6416,6 +6416,15 @@ var Vector2Ext = (function () {
|
|||||||
};
|
};
|
||||||
return Vector2Ext;
|
return Vector2Ext;
|
||||||
}());
|
}());
|
||||||
|
var WebGLUtils = (function () {
|
||||||
|
function WebGLUtils() {
|
||||||
|
}
|
||||||
|
WebGLUtils.getContext = function () {
|
||||||
|
var canvas = document.getElementsByTagName('canvas')[0];
|
||||||
|
return canvas.getContext('2d');
|
||||||
|
};
|
||||||
|
return WebGLUtils;
|
||||||
|
}());
|
||||||
var Layout = (function () {
|
var Layout = (function () {
|
||||||
function Layout() {
|
function Layout() {
|
||||||
this.clientArea = new Rectangle(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
|
this.clientArea = new Rectangle(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -164,8 +164,8 @@ class Camera extends Component {
|
|||||||
public update(){
|
public update(){
|
||||||
let cameraBounds = new Rectangle(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
|
let cameraBounds = new Rectangle(0, 0, SceneManager.stage.stageWidth, SceneManager.stage.stageHeight);
|
||||||
let halfScreen = Vector2.multiply(new Vector2(cameraBounds.width, cameraBounds.height), new Vector2(0.5));
|
let halfScreen = Vector2.multiply(new Vector2(cameraBounds.width, cameraBounds.height), new Vector2(0.5));
|
||||||
this._worldSpaceDeadZone.x = this.position.x - halfScreen.x + this.deadzone.x + this.focusOffset.x;
|
this._worldSpaceDeadZone.x = this.position.x - halfScreen.x * SceneManager.scene.scaleX + this.deadzone.x + this.focusOffset.x;
|
||||||
this._worldSpaceDeadZone.y = this.position.y - halfScreen.y + this.deadzone.y + this.focusOffset.y;
|
this._worldSpaceDeadZone.y = this.position.y - halfScreen.y * SceneManager.scene.scaleY + this.deadzone.y + this.focusOffset.y;
|
||||||
this._worldSpaceDeadZone.width = this.deadzone.width;
|
this._worldSpaceDeadZone.width = this.deadzone.width;
|
||||||
this._worldSpaceDeadZone.height = this.deadzone.height;
|
this._worldSpaceDeadZone.height = this.deadzone.height;
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class ProjectileMover extends Component {
|
|||||||
let neighbors = Physics.boxcastBroadphase(this._collider.bounds, this._collider.collidesWithLayers);
|
let neighbors = Physics.boxcastBroadphase(this._collider.bounds, this._collider.collidesWithLayers);
|
||||||
for (let i = 0; i < neighbors.colliders.length; i ++){
|
for (let i = 0; i < neighbors.colliders.length; i ++){
|
||||||
let neighbor = neighbors.colliders[i];
|
let neighbor = neighbors.colliders[i];
|
||||||
if (this._collider.overlaps(neighbor)){
|
if (this._collider.overlaps(neighbor) && neighbor.enabled){
|
||||||
didCollide = true;
|
didCollide = true;
|
||||||
this.notifyTriggerListeners(this._collider, neighbor);
|
this.notifyTriggerListeners(this._collider, neighbor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
class WebGLUtils {
|
||||||
|
/**
|
||||||
|
* 获取webgl context
|
||||||
|
*/
|
||||||
|
public static getContext(){
|
||||||
|
const canvas = document.getElementsByTagName('canvas')[0];
|
||||||
|
return canvas.getContext('2d');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user