public void Move(MoveDirection dire) { Point offsetPos = MoveDirectionToPointConverter.MoveDirectionConvertToPoint(dire); var TileMove = CozyMoveBy.Create(0.5f, offsetPos.ToVector2() * ContentSize); var SetPosAction = CozyCallFunc.Create(() => { this.TilePosition += offsetPos; Moving = false; }); var ActSeq = CozySequence.Create(TileMove, SetPosAction); Moving = true; this.RunAction(ActSeq); }
private void OnHappyPlayerMove(MsgBase b) { var moveMsg = (Msg_HappyPlayerMove)b; uint uid = moveMsg.Uid; if (OtherPlayerList.ContainsKey(uid)) { var player = OtherPlayerList[uid]; if (player != null) { var dire = MoveDirectionToPointConverter.PointConvertToMoveDirection(new Point(moveMsg.X, moveMsg.Y)); player.Move(dire); } } }
public override void Update(GameTime gameTime) { base.Update(gameTime); keyboard.Update(gameTime); client.Update(); var dire = DirectionNow(); if (dire != Interface.MoveDirection.Unknow) { if (!Player.Moving) { Player.Move(dire); var offsetPos = MoveDirectionToPointConverter.MoveDirectionConvertToPoint(dire); var MoveMsg = new Msg_HappyPlayerMove(); MoveMsg.Uid = Uid; MoveMsg.X = offsetPos.X; MoveMsg.Y = offsetPos.Y; client.SendMessage(MoveMsg); } } }