예제 #1
0
    public void Update()
    {
        var count = CellCounter.GetCount(cellTag);

        isValid      = count >= minCount;
        isFailing    = count == 0;
        image.sprite = isValid
            ? successSprite
            : isFailing
            ? failedSprite
            : null;
        image.enabled = image.sprite != null;
    }
예제 #2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Counting Cells...");

            var actualCellCount = new int[40];
            var tempCount       = 4;
            var difference      = 0;

            for (int i = 1; i <= 40; ++i)
            {
                if (i == 16)
                {
                    tempCount = 5;
                }
                if (i == 18)
                {
                    tempCount = 8;
                }
                if (i == 18)
                {
                    tempCount = 8;
                }
                if (i == 28)
                {
                    tempCount = 9;
                }
                if (i == 29)
                {
                    tempCount = 10;
                }
                if (i == 31)
                {
                    tempCount = 12;
                }
                if (i == 32)
                {
                    tempCount = 16;
                }
                if (i == 38)
                {
                    tempCount = 17;
                }
                actualCellCount[i - 1] = tempCount;
            }


            var cellCounter = new CellCounter(40);

            cellCounter.LoadImages("C:/Users/logic/source/repos/CountCells/CountCells/Resources");
            cellCounter.ProcessCellCounter();

            using (System.IO.StreamWriter file = new System.IO.StreamWriter("C:/Users/logic/source/repos/CountCells/CountCells/Resources/count.txt"))
            {
                double totalCount = 0;
                var    cellCount  = cellCounter.GetCellCounts();
                for (int i = 0; i < cellCount.Count; ++i)
                {
                    file.WriteLine($"Counted {cellCount[i]}. Actual {actualCellCount[i]}.");
                    difference += Math.Abs(cellCount[i] - actualCellCount[i]);
                    totalCount += actualCellCount[i];
                }
                file.WriteLine($"Difference: {difference}. {(totalCount - difference) / totalCount}");
            }

            Console.WriteLine("Finished counting.");
        }
예제 #3
0
 // Update is called once per frame
 void Update()
 {
     text.text = "(" + CellCounter.GetCount(countTag).ToString() + ")";
 }
예제 #4
0
 public void OnDestroy()
 {
     CellCounter.OnCellDestroyed(tag);
 }
예제 #5
0
 // Use this for initialization
 void Start()
 {
     splitsInFrame = 0;
     CellCounter.OnCellCreated(tag);
 }
예제 #6
0
 public void Update()
 {
     isValid       = CellCounter.GetCount(cellTag) <= maxCount;
     image.enabled = isValid;
 }