Skip to content

Commit a792763

Browse files
committed
Merge branch 'master' of github.com:bfdev/bombdiff
2 parents 0de05c0 + 0dd54bf commit a792763

7 files changed

Lines changed: 73 additions & 18 deletions

File tree

24 Bytes
Binary file not shown.
8.22 KB
Binary file not shown.

Assets/Prefabs/Components/EmptyComponent.prefab.meta

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1.87 KB
Binary file not shown.

Assets/Scripts/BombGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected void CreateBomb()
3131
foreach(Transform anchorPoint in bombScript.componentAnchorPoints)
3232
{
3333
rand = (int)(Random.value * componentPrefabs.Length);
34-
if (rand == bombPrefabs.Length)
34+
if (rand == componentPrefabs.Length)
3535
{
3636
rand -= 1;
3737
}

Assets/Scripts/SnippableWire.cs

Lines changed: 68 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@ public enum WireColour
1717
public Material whiteMaterial;
1818
public Material yellowMaterial;
1919

20+
public Material blackMaterialHighlight;
21+
public Material blueMaterialHighlight;
22+
public Material redMaterialHighlight;
23+
public Material whiteMaterialHighlight;
24+
public Material yellowMaterialHighlight;
25+
2026
public GameObject snippedWire;
2127
public GameObject nonSnippedWire;
2228

29+
protected bool _isHighlighted = false;
2330
protected WireColour _colour;
2431

2532
// Use this for initialization
@@ -43,24 +50,49 @@ void Update()
4350
public void setColour(WireColour newColour)
4451
{
4552
Material newMaterial;
46-
switch (newColour)
53+
if (_isHighlighted)
54+
{
55+
switch (newColour)
56+
{
57+
case WireColour.Black:
58+
newMaterial = blackMaterialHighlight;
59+
break;
60+
case WireColour.Blue:
61+
newMaterial = blueMaterialHighlight;
62+
break;
63+
case WireColour.Red:
64+
newMaterial = redMaterialHighlight;
65+
break;
66+
case WireColour.White:
67+
newMaterial = whiteMaterialHighlight;
68+
break;
69+
case WireColour.Yellow:
70+
default:
71+
newMaterial = yellowMaterialHighlight;
72+
break;
73+
}
74+
}
75+
else
4776
{
48-
case WireColour.Black:
49-
newMaterial = blackMaterial;
50-
break;
51-
case WireColour.Blue:
52-
newMaterial = blueMaterial;
53-
break;
54-
case WireColour.Red:
55-
newMaterial = redMaterial;
56-
break;
57-
case WireColour.White:
58-
newMaterial = whiteMaterial;
59-
break;
60-
case WireColour.Yellow:
61-
default:
62-
newMaterial = yellowMaterial;
63-
break;
77+
switch (newColour)
78+
{
79+
case WireColour.Black:
80+
newMaterial = blackMaterial;
81+
break;
82+
case WireColour.Blue:
83+
newMaterial = blueMaterial;
84+
break;
85+
case WireColour.Red:
86+
newMaterial = redMaterial;
87+
break;
88+
case WireColour.White:
89+
newMaterial = whiteMaterial;
90+
break;
91+
case WireColour.Yellow:
92+
default:
93+
newMaterial = yellowMaterial;
94+
break;
95+
}
6496
}
6597
foreach (MeshRenderer meshRenderer in this.gameObject.GetComponentsInChildren<MeshRenderer>())
6698
{
@@ -84,4 +116,23 @@ public bool isSnipped()
84116
{
85117
return nonSnippedWire.activeInHierarchy;
86118
}
119+
120+
public void setIsHighlighted(bool value)
121+
{
122+
_isHighlighted = value;
123+
// reset material to use the highlighted material or non-highlighted
124+
setColour(_colour);
125+
}
126+
127+
// For testing highlight...
128+
//void OnMouseEnter()
129+
//{
130+
// setIsHighlighted(true);
131+
//}
132+
133+
//void OnMouseExit()
134+
//{
135+
// setIsHighlighted(false);
136+
//}
137+
87138
}

Assets/WireSetTempScene.unity

2.36 KB
Binary file not shown.

0 commit comments

Comments
 (0)