Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        base.Start();

        pathFinder = GetComponent<PathFinder>();
        pathFinder.Grid = grid;
        pathFinder.DistanceCanJump = heightCanJump;
        pathFinder.HeightCanJump = distanceCanJump;
        pathFinder.MaxDistance = maxSearchDistance;

        holder = GetComponent<KeyHolder>();
        holder.OnKeyPickedUp += KeyPickedUp;

        trans = transform;
    }
Ejemplo n.º 2
0
        public KeyRing(IKey defaultKey, IEnumerable<IKey> allKeys)
        {
            _keyIdToKeyHolderMap = new Dictionary<Guid, KeyHolder>();
            foreach (IKey key in allKeys)
            {
                _keyIdToKeyHolderMap.Add(key.KeyId, new KeyHolder(key));
            }

            // It's possible under some circumstances that the default key won't be part of 'allKeys',
            // such as if the key manager is forced to use the key it just generated even if such key
            // wasn't in the underlying repository. In this case, we just add it now.
            if (!_keyIdToKeyHolderMap.ContainsKey(defaultKey.KeyId))
            {
                _keyIdToKeyHolderMap.Add(defaultKey.KeyId, new KeyHolder(defaultKey));
            }

            DefaultKeyId = defaultKey.KeyId;
            _defaultKeyHolder = _keyIdToKeyHolderMap[DefaultKeyId];
        }
Ejemplo n.º 3
0
 public static List <int> DecryptIntList(this byte[] byteArray, int keyIndex = 0)
 {
     return(Array.ConvertAll(QEncryption.DecryptBytes(byteArray, KeyHolder.GetKey(keyIndex), KeyHolder.GetIV(keyIndex)).Split(StringDelimiter), int.Parse).ToList());
 }
Ejemplo n.º 4
0
 public static byte[] Encrypt(this bool[] boolArray, int keyIndex = 0)
 {
     return(QEncryption.EncryptString(boolArray.ToString(StringDelimiter), KeyHolder.GetKey(keyIndex), KeyHolder.GetIV(keyIndex)));
 }
Ejemplo n.º 5
0
 public static int[] DecryptIntArray(this string value, int keyIndex = 0)
 {
     return(Array.ConvertAll(QEncryption.DecryptBytes(Array.ConvertAll(value.Split(StringDelimiter), byte.Parse), KeyHolder.GetKey(keyIndex), KeyHolder.GetIV(keyIndex)).Split(StringDelimiter), int.Parse));
 }
Ejemplo n.º 6
0
 public static byte[] Encrypt(this List <int> intList, int keyIndex = 0)
 {
     return(QEncryption.EncryptString(intList.ToString(StringDelimiter), KeyHolder.GetKey(keyIndex), KeyHolder.GetIV(keyIndex)));
 }
Ejemplo n.º 7
0
 public static float[] DecryptFloatArray(this byte[] byteArray, int keyIndex = 0)
 {
     return(Array.ConvertAll(QEncryption.DecryptBytes(byteArray, KeyHolder.GetKey(keyIndex), KeyHolder.GetIV(keyIndex)).Split(StringDelimiter), float.Parse));
 }
Ejemplo n.º 8
0
 public static List <float> DecryptFloatList(this string value, int keyIndex = 0)
 {
     return(Array.ConvertAll(QEncryption.DecryptBytes(Array.ConvertAll(value.Split(StringDelimiter), byte.Parse), KeyHolder.GetKey(keyIndex), KeyHolder.GetIV(keyIndex)).Split(StringDelimiter), float.Parse).ToList());
 }
Ejemplo n.º 9
0
 public static string DecryptString(this byte[] byteArray, int keyIndex = 0)
 {
     return(QEncryption.DecryptBytes(byteArray, KeyHolder.GetKey(keyIndex), KeyHolder.GetIV(keyIndex)));
 }
Ejemplo n.º 10
0
 public static byte[] Encrypt(this string value, int keyIndex = 0)
 {
     return(QEncryption.EncryptString(value, KeyHolder.GetKey(keyIndex), KeyHolder.GetIV(keyIndex)));
 }
Ejemplo n.º 11
0
 public static bool DecryptBool(this byte[] byteArray, int keyIndex = 0)
 {
     return(bool.Parse(QEncryption.DecryptBytes(byteArray, KeyHolder.GetKey(keyIndex), KeyHolder.GetIV(keyIndex))));
 }
Ejemplo n.º 12
0
 public static bool DecryptBool(this string value, int keyIndex = 0)
 {
     return(bool.Parse(QEncryption.DecryptBytes(Array.ConvertAll(value.Split(StringDelimiter), byte.Parse), KeyHolder.GetKey(keyIndex), KeyHolder.GetIV(keyIndex))));
 }
Ejemplo n.º 13
0
 public static int DecryptInt(this byte[] byteArray, int keyIndex = 0)
 {
     return(int.Parse(QEncryption.DecryptBytes(byteArray, KeyHolder.GetKey(keyIndex), KeyHolder.GetIV(keyIndex))));
 }