|
@@ -97,7 +97,7 @@ export class Role extends Component {
|
|
this.node.setWorldPosition(pos);
|
|
this.node.setWorldPosition(pos);
|
|
this.bulletLayer = find("Canvas/GameRoot/BulletLayer");
|
|
this.bulletLayer = find("Canvas/GameRoot/BulletLayer");
|
|
|
|
|
|
- this._setupPhysics();
|
|
|
|
|
|
+ //this._setupPhysics();
|
|
}
|
|
}
|
|
|
|
|
|
private _setRoleData(roleData: RoleData) {
|
|
private _setRoleData(roleData: RoleData) {
|
|
@@ -161,7 +161,6 @@ export class Role extends Component {
|
|
const startPos = this.node.position.clone();
|
|
const startPos = this.node.position.clone();
|
|
const endPos = new Vec2((this.direction * this.atkLength) + this.node.position.x, this.node.position.y);
|
|
const endPos = new Vec2((this.direction * this.atkLength) + this.node.position.x, this.node.position.y);
|
|
const results = PhysicsSystem2D.instance.raycast(startPos, endPos);
|
|
const results = PhysicsSystem2D.instance.raycast(startPos, endPos);
|
|
-
|
|
|
|
if (results?.length) {
|
|
if (results?.length) {
|
|
for (const result of results) {
|
|
for (const result of results) {
|
|
const target = result.collider.node.getComponent(Role);
|
|
const target = result.collider.node.getComponent(Role);
|
|
@@ -253,7 +252,7 @@ export class Role extends Component {
|
|
// this._animations.set(RoleState.Die, dieAni);
|
|
// this._animations.set(RoleState.Die, dieAni);
|
|
|
|
|
|
this._createClip(RoleState.Move, this._moveFrames, 8);
|
|
this._createClip(RoleState.Move, this._moveFrames, 8);
|
|
- this._createClip(RoleState.Attack, this._atkFrames, 8);
|
|
|
|
|
|
+ this._createClip(RoleState.Attack, this._atkFrames, 6);
|
|
this._createClip(RoleState.Idle, this._idleFrames, 8);
|
|
this._createClip(RoleState.Idle, this._idleFrames, 8);
|
|
this._createClip(RoleState.Die, this._dieFrames, 9);
|
|
this._createClip(RoleState.Die, this._dieFrames, 9);
|
|
}
|
|
}
|
|
@@ -324,6 +323,7 @@ export class Role extends Component {
|
|
targetNode: this.currentTarget.node,
|
|
targetNode: this.currentTarget.node,
|
|
atk: this.atk,
|
|
atk: this.atk,
|
|
})
|
|
})
|
|
|
|
+ console.log(this._bullet.getComponent(Animation))
|
|
}
|
|
}
|
|
|
|
|
|
//要求子类实现的碰撞分组和阵营判断方法,确保不同阵营角色可以正确交互
|
|
//要求子类实现的碰撞分组和阵营判断方法,确保不同阵营角色可以正确交互
|