예제 #1
0
    public void OnReceiveCoordPacket(PacketId id, byte[] data)
    {
        PlayerCoordDataPacket packet = new PlayerCoordDataPacket(data);
        PlayerCoordinate      pc     = packet.GetPacket();

        Vector3 dir = new Vector3(pc.Coordinate.x, pc.Coordinate.y, pc.Coordinate.z);

        FindRemotePlayer().SetDestination(dir);
    }
예제 #2
0
파일: Packet.cs 프로젝트: SHSongs/DoorPi9
        public bool Serialize(PlayerCoordinate packet)
        {
            // 각 요소를 차례로 시리얼라이즈합니다.
            bool ret = true;

            ret &= Serialize(packet.PlayerId);
            ret &= Serialize(packet.Coordinate.x);
            ret &= Serialize(packet.Coordinate.y);
            ret &= Serialize(packet.Coordinate.z);
            return(ret);
        }
예제 #3
0
 protected override IEnumerable <Action> GetActionSequence() =>
 GetPreliminaryActionSequence()
 // Always explode on the last tick if possible
 .Select(a => PlayerInfo.CarryingPowerUp && Map.WorldTick == TotalGameTicks - 2 ? Action.Explode : a)
 // Explode if chased
 .Select(a =>
         PlayerInfo.CarryingPowerUp &&
         Map.CharacterInfos.Any(ci =>
                                ci.Id != PlayerId &&
                                ci.CarryingPowerUp &&
                                ci.StunnedForGameTicks == 0 &&
                                PlayerCoordinate.GetManhattanDistanceTo(MapUtils.GetCoordinateFrom(ci.Position)) <=
                                GameSettings.ExplosionRange
                                ) ? Action.Explode : a
         )
 // Never do nothing
 .Select(pa => pa is Action a ? a : GetRandomAction());
예제 #4
0
파일: Packet.cs 프로젝트: SHSongs/DoorPi9
        public bool Deserialize(ref PlayerCoordinate serialized)
        {
            if (GetDataSize() == 0)
            {
                return(false);
            }

            bool ret = true;

            // 데이터의 요소별로 디시리얼라이즈합니다.
            ret &= Deserialize(ref serialized.PlayerId);
            ret &= Deserialize(ref serialized.Coordinate.x);
            ret &= Deserialize(ref serialized.Coordinate.y);
            ret &= Deserialize(ref serialized.Coordinate.z);


            return(ret);
        }