essence add to playerinfo
This commit is contained in:
@@ -28,6 +28,7 @@ public class ActionGestureInteraction : MonoBehaviour
|
||||
Debug.LogWarning(player.GetComponent<PlayerInfo>().GetRightHand().name);
|
||||
if (player.GetComponent<PlayerInfo>().GetRightHand().name.Equals("wand")) holdingWand = true;
|
||||
}
|
||||
else holdingWand = false;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
@@ -56,7 +57,8 @@ public class ActionGestureInteraction : MonoBehaviour
|
||||
case "Circle":
|
||||
if (holdingWand)
|
||||
{
|
||||
Debug.LogWarning("WAND CIRCLE");
|
||||
Debug.LogWarning("Arcing fireball");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -98,7 +100,7 @@ public class ActionGestureInteraction : MonoBehaviour
|
||||
}
|
||||
} */
|
||||
}
|
||||
void EnableDisablePortal(GameObject portal)
|
||||
void MinigameEnable(GameObject portal)
|
||||
{
|
||||
// Did the raycast catch a portal in front of us?
|
||||
if (portal != null)
|
||||
@@ -125,7 +127,7 @@ public class ActionGestureInteraction : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
GameObject FindPortalInFront()
|
||||
GameObject FindMinigame()
|
||||
{
|
||||
Ray ray = playerCamera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
|
||||
RaycastHit hit;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class PortalTeleporter : MonoBehaviour
|
||||
Debug.Log(_enabled);
|
||||
if (_portalCanBeUsed && !_justUsed && _enabled)
|
||||
{
|
||||
if (other.name.StartsWith("Holster") || other.tag.Contains(""))
|
||||
if (other.name.StartsWith("Holster") || other.tag.Contains("Holster"))
|
||||
{
|
||||
Debug.Log("holster");
|
||||
}
|
||||
|
||||
@@ -11,7 +11,10 @@ public class EssenceNodeController : MonoBehaviour
|
||||
|
||||
public bool isTouched;
|
||||
private bool followPlayer = false;
|
||||
private Transform player;
|
||||
private Transform playerCamera;
|
||||
|
||||
[SerializeField]
|
||||
private PlayerInfo playerInfo;
|
||||
|
||||
private float timer;
|
||||
private Material nodeMaterial;
|
||||
@@ -21,6 +24,7 @@ public class EssenceNodeController : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
nodeMaterial = GetComponent<Renderer>().material;
|
||||
playerInfo = PlayerInfo.Instance;
|
||||
}
|
||||
|
||||
public void Touched()
|
||||
@@ -37,7 +41,7 @@ public class EssenceNodeController : MonoBehaviour
|
||||
public void FollowPlayer()
|
||||
{
|
||||
followPlayer = true;
|
||||
player = GameObject.FindGameObjectWithTag("MainCamera").transform;
|
||||
playerCamera = GameObject.FindGameObjectWithTag("MainCamera").transform;
|
||||
StartCoroutine(Collect());
|
||||
|
||||
}
|
||||
@@ -56,8 +60,8 @@ public class EssenceNodeController : MonoBehaviour
|
||||
|
||||
IEnumerator Collect()
|
||||
{
|
||||
playerInfo.AddEssenceBasic(1);
|
||||
yield return new WaitForSeconds(2f);
|
||||
//TODO: Update value in player inventory
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
@@ -76,7 +80,7 @@ public class EssenceNodeController : MonoBehaviour
|
||||
|
||||
if (followPlayer)
|
||||
{
|
||||
transform.position = Vector3.Lerp(transform.position, new Vector3(player.position.x,player.position.y - 0.5f, player.position.z), Time.deltaTime);
|
||||
transform.position = Vector3.Lerp(transform.position, new Vector3(playerCamera.position.x, playerCamera.position.y - 0.5f, playerCamera.position.z), Time.deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ using UnityEngine;
|
||||
|
||||
public class PlayerInfo : MonoBehaviour
|
||||
{
|
||||
public static PlayerInfo Instance;
|
||||
|
||||
private int health;
|
||||
|
||||
private int essence_basic;
|
||||
@@ -13,6 +15,7 @@ public class PlayerInfo : MonoBehaviour
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
health = 5;
|
||||
essence_basic = 0;
|
||||
rightHandHeld = null;
|
||||
|
||||
Reference in New Issue
Block a user