Exemplo n.º 1
0
    private void ConfigureRightMissingDnaPair(DnaPairModel pair)
    {
        var(leftColor, rightColor, leftColorIndex, rightColorIndex) = GetRandomColorPair();
        pair.MissingColors.Add(rightColorIndex);
        pair.RightIsMissing = true;

        foreach (var renderer in pair.ChildRenderers)
        {
            if (renderer.gameObject.tag == Constants.Tags.Frame)
            {
                renderer.material = FrameMaterial;
            }

            else if (renderer.gameObject.tag == Constants.Tags.NodeLeft)
            {
                renderer.material = leftColor;
            }
            else if (renderer.gameObject.tag == Constants.Tags.BridgeLeft)
            {
                renderer.material = leftColor;
            }

            else if (renderer.gameObject.tag == Constants.Tags.NodeRight)
            {
                renderer.material = rightColor;
            }
            else if (renderer.gameObject.tag == Constants.Tags.BridgeRight)
            {
                renderer.material = ColorMissing;
            }
        }
    }
Exemplo n.º 2
0
    private void ConfigureDefaultDnaPair(DnaPairModel pair)
    {
        var(leftColor, rightColor, leftColorIndex, rightColorIndex) = GetRandomColorPair();
        foreach (var renderer in pair.ChildRenderers)
        {
            if (renderer.gameObject.tag == Constants.Tags.Frame)
            {
                renderer.material = FrameMaterial;
            }

            else if (renderer.gameObject.tag == Constants.Tags.NodeLeft)
            {
                renderer.material = leftColor;
            }
            else if (renderer.gameObject.tag == Constants.Tags.BridgeLeft)
            {
                renderer.material = leftColor;
            }

            else if (renderer.gameObject.tag == Constants.Tags.NodeRight)
            {
                renderer.material = rightColor;
            }
            else if (renderer.gameObject.tag == Constants.Tags.BridgeRight)
            {
                renderer.material = rightColor;
            }
        }
    }
Exemplo n.º 3
0
 private void GenerateObjects(GameObject go, Transform parent, int count)
 {
     DnaPairsList = new List <DnaPairModel>();
     for (int i = 0; i < count; i++)
     {
         var dnaPair = new DnaPairModel();
         dnaPair.GameObj    = Instantiate(go);
         dnaPair.InstanceId = dnaPair.GameObj.GetInstanceID();
         dnaPair.GameObj.transform.parent        = parent;
         dnaPair.GameObj.transform.localPosition = Vector3.zero;
         dnaPair.ChildRenderers = dnaPair.GameObj.GetComponentsInChildren <Renderer>().ToList();
         DnaPairsList.Add(dnaPair);
     }
 }
Exemplo n.º 4
0
    private void ConfigurePair(DnaPairMode pairMode, DnaPairModel pair)
    {
        switch (pairMode)
        {
        case DnaPairMode.BothMissing:
            ConfigureBothMissingDnaPair(pair);
            break;

        case DnaPairMode.LeftMissing:
            ConfigureLeftMissingDnaPair(pair);
            break;

        case DnaPairMode.RightMissing:
            ConfigureRightMissingDnaPair(pair);
            break;

        default:
            ConfigureDefaultDnaPair(pair);
            break;
        }
    }