branch from homebase, icebolt collision issues
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user