Carrot.ts 538 B

12345678910111213141516171819202122
  1. import { _decorator } from 'cc';
  2. import { GameMgr } from './GameMgr';
  3. import { ModulerBase } from './ModulerBase';
  4. import { MapMgr } from './MapMgr';
  5. const { ccclass, property } = _decorator;
  6. @ccclass('Carrot')
  7. export class Carrot extends ModulerBase {
  8. // @property(GameMgr)
  9. // gameMgr: GameMgr = null;
  10. start() {
  11. const points = this.getModuler(MapMgr).getPath();
  12. const point = points[points.length - 2]
  13. this.node.setPosition(point.x, point.y)
  14. }
  15. update(deltaTime: number) {
  16. }
  17. }