FAltarStar.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import FqLogin from "../../../../../login/FqLogin";
  2. import BaseEvent from "../../base/BaseEvent";
  3. import FAltar1_3 from "./FAltar1_3";
  4. /**
  5. * 祭坛周围可踩的星星
  6. */
  7. const {ccclass, property} = cc._decorator;
  8. @ccclass
  9. export default class FAltarStar extends BaseEvent {
  10. @property({
  11. displayName:'祭坛',
  12. type:FAltar1_3
  13. })
  14. mFaltar:FAltar1_3 = null;
  15. @property({
  16. displayName:'底部的图片',
  17. type:cc.Sprite
  18. })
  19. mIcon: cc.Sprite = null;
  20. @property({
  21. displayName:'点亮的图片',
  22. type:cc.SpriteFrame
  23. })
  24. mLight: cc.SpriteFrame = null;//点亮的图
  25. @property({
  26. displayName:'其它的祭坛开启',
  27. tooltip:'剩下的祭坛开启',
  28. type:[cc.Node]
  29. })
  30. mOtherAltarStar: Array<cc.Node> = [];//
  31. public isCheck = false//是否被点亮
  32. /**
  33. * 主角进入碰撞区域
  34. * @param tag 碰撞组件编号
  35. */
  36. public onBegin(tag:number){
  37. if(this.isCheck){
  38. return
  39. }
  40. this.isCheck = true
  41. this.mIcon.spriteFrame = this.mLight
  42. this.checkOpen()
  43. FqLogin.commitEvent(this.node.name,'','');
  44. }
  45. private checkOpen(){
  46. for (let i = 0; i < this.mOtherAltarStar.length; i++) {
  47. const element = this.mOtherAltarStar[i];
  48. let altarStar = element.getComponent(FAltarStar)
  49. if(!altarStar.isCheck){
  50. return
  51. }
  52. }
  53. this.mFaltar.node.active = true;
  54. this.mFaltar.showAltar()
  55. }
  56. }