private void Awake() { rigbody = GetComponent <Rigidbody>(); if (SpawnTransform == null) { SpawnTransform = transform; } //加入监听SP变化事件 EventMgr.SPChangeEvent.AddListener(SPEvent); if (GameCtrl.IsOnlineGame) { if (RecvSyncMovement) { SyncMovement = new SyncMovement(); SyncMovement.Init(this); } if (RecvSyncUnitState) { SyncUnitState = new SyncUnitState(); SyncUnitState.Init(this); } if (RecvSyncPlayerCastingState) { SyncPlayerCastingState = new SyncPlayerCasting(); SyncPlayerCastingState.Init(this); } if (RecvSyncPlayerInput) { SyncPlayerInput = new SyncPlayerInput(); SyncPlayerInput.Init(this); } } }
private void FixedUpdate() { // 执行位置同步 SyncMovement?.Update(Time.fixedDeltaTime); }