public void recRelief(KBEngine.Role e, ReliefType type) { if (e.renderObj == null) { return; } GameObject player = e.renderObj as GameObject; CombatProps cp = player.GetComponent <CombatProps>(); switch (type) { case ReliefType.Frozen: cp.outFrozenDBuff(); break; case ReliefType.SpeedUp: cp.outSpeedUpBuff(); break; case ReliefType.Sleep: cp.outSleepDBuff(); break; case ReliefType.Mess: cp.outMessDBuff(); break; } }
/* complex for me now * private readonly int[] _buf; * private readonly ValueCoor _bufStart; * private readonly ValueCoor _bufEnd; * private static void FillBuffer(ValueCoor center, int radiusGrad) * { * _bufStart = new ValueCoor * { * Longitude = center.Longitude - radiusGrad, * Latitude = center.Latitude - radiusGrad * }; * _bufEnd = new ValueCoor * { * Longitude = center.Longitude + radiusGrad, * Latitude = center.Latitude + radiusGrad * }; * var size = _bufEnd - _bufStart; * _buf = new int[size]; * using (var stream = new FileStream(Filepath, FileMode.Open)) * { * var i = radiusGrad * (60 / _accuracyMin); * for (var row = -i; row < i; row++) * { * for (var column = -i; column < i; column++) * { * var c = new ValueCoor * { * Longitude = center.Longitude - radiusGrad, * Latitude = center.Latitude - radiusGrad * }; * stream.Position = c.Offset * 2; * var a = stream.ReadByte(); * var b = stream.ReadByte(); * var int16 = (UInt16) (a << 8) + b; * if (a >= 0x80) * _buf[i] = -((int16 ^ 0xffff) + 1); * else * _buf[i] = int16; * } * } * } * }*/ public Earth2014Manager(ReliefType type, int accuracyMin = 5, bool shape = false, bool readAllAtStart = false) { if (type == ReliefType.Mask && accuracyMin != 1) { throw new ApplicationException("ReliefType.Mask in 1 accuracy only"); } _readAllAtStart = readAllAtStart; _reliefType = type; _accuracyMin = accuracyMin; _shape = shape; if (_readAllAtStart) { using (var stream = new FileStream(Filepath, FileMode.Open)) { _buf = new byte[stream.Length]; stream.Read(_buf, 0, (int)stream.Length); } } else { _stream = new FileStream(Filepath, FileMode.Open, FileAccess.Read); } }