Exemplo n.º 1
0
    private void GeneLiveVision(CellBug cellBug)
    {
        if (nowCellBug == null ||
            cellBug.GetAbility().GetGroup() != nowCellBug.GetAbility().GetGroup())
        {
            return;
        }

        int groupNum = 0;

        int[] gene = new int[Const.DnaLineLength];
        for (int i = 0; i < cellBugAllList.Count; i++)
        {
            CellBug bug = cellBugAllList[i] as CellBug;
            if (bug.GetAbility().GetGroup() == nowCellBug.GetAbility().GetGroup())
            {
                groupNum++;
                Dna tempDna = bug.GetAbility().GetDna();

                for (int index = 0; index < gene.Length; index++)
                {
                    gene[index] += (tempDna.GetDnaLine(Const.DnaLineEnum.OneEnum)[index] + tempDna.GetDnaLine(Const.DnaLineEnum.TwoEnum)[index]);
                }
            }
        }

        for (int m = 0; m < geneLabelArray.Length; m++)
        {
            geneLabelArray[m].text = Const.DnaName[m] + ":" + (int)(gene[m] / (2.0 * groupNum) * 100) + "%";
        }
    }