"use strict"; cc._RF.push(module, 'bd769BizYREq7pMZmW+fkhf', 'Playcontroler'); // Script/Playcontroler.ts "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); var Global_1 = require("./Global"); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var Playcontroler = /** @class */ (function (_super) { __extends(Playcontroler, _super); function Playcontroler() { // LIFE-CYCLE CALLBACKS: var _this = _super !== null && _super.apply(this, arguments) || this; // parent:cc.Node = null; _this.MainScene = null; return _this; } Playcontroler.prototype.onLoad = function () { cc.game.setFrameRate(59); // this.parent = this.node.parent; this.MainScene = Global_1.default.instance.getMN(); }; Playcontroler.prototype.start = function () { }; Playcontroler.prototype.update = function (dt) { if (Global_1.default.instance.OverFlag) { this.enabled = false; } else { if (!Global_1.default.instance.CollisionFlag) { this.node.y -= Global_1.default.instance.InitSpeed; } else { var name = Global_1.default.instance.TheHolder.name; if (name == "") { return; } this.node.y = Global_1.default.instance.TheHolder.y + Global_1.default.instance.TheHolder.getComponent(name).NodeH - 5; //here ,this way isnot a good Processing method,should be optimizated } } if (Global_1.default.instance.CollisionWithDing) { this.node.stopAllActions(); Global_1.default.instance.CollisionWithDing = false; Global_1.default.instance.CollisionFlag = false; } }; /** * player与墙壁的碰撞检测 * @param other 被撞物体 * @param self 碰撞体 */ Playcontroler.prototype.onCollisionEnter = function (other, self) { var rootSelf = this; switch (other.node.name) { case "Bg_0CollisionR": { self.node.x = 180; break; } case "Bg_0CollisionL": { self.node.x = -180; break; } case "Bg_1CollisionR": { self.node.x = 180; break; } case "Bg_1CollisionL": { self.node.x = -180; break; } // case "tanhuang":{ // if(other.node.x+75>self.node.x&&other.node.x-75