新增mover移动器组件 用于处理itriggerListener接口碰撞信息

This commit is contained in:
yhh
2020-06-16 11:22:37 +08:00
parent 75301f7776
commit 8b21edc65f
22 changed files with 671 additions and 46 deletions

View File

@@ -1,4 +1,4 @@
class SpawnComponent extends Component {
class SpawnComponent extends Component implements ITriggerListener {
public cooldown = -1;
public minInterval = 2;
public maxInterval = 60;
@@ -17,6 +17,15 @@ class SpawnComponent extends Component {
public update() {
// console.log("update");
this.entity.getComponent<Mover>(Mover).move(new Vector2(1, 0));
}
public onTriggerEnter(other: Collider, local: Collider){
console.log("enter collider", other, local);
}
public onTriggerExit(other: Collider, local: Collider){
console.log("exit collider", other, local);
}
}