예제 #1
0
 public void Add(IFloatUpdate sub, float val)
 {
     if (isUpdating)
     {
         FloatUpdateAddCmd cmd;
         cmd.val    = val;
         cmd.target = sub;
         toAdd.Add(cmd);
     }
     else
     {
         AddDirect(sub, val);
     }
 }
예제 #2
0
        void AddDirect(IFloatUpdate sub, float val)
        {
            if (count >= values.Length)
            {
                float[]        newArray     = new float[values.Length * 2];
                IFloatUpdate[] newSubsArray = new IFloatUpdate[subs.Length * 2];
                Array.Copy(values, 0, newArray, 0, values.Length);
                Array.Copy(subs, 0, newSubsArray, 0, values.Length);
                values = newArray;
                subs   = newSubsArray;
                //Debug.Log("alloc");
            }

            values[count] = val;
            subs[count]   = sub;
            sub.NotifyIndexChange(count);
            count++;
        }