| 1234567891011121314151617181920212223242526 |
- import { _decorator, Component } from 'cc';
- import { Charactor } from './Charactor';
- const { ccclass, property } = _decorator;
- @ccclass('CharactorAI')
- export class CharactorAI extends Component {
- charactor: Charactor;
- clickCountDown = 0;
- protected start(): void {
- this.charactor = this.getComponent(Charactor);
- }
- protected update(dt: number): void {
- let ps = window.gm.state.gameSystemState.playerStates.find(v => v.index === this.charactor.playerIndex);
- if (ps) {
- this.clickCountDown -= dt;
- if (this.clickCountDown <= 0) {
- this.clickCountDown = 0.3;
- this.charactor.inputAcc();
- }
- }
- }
- }
|