コード例 #1
0
ファイル: Packet.cs プロジェクト: horato/IntWarsSharp
 public OnAttack(Unit attacker, Unit attacked, AttackType attackType) : base(ExtendedPacketCmd.EPKT_S2C_OnAttack, attacker.getNetId())
 {
     buffer.Write((short)attackType);
     buffer.Write(attacked.getX());
     buffer.Write(attacked.getZ());
     buffer.Write(attacked.getY());
     buffer.Write(attacked.getNetId());
 }
コード例 #2
0
ファイル: PacketNotifier.cs プロジェクト: horato/IntWarsSharp
        public static void notifyDash(Unit u, float _x, float _y, float dashSpeed)
        {
            // TODO: Fix dash: it stays in the current location and doesn't hit a wall if the target location can't be reached
            float _z = u.getZ();

            /*if (!map.isWalkable(_x, _y)) {
               _x = u.getPosition().X;
               _y = u.getPosition().Y;
            }
            else {
               // Relative coordinates to dash towards
               float newX = _x;
               float newY = _y;
               _z -= map.getHeightAtLocation(_x, _y);
               _x = u.getPosition().X - _x;
               _y = u.getPosition().Y - _y;

               u.setPosition(newX, newY);
            }*/

            var dash = new Dash(u, _x, _y, dashSpeed);
            PacketHandlerManager.getInstace().broadcastPacketVision(u, dash, Channel.CHL_S2C);
        }