-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f6e10f
commit 82a47cf
Showing
14 changed files
with
196 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
using UnityEngine.UIElements; | ||
|
||
public class Signs : MonoBehaviour | ||
{ | ||
[Serializable] | ||
public class SizePair | ||
{ | ||
public SizeType type; | ||
public Sprite sprite; | ||
} | ||
|
||
[Serializable] | ||
public class ColorPair | ||
{ | ||
public ColorType type; | ||
public Sprite sprite; | ||
} | ||
|
||
[Serializable] | ||
public class ShapePair | ||
{ | ||
public ShapeType type; | ||
public Sprite sprite; | ||
} | ||
|
||
|
||
[Serializable] | ||
public class MaterialPair | ||
{ | ||
public MaterialType type; | ||
public Sprite sprite; | ||
} | ||
|
||
public ColorPair[] colorPairing; | ||
public MaterialPair[] materialPairing; | ||
public ShapePair[] shapePairing; | ||
public SizePair[] sizePairing; | ||
|
||
private GameObject color; | ||
private GameObject material; | ||
private GameObject shape; | ||
private GameObject size; | ||
|
||
private void Start() | ||
{ | ||
DeliveryZone.onNewOrder.AddListener(OnNewOrder); | ||
|
||
foreach (Transform child in transform) | ||
{ | ||
var obj = child.gameObject; | ||
switch (obj.name) | ||
{ | ||
case "Sign_Color": | ||
color = child.gameObject; | ||
break; | ||
case "Sign_Material": | ||
material = child.gameObject; | ||
break; | ||
case "Sign_Shape": | ||
shape = child.gameObject; | ||
break; | ||
case "Sign_Size": | ||
size = child.gameObject; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
public void OnNewOrder(Order order) | ||
{ | ||
color.GetComponent<SpriteRenderer>().sprite = colorPairing.Single(cp => cp.type == order.colorGoal).sprite; | ||
material.GetComponent<SpriteRenderer>().sprite = materialPairing.Single(cp => cp.type == order.materialGoal).sprite; | ||
shape.GetComponent<SpriteRenderer>().sprite = shapePairing.Single(cp => cp.type == order.shapeGoal).sprite; | ||
size.GetComponent<SpriteRenderer>().sprite = sizePairing.Single(cp => cp.type == order.sizeGoal).sprite; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
[Serializable] | ||
public class Order | ||
{ | ||
public ColorType colorGoal; | ||
public MaterialType materialGoal; | ||
public ShapeType shapeGoal; | ||
public SizeType sizeGoal; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UnityEngine.Events; | ||
|
||
public class EventOrder : UnityEvent<Order> | ||
{ | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UnityEngine.Events; | ||
|
||
public class EventTriggerable : UnityEvent<Triggerable> | ||
{ | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.