branch from homebase, icebolt collision issues

This commit is contained in:
joonasp
2022-04-11 13:58:13 +03:00
parent 6f7c3eaa9b
commit f7734432cc
17 changed files with 39785 additions and 373 deletions

View File

@@ -12,6 +12,8 @@ public class ActionGestureInteraction : MonoBehaviour
private GameObject player;
public float projectileSpeed = 30;
private bool holdingWand;
void Start()
{
player = gameObject;
@@ -19,8 +21,61 @@ public class ActionGestureInteraction : MonoBehaviour
public void PerformAction(string action)
{
Debug.Log(action);
if (action == "Portal")
Debug.LogWarning(action);
if (player.GetComponent<PlayerInfo>().GetRightHand() != null)
{
Debug.LogWarning(player.GetComponent<PlayerInfo>().GetRightHand().name);
if (player.GetComponent<PlayerInfo>().GetRightHand().name.Equals("wand")) holdingWand = true;
}
switch (action)
{
case "HorizontalLine":
if (holdingWand)
{
Debug.LogWarning("CAST BOLT");
ShootProjectile();
InstantiateIceBolt(objects[0]);
}
else
{
Debug.LogWarning("WOODCUTTING ACTION");
}
return;
case "VerticalLine":
if (holdingWand)
{
Debug.LogWarning("WAND VERTICAL");
}
else
{
Debug.LogWarning("VERTICAL");
}
return;
case "Circle":
if (holdingWand)
{
Debug.LogWarning("WAND CIRCLE");
}
else
{
Debug.LogWarning("CIRCLE");
}
return;
case "Triangle":
if (holdingWand)
{
Debug.LogWarning("WAND TRIANGLE");
}
else
{
Debug.LogWarning("WOODCUTTING ACTION");
}
return;
}
/*if (action == "Portal")
{
// Raycast to find portal were looking at.
var nearestPortal = FindPortalInFront();
@@ -41,7 +96,7 @@ public class ActionGestureInteraction : MonoBehaviour
// Make ice wall appear from below to block incoming projectiles
}
}
}
} */
}
void EnableDisablePortal(GameObject portal)
{
@@ -104,6 +159,7 @@ public class ActionGestureInteraction : MonoBehaviour
void InstantiateIceBolt(GameObject item)
{
Debug.LogWarning("INSTANTIATE BOLT");
var projectileObj = Instantiate(item, rightHandTransform.position, playerCamera.transform.rotation) as GameObject;
projectileObj.GetComponent<Rigidbody>().velocity = (destination - rightHandTransform.position).normalized * projectileSpeed;
}