BullFighter.ts 711 B

123456789101112131415161718192021222324252627282930313233
  1. import { _decorator, Component, Node, Sprite, SpriteFrame } from 'cc';
  2. import { EventCustom } from '../../scripts/Common/EventCustom';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('BullFighter')
  5. export class BullFighter extends Component {
  6. @property(SpriteFrame)
  7. BFSpa: SpriteFrame = null;
  8. @property(SpriteFrame)
  9. BFSpb: SpriteFrame = null;
  10. _t: number;
  11. set T(a: number) {
  12. this._t = a;
  13. this.getComponent(Sprite).spriteFrame = a == 0 ? this.BFSpa : this.BFSpb;
  14. }
  15. start() {
  16. }
  17. onClick() {
  18. let e = new EventCustom("BullFighterSelected", true, this.node);
  19. this.node.dispatchEvent(e);
  20. }
  21. update(deltaTime: number) {
  22. }
  23. }