CanmeraScrpts.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Learn TypeScript:
  2. // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
  7. import EventName, { GuideType } from "../EventName/EventName";
  8. import LocalData from "../LocalData";
  9. const { ccclass, property } = cc._decorator;
  10. @ccclass
  11. export default class CanmeraScrpts extends cc.Component {
  12. Character: cc.Node = null;//人物节点
  13. protected onLoad(): void {
  14. let Mask = this.node.getChildByName("Mask")
  15. if (CC_DEBUG) {
  16. Mask.active = true
  17. }else{
  18. Mask.active = true
  19. }
  20. }
  21. protected lateUpdate(dt: number): void {
  22. this?.node?.setPosition(this?.Character?.position.x, this?.Character?.position.y + 550)
  23. }
  24. BronAni() {
  25. let Mask = this.node.getChildByName("Mask")
  26. cc.tween(Mask)
  27. .to(0, { opacity: 255 })
  28. .to(1, { opacity: 0 }, { easing: 'fadeOut' })
  29. .call(() => {
  30. Mask.destroy()
  31. //加载完毕先判断是否要教学
  32. if (!LocalData.getInstance().getGuide(GuideType.基本跳跃教学引导)) {
  33. cc.systemEvent.emit(EventName.ShowGuide, GuideType.基本跳跃教学引导)
  34. }
  35. })
  36. .start()
  37. }
  38. }