// 當 player 換人時,要呼叫此方法. // 不然上一個玩家的視角會殘留. public void RebindPlayer() { bufferMap.ReBindPlayer(); littleMap.ClearMap(); camera.transform.position = new Vector3(bufferMap.center.X.value, bufferMap.center.Y.value, -1); MovingManager.RemoveMovingAndMoveTo(camera); }
// 用來做平順移動. // 在MonoBehaviour 的 Update() 呼叫. // [用來平順移動] // player 不存在,不會執行. public void Update(float deltaTime) { if (Player == null || GameStatus.pause) { return; } MovingManager.Update(); }
// 若 player 不存在 不會執行. public void Clock() { if (Player == null || GameStatus.pause) { return; } // 所有移動中物件移到目標點. MovingManager.AllObjsMoveToDest(); // update player if (!Player.IsDead) { var events = PlayerBind.UpdateBinded(); foreach (var objEvent in events) { switch (objEvent) { case ObjEvent.posit: bufferMap.MoveForward(Player.VectorOnScenen); MovingManager.AddMoving(camera, Convert(Player.VectorOnScenen)); //bug break; case ObjEvent.plain: RebindPlayer(); //bug break; } } } bufferMap.Clock(); littleMap.UpdateForPlayer(GlobalAsset.creaters); }
// 綁定物件依據 Animal 的方向移動. private void BindedMove() { Animal animal = (Animal)obj; MovingManager.AddMoving(binded, Convert(animal.VectorOnScenen)); }