shield costs 1 essence, sound played if trying with 0 essence, shield despawns in 5 sec

This commit is contained in:
joonasp
2022-04-18 11:52:14 +03:00
parent ad1a931c41
commit a997c06e99
15 changed files with 1052 additions and 823 deletions

View File

@@ -14,6 +14,8 @@ public class ActionGestureInteraction : MonoBehaviour
private bool holdingWand;
public AudioSource noEssenceAudio;
void Start()
{
player = gameObject;
@@ -48,9 +50,17 @@ public class ActionGestureInteraction : MonoBehaviour
if (holdingWand)
{
Debug.LogWarning("WAND VERTICAL");
Vector3 spawnPoint = transform.position + playerCamera.transform.forward;
spawnPoint = new Vector3(spawnPoint.x, spawnPoint.y + 1, spawnPoint.z);
Instantiate(objects[1], spawnPoint, Quaternion.Euler(-90,playerCamera.transform.eulerAngles.y-180,180));
if (PlayerInfo.Instance.AddEssenceBasic(-1))
{
Vector3 spawnPoint = transform.position + playerCamera.transform.forward;
spawnPoint = new Vector3(spawnPoint.x, spawnPoint.y + 1, spawnPoint.z);
GameObject shield = Instantiate(objects[1], spawnPoint, Quaternion.Euler(-90, playerCamera.transform.eulerAngles.y - 180, 180));
Destroy(shield, 5);
}
else
{
noEssenceAudio.Play();
}
}
else
{