| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- const PlayerStateStatic = require('PlayerState');
- cc.Class({
- extends: cc.Component,
- properties: {
- Barrier: {
- default: null,
- type: cc.Node
- },
- },
- start () {
- },
- // onCollisionEnter: function (other) {
- // if(other.node.name === 'PlayerCollisionLine')
- // {
- // var PlayerCollisionLine = other.getComponent("PlayerCollisionLine");
- // var PlayerStateScript = PlayerCollisionLine.Hero.getComponent("PlayerState");
- // PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.PreHurdleBand;
- //
- // PlayerStateScript.Barrier = this.Barrier;
- // // cc.log(PlayerStateScript.CurrentInZoneType );
- //
- // }
- // },
- // onCollisionStay: function (other) {
- // // console.log('on collision stay');
- // },
- // onCollisionExit: function (other) {
- //
- // },
- //
- // 只在两个碰撞体开始接触时被调用一次
- onBeginContact: function (contact, selfCollider, otherCollider) {
- CustomLog("撞了 跨栏",otherCollider);
- if(otherCollider.node.name === 'Hero')
- {
- CustomLog("刚体 跨栏 一般 ,",otherCollider.node.name);
- var PlayerStateScript = otherCollider.getComponent("PlayerState");
- PlayerStateScript.CurrentInZoneType = PlayerStateStatic.ZoneType.PreHurdleBand;
- PlayerStateScript.Barrier = this.Barrier;
- }
- },
- // 只在两个碰撞体结束接触时被调用一次
- onEndContact: function (contact, selfCollider, otherCollider) {
- },
- // 每次将要处理碰撞体接触逻辑时被调用
- onPreSolve: function (contact, selfCollider, otherCollider) {
- },
- // 每次处理完碰撞体接触逻辑时被调用
- onPostSolve: function (contact, selfCollider, otherCollider) {
- },
- });
|