private void PlaceCharacters() { // TODO Log.Info("Placing characters"); int x = 16; int y = 9; foreach (var player in GameFlowData.Get().GetPlayers()) { //UnityUtils.DumpGameObject(player); ActorData actorData = player.GetComponent <ActorData>(); var atsd = actorData.TeamSensitiveData_authority; if (atsd == null) { continue; } BoardSquare start = Board.Get().GetSquare(x++, y); GridPosProp startProp = GridPosProp.FromGridPos(start.GetGridPosition()); atsd.CallRpcMovement(GameEventManager.EventType.Invalid, startProp, startProp, null, ActorData.MovementType.Teleport, false, false); actorData.ServerLastKnownPosSquare = start; actorData.InitialMoveStartSquare = start; actorData.MoveFromBoardSquare = start; Log.Info($"Placing {actorData.DisplayName} at {startProp.m_x}, {startProp.m_y}"); // PATCH internal -> public ActorData.DisplayName } Log.Info("Done placing characters"); }
public void ResolveMovement() { Dictionary <int, BoardSquarePathInfo> paths = new Dictionary <int, BoardSquarePathInfo>(); foreach (ActorData actor in GameFlowData.Get().GetActors()) { paths.Add(actor.ActorIndex, ResolveMovement(actor)); } Dictionary <int, BoardSquarePathInfo> nodes = new Dictionary <int, BoardSquarePathInfo>(paths); bool finished = false; for (float time = 0; !finished; time += RESOLUTION_STEP) { if (!ResolveSubstep(nodes, time, out finished)) { // TODO optimize time = -RESOLUTION_STEP; nodes = new Dictionary <int, BoardSquarePathInfo>(paths); Log.Info("Restarting movement resolution loop"); } } var movementActions = ArtemisServerBarrierManager.Get().OnMovement(paths); ArtemisServerResolutionManager.Get().SendMovementActions(movementActions); // TODO ClientMovementManager.MsgServerMovementStarting foreach (ActorData actor in GameFlowData.Get().GetActors()) { BoardSquarePathInfo start = paths[actor.ActorIndex]; BoardSquarePathInfo end = start; while (end.next != null) { end = end.next; } ActorTeamSensitiveData atsd = actor.TeamSensitiveData_authority; // TODO GetPathEndpoint everywhere // TODO movement camera bounds actor.MoveFromBoardSquare = end.square; actor.InitialMoveStartSquare = end.square; atsd.CallRpcMovement( GameEventManager.EventType.Invalid, GridPosProp.FromGridPos(start.square.GetGridPosition()), GridPosProp.FromGridPos(end.square.GetGridPosition()), MovementUtils.SerializePath(start), ActorData.MovementType.Normal, false, false); atsd.MovementLine?.m_positions.Clear(); } Log.Info("Movement resolved"); }
public override void Deserialize(NetworkReader reader, GameObject context) { var board = context.GameManager.Board; EventType = (GameEventManager.EventType)reader.ReadInt32(); Start = GeneratedNetworkCode._ReadGridPosProp_None(reader); EndGridPos = GeneratedNetworkCode._ReadGridPosProp_None(reader); EndSquare = board.GetBoardSquare(GridPos.FromGridPosProp(EndGridPos)); var pathBytes = reader.ReadBytesAndSize(); Path = MovementUtils.DeSerializePath(board, pathBytes); MovementType = (ActorData.MovementType)reader.ReadInt32(); DisappearAfterMovement = reader.ReadBoolean(); Respawning = reader.ReadBoolean(); }
public static void _WriteGridPosProp_None(NetworkWriter writer, GridPosProp value) { writer.WritePackedUInt32((uint)value.m_x); writer.WritePackedUInt32((uint)value.m_y); writer.WritePackedUInt32((uint)value.m_height); }