Пример #1
0
 public ChompMessageData(Vector2 center, float radius, List <Collider2D> colliders, Chomper source = null)
 {
     this.Center    = center;
     this.Radius    = radius;
     this.Colliders = colliders;
     this.Source    = source;
 }
Пример #2
0
        public static string ToString(byte[] plain)
        {
            if (plain == null)
            {
                throw new ArgumentNullException("plain");
            }

            short         buffer      = 0;
            int           hi          = 0;
            int           currentByte = 0;
            StringBuilder sb          = new StringBuilder();
            byte          index       = 0;

            Chomper chomp = () => {
                index = (byte)(buffer >> (hi - 5));
                sb.Append(base32chars[index]);
                buffer = (short)(buffer ^ index << (hi - 5));
                hi    -= 5;
            };

            while (currentByte < plain.Length || hi > 5)
            {
                if (hi < 5)
                {
                    buffer = (short)(buffer << 8 | plain[currentByte++]);
                    hi    += 8;
                }
                chomp();
            }

            if (hi > 0)
            {
                index = (byte)(buffer << (5 - hi));
                sb.Append(base32chars[index]);
            }

            switch (hi)
            {
            case 1:
                sb.Append("====");
                break;

            case 2:
                sb.Append("=");
                break;

            case 3:
                sb.Append("===");
                break;

            case 4:
                sb.Append("======");
                break;
            }

            return(sb.ToString());
        }
Пример #3
0
 public override void Awake()
 {
     base.Awake();
     chomperController = base.gameObject.GetComponentInParent <Chomper>();
 }
Пример #4
0
 /// <summary>
 ///  Performs a chomp on <paramref name="s"/>
 /// </summary>
 /// <param name="s">
 ///  The string to be chomped
 /// </param>
 /// <returns>
 ///  The chomped result
 /// </returns>
 public static string Chomp(this string s)
 {
     return(Chomper.Chomp(s));
 }