aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Kollack <nkollack@gmail.com>2022-04-23 22:08:26 -0500
committerNeil Kollack <nkollack@gmail.com>2022-04-23 22:08:26 -0500
commitbaf39e0e05808aaf16d6f7f8910fcb1e8de1736c (patch)
tree7d1ce7cb59d485a19e17b7ab4d404e509eb04aaf
parent6b35ba7c38a34360a8374c9c12c8b7b94c46ed47 (diff)
fix: implement enemy jump, air whip, player fb
-rw-r--r--Assets/InputActions.inputactions12
-rw-r--r--Assets/Prefabs/Enemies/Mummy.prefab39
-rw-r--r--Assets/Prefabs/Enemies/Zombie.prefab41
-rw-r--r--Assets/Scenes/Jungle.unity164
-rw-r--r--Assets/Scripts/Actors/Enemy.cs27
-rw-r--r--Assets/Scripts/Actors/Player.cs2
-rw-r--r--Assets/Scripts/Cursor.cs15
-rw-r--r--Assets/Scripts/Items/Whip.cs13
-rw-r--r--Assets/Scripts/LevelController.cs1
9 files changed, 278 insertions, 36 deletions
diff --git a/Assets/InputActions.inputactions b/Assets/InputActions.inputactions
index 4feaa55..703d2be 100644
--- a/Assets/InputActions.inputactions
+++ b/Assets/InputActions.inputactions
@@ -24,7 +24,7 @@
"initialStateCheck": true
},
{
- "name": "Attack",
+ "name": "Use",
"type": "Button",
"id": "18319b32-d662-4d4f-adec-97eab089357c",
"expectedControlType": "Button",
@@ -33,7 +33,7 @@
"initialStateCheck": false
},
{
- "name": "Use",
+ "name": "UNUSED",
"type": "Button",
"id": "f3b20a10-e7c5-424c-8b9e-5f3ef85ab330",
"expectedControlType": "Button",
@@ -136,7 +136,7 @@
"interactions": "",
"processors": "",
"groups": "",
- "action": "Attack",
+ "action": "Use",
"isComposite": false,
"isPartOfComposite": false
},
@@ -147,7 +147,7 @@
"interactions": "",
"processors": "",
"groups": "",
- "action": "Attack",
+ "action": "Use",
"isComposite": false,
"isPartOfComposite": false
},
@@ -158,7 +158,7 @@
"interactions": "",
"processors": "",
"groups": "",
- "action": "Use",
+ "action": "UNUSED",
"isComposite": false,
"isPartOfComposite": false
},
@@ -169,7 +169,7 @@
"interactions": "",
"processors": "",
"groups": "",
- "action": "Use",
+ "action": "UNUSED",
"isComposite": false,
"isPartOfComposite": false
},
diff --git a/Assets/Prefabs/Enemies/Mummy.prefab b/Assets/Prefabs/Enemies/Mummy.prefab
index 293db08..6f37abd 100644
--- a/Assets/Prefabs/Enemies/Mummy.prefab
+++ b/Assets/Prefabs/Enemies/Mummy.prefab
@@ -1,5 +1,36 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &5203097092473131404
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 3262404053825753980}
+ m_Layer: 10
+ m_Name: GroundPoint (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &3262404053825753980
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 5203097092473131404}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0.3, y: -0.51, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 8919320861035673862}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8919320861035673885
GameObject:
m_ObjectHideFlags: 0
@@ -35,6 +66,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 8919320863032976505}
+ - {fileID: 3262404053825753980}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -130,7 +162,10 @@ MonoBehaviour:
maxJumps: 1
jumpForce: 500
damage: 0
- groundCheckPoint: {fileID: 8919320863032976505}
+ groundCheckPoint1: {fileID: 0}
+ groundCheckPoint2: {fileID: 0}
+ invulnTime: 0
+ hangTime: 0
stats:
maxHealth: 0
speedMultiplier: 0
@@ -235,7 +270,7 @@ GameObject:
m_Layer: 10
m_Name: GroundPoint
m_TagString: Untagged
- m_Icon: {fileID: 0}
+ m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
diff --git a/Assets/Prefabs/Enemies/Zombie.prefab b/Assets/Prefabs/Enemies/Zombie.prefab
index 3725290..bad8ee7 100644
--- a/Assets/Prefabs/Enemies/Zombie.prefab
+++ b/Assets/Prefabs/Enemies/Zombie.prefab
@@ -1,5 +1,36 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &1617335577187073219
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 8619667157834013351}
+ m_Layer: 10
+ m_Name: GroundPoint (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &8619667157834013351
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1617335577187073219}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: -0.251, y: -0.499, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 199732719703436395}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4799600927363337844
GameObject:
m_ObjectHideFlags: 0
@@ -35,6 +66,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2602158014784719401}
+ - {fileID: 8619667157834013351}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -130,7 +162,10 @@ MonoBehaviour:
maxJumps: 1
jumpForce: 500
damage: 0
- groundCheckPoint: {fileID: 2602158014784719401}
+ groundCheckPoint1: {fileID: 0}
+ groundCheckPoint2: {fileID: 0}
+ invulnTime: 0
+ hangTime: 0
stats:
maxHealth: 0
speedMultiplier: 0
@@ -308,7 +343,7 @@ GameObject:
m_Layer: 10
m_Name: GroundPoint
m_TagString: Untagged
- m_Icon: {fileID: 0}
+ m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
@@ -320,7 +355,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8191793094342821551}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
- m_LocalPosition: {x: -0.001, y: -0.499, z: 0}
+ m_LocalPosition: {x: 0.049000002, y: -0.499, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
diff --git a/Assets/Scenes/Jungle.unity b/Assets/Scenes/Jungle.unity
index f12c5a7..8f52001 100644
--- a/Assets/Scenes/Jungle.unity
+++ b/Assets/Scenes/Jungle.unity
@@ -3741,6 +3741,37 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 522725465}
m_CullTransparentMesh: 1
+--- !u!1 &523689613
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 523689614}
+ m_Layer: 10
+ m_Name: GroundPoint (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &523689614
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 523689613}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: -0.251, y: -0.499, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 199732719654464742}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &544966461
GameObject:
m_ObjectHideFlags: 0
@@ -11256,7 +11287,7 @@ GameObject:
m_Layer: 10
m_Name: GroundPoint
m_TagString: Untagged
- m_Icon: {fileID: 0}
+ m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
@@ -211245,6 +211276,37 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
pauseMenuUI: {fileID: 1261295309}
+--- !u!1 &1232421259
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1232421260}
+ m_Layer: 10
+ m_Name: GroundPoint (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1232421260
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1232421259}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0.3, y: -0.51, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 8919320862840140559}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1238560267
GameObject:
m_ObjectHideFlags: 0
@@ -211335,10 +211397,10 @@ MonoBehaviour:
maxJumps: 1
jumpForce: 500
damage: 0
- groundCheckPoint1: {fileID: 0}
- groundCheckPoint2: {fileID: 0}
+ groundCheckPoint1: {fileID: 819884911}
+ groundCheckPoint2: {fileID: 1275280911}
invulnTime: 0
- hangTime: 0
+ hangTime: 2
stats:
maxHealth: 0
speedMultiplier: 0
@@ -211432,6 +211494,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 819884911}
+ - {fileID: 1275280911}
m_Father: {fileID: 0}
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
@@ -211599,6 +211662,37 @@ Transform:
m_CorrespondingSourceObject: {fileID: 8998169987422057300, guid: 43bb790f4ad5293458409f755aeddc9b, type: 3}
m_PrefabInstance: {fileID: 1267858711}
m_PrefabAsset: {fileID: 0}
+--- !u!1 &1275280910
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1275280911}
+ m_Layer: 10
+ m_Name: GroundPoint (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1275280911
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1275280910}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0.25, y: -0.51, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 1238560272}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1287997268
PrefabInstance:
m_ObjectHideFlags: 0
@@ -437727,6 +437821,37 @@ Transform:
m_CorrespondingSourceObject: {fileID: 6617642576055808877, guid: 308f1bf9ce39cde4688ce6d998c0565f, type: 3}
m_PrefabInstance: {fileID: 2078580913}
m_PrefabAsset: {fileID: 0}
+--- !u!1 &2095907836
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 2095907837}
+ m_Layer: 10
+ m_Name: GroundPoint (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &2095907837
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2095907836}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: -0.25100002, y: -0.499, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 199732720268733818}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &2117636798
PrefabInstance:
m_ObjectHideFlags: 0
@@ -438004,6 +438129,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2602158014812719780}
+ - {fileID: 523689614}
m_Father: {fileID: 0}
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -438020,6 +438146,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2602158012877245240}
+ - {fileID: 2095907837}
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -438088,7 +438215,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8191793093634983870}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
- m_LocalPosition: {x: -0.001, y: -0.499, z: 0}
+ m_LocalPosition: {x: 0.049000002, y: -0.499, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -438103,7 +438230,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8191793094366692898}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
- m_LocalPosition: {x: -0.001, y: -0.499, z: 0}
+ m_LocalPosition: {x: 0.049000002, y: -0.499, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -438508,10 +438635,10 @@ MonoBehaviour:
maxJumps: 1
jumpForce: 500
damage: 0
- groundCheckPoint1: {fileID: 0}
- groundCheckPoint2: {fileID: 0}
+ groundCheckPoint1: {fileID: 2602158012877245240}
+ groundCheckPoint2: {fileID: 2095907837}
invulnTime: 0
- hangTime: 0
+ hangTime: 2
stats:
maxHealth: 0
speedMultiplier: 0
@@ -438538,10 +438665,10 @@ MonoBehaviour:
maxJumps: 1
jumpForce: 500
damage: 0
- groundCheckPoint1: {fileID: 0}
- groundCheckPoint2: {fileID: 0}
+ groundCheckPoint1: {fileID: 2602158014812719780}
+ groundCheckPoint2: {fileID: 523689614}
invulnTime: 0
- hangTime: 0
+ hangTime: 2
stats:
maxHealth: 0
speedMultiplier: 0
@@ -438603,7 +438730,7 @@ GameObject:
m_Layer: 10
m_Name: GroundPoint
m_TagString: Untagged
- m_Icon: {fileID: 0}
+ m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
@@ -438619,7 +438746,7 @@ GameObject:
m_Layer: 10
m_Name: GroundPoint
m_TagString: Untagged
- m_Icon: {fileID: 0}
+ m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
@@ -438894,7 +439021,7 @@ GameObject:
m_Layer: 10
m_Name: GroundPoint
m_TagString: Untagged
- m_Icon: {fileID: 0}
+ m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
@@ -438947,6 +439074,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 8919320861079350896}
+ - {fileID: 1232421260}
m_Father: {fileID: 0}
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
@@ -439042,10 +439170,10 @@ MonoBehaviour:
maxJumps: 1
jumpForce: 500
damage: 0
- groundCheckPoint1: {fileID: 0}
- groundCheckPoint2: {fileID: 0}
+ groundCheckPoint1: {fileID: 8919320861079350896}
+ groundCheckPoint2: {fileID: 1232421260}
invulnTime: 0
- hangTime: 0
+ hangTime: 2
stats:
maxHealth: 0
speedMultiplier: 0
diff --git a/Assets/Scripts/Actors/Enemy.cs b/Assets/Scripts/Actors/Enemy.cs
index d7d699e..600fcaf 100644
--- a/Assets/Scripts/Actors/Enemy.cs
+++ b/Assets/Scripts/Actors/Enemy.cs
@@ -1,5 +1,6 @@
using UnityEngine;
using System.Collections;
+using UnityEngine.InputSystem;
namespace MontanaJohns.Actors
{
@@ -10,12 +11,18 @@ namespace MontanaJohns.Actors
protected float attackRate = 0.5f;
protected float nextAttackTime = 0f;
- bool playerSeen;
+ private bool playerSeen;
+ private PlayerInput playerInput;
+ private InputAction jump;
protected override void Awake()
{
base.Awake();
player = GameObject.FindGameObjectWithTag("Player");
+ playerInput = player.GetComponent<PlayerInput>();
+
+ jump = playerInput.currentActionMap.FindAction("Jump");
+ jump.started += context => Jump();
}
// Update is called once per frame
@@ -59,6 +66,24 @@ namespace MontanaJohns.Actors
}
}
+ public override void Jump()
+ {
+ if (Physics2D.OverlapCircle(groundCheckPoint1.position, 0.2f, groundLayers) || Physics2D.OverlapCircle(groundCheckPoint2.position, 0.2f, groundLayers))
+ {
+ jumpCount = stats.maxJumps;
+ hangCount = hangTime;
+ }
+ else
+ {
+ hangCount -= Time.deltaTime;
+ }
+ if (jumpCount > 0 && hangCount > 0f)
+ {
+ jumpCount--;
+ _rigidBody.AddForce(Vector2.up * stats.jumpForce);
+ }
+ }
+
private void OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.tag == "Projectile")
diff --git a/Assets/Scripts/Actors/Player.cs b/Assets/Scripts/Actors/Player.cs
index 8535a41..f4edeef 100644
--- a/Assets/Scripts/Actors/Player.cs
+++ b/Assets/Scripts/Actors/Player.cs
@@ -32,7 +32,7 @@ namespace MontanaJohns.Actors
jump.started += context => Jump();
use.started += context => Use();
- attack.started += context => Fire();
+ //attack.started += context => Fire();
cancel.started += context => Cancel();
}
diff --git a/Assets/Scripts/Cursor.cs b/Assets/Scripts/Cursor.cs
index 43b0ea6..be46246 100644
--- a/Assets/Scripts/Cursor.cs
+++ b/Assets/Scripts/Cursor.cs
@@ -8,17 +8,24 @@ public class Cursor : MonoBehaviour
[SerializeField] private Texture2D cursorTexture;
[SerializeField] private float disableDistance = 20f;
- private CursorMode cursorMode = CursorMode.Auto;
private Vector2 hotSpot = Vector2.zero;
// Update is called once per frame
- void Update()
+ private void Update()
{
Vector2 mousePos = Camera.main.ScreenToWorldPoint(Mouse.current.position.ReadValue());
float distance = Vector2.Distance(mousePos, gameObject.transform.position);
if (distance > disableDistance)
- UnityEngine.Cursor.SetCursor(cursorTexture, hotSpot, cursorMode);
+ SetCursor(cursorTexture, hotSpot);
else
- UnityEngine.Cursor.SetCursor(null, Vector2.zero, cursorMode);
+ SetCursor(null, hotSpot);
+ }
+
+ private void SetCursor(Texture2D cursorTexture, Vector2 hotSpot)
+ {
+ if(Application.platform == RuntimePlatform.WebGLPlayer)
+ UnityEngine.Cursor.SetCursor(cursorTexture, hotSpot, CursorMode.ForceSoftware);
+ else
+ UnityEngine.Cursor.SetCursor(cursorTexture, hotSpot, CursorMode.Auto);
}
}
diff --git a/Assets/Scripts/Items/Whip.cs b/Assets/Scripts/Items/Whip.cs
index b482f8d..5e33043 100644
--- a/Assets/Scripts/Items/Whip.cs
+++ b/Assets/Scripts/Items/Whip.cs
@@ -50,6 +50,10 @@ namespace MontanaJohns.Items
StartCoroutine(WhipSmack(collisionGameObject));
}
}
+ else
+ {
+ StartCoroutine(WhipSmack(clickLocation));
+ }
return null;
}
else
@@ -69,5 +73,14 @@ namespace MontanaJohns.Items
Destroy(currentHook);
ropeExists = false;
}
+
+ private IEnumerator WhipSmack(Vector2 location)
+ {
+ currentHook = Instantiate(hookNoSwing, location, Quaternion.identity);
+ FindObjectOfType<AudioManager>().Play("WhipSwoosh");
+ yield return new WaitForSeconds(0.1f);
+ Destroy(currentHook);
+ ropeExists = false;
+ }
}
} \ No newline at end of file
diff --git a/Assets/Scripts/LevelController.cs b/Assets/Scripts/LevelController.cs
index 7113fe8..d79bc3b 100644
--- a/Assets/Scripts/LevelController.cs
+++ b/Assets/Scripts/LevelController.cs
@@ -65,7 +65,6 @@ public class LevelController : MonoBehaviour
{
foreach (GameObject obj in gameObjects)
{
- PrefabUtility.RevertPrefabInstance(obj, InteractionMode.AutomatedAction);
Instantiate(obj);
}
}