예제 #1
0
 public void setColour(WireColour newColour)
 {
     Material newMaterial;
     if (_isHighlighted)
     {
         switch (newColour)
         {
             case WireColour.Black:
                 newMaterial = blackMaterialHighlight;
                 break;
             case WireColour.Blue:
                 newMaterial = blueMaterialHighlight;
                 break;
             case WireColour.Red:
                 newMaterial = redMaterialHighlight;
                 break;
             case WireColour.Green:
                 newMaterial = geenMaterialHighlight;
                 break;
             case WireColour.Yellow:
             default:
                 newMaterial = yellowMaterialHighlight;
                 break;
         }
     }
     else
     {
         switch (newColour)
         {
             case WireColour.Black:
                 newMaterial = blackMaterial;
                 break;
             case WireColour.Blue:
                 newMaterial = blueMaterial;
                 break;
             case WireColour.Red:
                 newMaterial = redMaterial;
                 break;
             case WireColour.Green:
                 newMaterial = geenMaterial;
                 break;
             case WireColour.Yellow:
             default:
                 newMaterial = yellowMaterial;
                 break;
         }
     }
     foreach (MeshRenderer meshRenderer in this.gameObject.GetComponentsInChildren<MeshRenderer>())
     {
         meshRenderer.material = newMaterial;
     }
     _colour = newColour;
 }
예제 #2
0
    public int GetLastIndexOfColour(WireColour colour)
    {
        int index = -1;
        for(int i = 0; i < wires.Length; i++)
        {
            if (wires[i].getColour() == colour)
            {
                index = i;
            }
        }

        return index;
    }
예제 #3
0
    public int GetFirstIndexOfColour(WireColour colour)
    {
        for(int index = 0; index < wires.Length; index++)
        {
            if (wires[index].getColour() == colour)
            {
                return index;
            }
        }

        //Uh oh, no wire of that colour!
        Debug.Log(String.Format("Tried to get index of Colour {0} wire, but none exists.", colour));
        return -1;
    }
예제 #4
0
    public int GetLastIndexOfColour(WireColour colour)
    {
        int index = -1;

        for (int i = 0; i < wires.Length; i++)
        {
            if (wires[i].getColour() == colour)
            {
                index = i;
            }
        }

        return(index);
    }
예제 #5
0
    public int GetFirstIndexOfColour(WireColour colour)
    {
        for (int index = 0; index < wires.Length; index++)
        {
            if (wires[index].getColour() == colour)
            {
                return(index);
            }
        }

        //Uh oh, no wire of that colour!
        Debug.Log(String.Format("Tried to get index of Colour {0} wire, but none exists.", colour));
        return(-1);
    }
예제 #6
0
    public int GetColourCount(WireColour colour)
    {
        int count = 0;

        foreach(SnippableWire wire in wires)
        {
            if (wire.getColour() == colour)
            {
                count++;
            }
        }

        Debug.Log (String.Format ("There are {0} {1} wires.", count, colour));

        return count;
    }
예제 #7
0
    public int GetColourCount(WireColour colour)
    {
        int count = 0;

        foreach (SnippableWire wire in wires)
        {
            if (wire.getColour() == colour)
            {
                count++;
            }
        }

        Debug.Log(String.Format("There are {0} {1} wires.", count, colour));

        return(count);
    }
예제 #8
0
    public void setColour(WireColour newColour)
    {
        Material newMaterial;

        if (_isHighlighted)
        {
            switch (newColour)
            {
            case WireColour.Black:
                newMaterial = blackMaterialHighlight;
                break;

            case WireColour.Blue:
                newMaterial = blueMaterialHighlight;
                break;

            case WireColour.Red:
                newMaterial = redMaterialHighlight;
                break;

            case WireColour.Green:
                newMaterial = geenMaterialHighlight;
                break;

            case WireColour.Yellow:
            default:
                newMaterial = yellowMaterialHighlight;
                break;
            }
        }
        else
        {
            switch (newColour)
            {
            case WireColour.Black:
                newMaterial = blackMaterial;
                break;

            case WireColour.Blue:
                newMaterial = blueMaterial;
                break;

            case WireColour.Red:
                newMaterial = redMaterial;
                break;

            case WireColour.Green:
                newMaterial = geenMaterial;
                break;

            case WireColour.Yellow:
            default:
                newMaterial = yellowMaterial;
                break;
            }
        }
        foreach (MeshRenderer meshRenderer in this.gameObject.GetComponentsInChildren <MeshRenderer>())
        {
            meshRenderer.material = newMaterial;
        }
        _colour = newColour;
    }
 public WireState(int position, WireColour colour)
 {
     this.Position = position;
     this.Colour   = colour;
 }