1234567891011121314 |
- {
- "code": "var Vector3 = Laya.Vector3;\r\nimport PoolManager from \"../Util/PoolManager\";\r\nimport { GameUtils } from \"../Util/GameUtils\";\r\nimport { EventManager } from \"./EventManager\";\r\nimport { GameState } from \"./DataMaker\";\r\nexport var RoleState;\r\n(function (RoleState) {\r\n RoleState[RoleState[\"None\"] = 0] = \"None\";\r\n RoleState[RoleState[\"Idle\"] = 1] = \"Idle\";\r\n RoleState[RoleState[\"Runing\"] = 2] = \"Runing\";\r\n RoleState[RoleState[\"Awake\"] = 3] = \"Awake\";\r\n RoleState[RoleState[\"Die\"] = 4] = \"Die\";\r\n RoleState[RoleState[\"Attack\"] = 5] = \"Attack\";\r\n RoleState[RoleState[\"Escape\"] = 6] = \"Escape\";\r\n RoleState[RoleState[\"Win\"] = 7] = \"Win\";\r\n RoleState[RoleState[\"Wait\"] = 8] = \"Wait\";\r\n})(RoleState || (RoleState = {}));\r\nexport class RoleData {\r\n constructor(_id, _startpos) {\r\n this.id = _id;\r\n this.startpos = _startpos;\r\n }\r\n}\r\nexport class Role extends Laya.Script3D {\r\n constructor() {\r\n super(...arguments);\r\n this.startpos = new Vector3();\r\n this.end = false;\r\n this.clear = false;\r\n this.wudi = false;\r\n }\r\n static Create(_data, arge = null) {\r\n return null;\r\n }\r\n Init(_sprite) {\r\n this.cursprite = _sprite;\r\n this.curanimator = _sprite.getChildAt(0).getComponent(Laya.Animator);\r\n this.curanimator.enabled = true;\r\n this.ChangeState(RoleState.Idle);\r\n this.startpos = this.cursprite.transform.position.clone();\r\n this.clear = false;\r\n this.end = false;\r\n EventManager.GameOn(GameState.Win, this, this.OnGameEnd);\r\n EventManager.GameOn(GameState.Lose, this, this.OnGameEnd);\r\n EventManager.GameOn(GameState.Playing, this, this.OnGamePlaying);\r\n }\r\n OnGameEnd() {\r\n this.ChangeState(RoleState.Idle);\r\n }\r\n OnGamePlaying() {\r\n this.ChangeState(RoleState.Idle);\r\n this.end = false;\r\n this.WithPlaying();\r\n }\r\n WithPlaying() { }\r\n ;\r\n Clear() {\r\n if (this.clear)\r\n return;\r\n this.clear = true;\r\n EventManager.GameOff(GameState.Win, this, this.OnGameEnd);\r\n EventManager.GameOff(GameState.Lose, this, this.OnGameEnd);\r\n EventManager.GameOff(GameState.Playing, this, this.OnGamePlaying);\r\n PoolManager.RecoverSprite3D(this.cursprite, true);\r\n this.OnClear();\r\n this.destroy();\r\n }\r\n ChangeState(_state, args = null) {\r\n if (_state == RoleState.Die && this.wudi)\r\n return;\r\n if (this.end)\r\n return;\r\n if (this.currolestate == _state)\r\n return;\r\n if (this.currolestate == RoleState.Die && args == null)\r\n return;\r\n if (this.currolestate == RoleState.Win)\r\n return;\r\n this.currolestate = _state;\r\n this.onStateChange(this.currolestate, args);\r\n }\r\n OnClear() { }\r\n ;\r\n onStateChange(_state, _data) { }\r\n ;\r\n FallLand(_minhight, cb = null) {\r\n if (this.cursprite.transform.position.y > _minhight) {\r\n var mpos = this.cursprite.transform.position.clone();\r\n var targetpos = new Vector3(mpos.x, _minhight, mpos.z);\r\n GameUtils.TweenMove(this.cursprite.transform, targetpos, 1.5, Laya.Handler.create(this, () => {\r\n if (cb)\r\n cb();\r\n }), Laya.Ease.quadOut);\r\n }\r\n }\r\n BeBoom() { }\r\n ;\r\n Provocation(_complete = null) {\r\n if (this.provocationclip != null) {\r\n this.curanimator.play(this.provocationclip);\r\n Laya.timer.once(2000, this, () => {\r\n if (_complete)\r\n _complete();\r\n this.ChangeState(RoleState.Idle);\r\n });\r\n }\r\n }\r\n}\r\n",
- "references": [
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/AssetManager.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Util/PoolManager.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Util/GameUtils.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/EventManager.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/DataMaker.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/CameraManager.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/SceneManager.ts",
- "D:/Work/samurai2-laya/laya/samuraiflash-tt/src/Main/Player.ts"
- ]
- }
|