Merge branch 'develop' into dhain

# Conflicts:
#	Assets/Scenes/MainScene.unity
This commit is contained in:
dhain 2022-06-10 08:59:57 +02:00
commit 8551736b5b
3 changed files with 25 additions and 186 deletions

View file

@ -1622,63 +1622,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 496797767}
m_CullTransparentMesh: 1
--- !u!1001 &497486378
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2510115116361252817, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_Name
value: Cow (1)
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_RootOrder
value: 12
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalPosition.x
value: 0.93
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalPosition.y
value: -3.32
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
--- !u!1001 &503031231
PrefabInstance:
m_ObjectHideFlags: 0
@ -1872,8 +1815,8 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 2006577139}
m_HandleRect: {fileID: 2006577138}
m_Direction: 2
m_Value: 1.0000001
m_Size: 0.5386614
m_Value: 1
m_Size: 0.5386615
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
@ -7826,63 +7769,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1862022784
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2510115116361252817, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_Name
value: Cow (2)
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_RootOrder
value: 13
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalPosition.x
value: 1.1
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalPosition.y
value: -1.88
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
--- !u!1001 &1868238650
PrefabInstance:
m_ObjectHideFlags: 0
@ -8073,7 +7959,7 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 18
m_fontSize: 29.25
m_fontSizeBase: 20
m_fontWeight: 400
m_enableAutoSizing: 1
@ -8725,7 +8611,7 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 18
m_fontSize: 29.25
m_fontSizeBase: 20
m_fontWeight: 400
m_enableAutoSizing: 1
@ -9340,63 +9226,6 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 5121261193055935940, guid: 2279fa2b47ef2ce40af9052d3a3f438b, type: 3}
m_PrefabInstance: {fileID: 2142219637}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &2510115117244603289
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2510115116361252817, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_Name
value: Cow
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_RootOrder
value: 11
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalPosition.x
value: -0.61
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalPosition.y
value: -2.7
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2510115116361252819, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 547dbbf4c5377dc409dfea772c096434, type: 3}
--- !u!1001 &5121261192963321214
PrefabInstance:
m_ObjectHideFlags: 0

View file

@ -45,11 +45,13 @@ public class FishingController : MonoBehaviour {
private Vector2 _ampsXY;
private Inventory _iv;
private ItemContainer _ic;
private MessageView _messageView;
public bool Fishing => _fishing;
// Start is called before the first frame update
void Start() {
_messageView = MessageView.instance;
ResetFishing();
_ampsXY = new Vector2(10, 10);
_iv = Inventory.instance;
@ -59,7 +61,6 @@ public class FishingController : MonoBehaviour {
// Update is called once per frame
void Update() {
if (_fishing) { //Fishing
if (!Catchable) {
// Fish not spawned yet
fishCooldown -= Time.deltaTime;
@ -88,7 +89,7 @@ public class FishingController : MonoBehaviour {
public void StartFishing() {
if (!_iv.items.ContainsKey(_ic.GetItemByName("Bait"))) {
Debug.Log("No bait!");
_messageView.sendMessage("No bait!", 1.0f);
return;
}
Vector3 pos = Input.mousePosition;
@ -107,21 +108,19 @@ public class FishingController : MonoBehaviour {
}
_fishing = true;
_iv.RemoveItem(_ic.GetItemByName("Bait"), 1);
_messageView.sendMessage("Fishing started", 1.0f);
}
public void TryCatch() {
if (_fishing && Catchable) {
Debug.Log("Tried to catch!");
if (_fishingTime <= MaxTime) {
Debug.Log("Caught!");
_messageView.sendMessage("Caught!", 1.5f);
_iv.AddItem(_ic.GetItemByName("Fish"), Math.Max((int)(1 / (_fishingTime / 2)), 1));
ResetFishing();
} else {
Debug.Log("Failed to catch!");
_fishingTime = 0f;
exMark.SetActive(false);
fishCooldown = Random.Range(MinFishCooldown + 2, MaxFishCooldown);
_messageView.sendMessage("Failed to catch the fish! You were too slow!", 1.5f);
}
ResetFishing();
}
}
}

View file

@ -23,7 +23,18 @@ public class MessageView : MonoBehaviour
public GameObject messageView;
public TextMeshProUGUI message;
public void sendMessage(String msg, double duration) {
private void Start() {
messageView.SetActive(false);
}
public void sendMessage(String msg, float duration) {
message.text = msg;
StartCoroutine(showForSeconds(duration));
}
private IEnumerator showForSeconds(float duration) {
messageView.SetActive(true);
yield return new WaitForSeconds(duration);
messageView.SetActive(false);
}
}