branch from homebase, icebolt collision issues
This commit is contained in:
@@ -157,12 +157,12 @@ MonoBehaviour:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3757395767074346460}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ee8103568a01d804d89cb1fc1dff91eb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
particles: {fileID: 8844865646353305354}
|
||||
particles: {fileID: 0}
|
||||
flySpeed: 10
|
||||
testForce: 1000
|
||||
--- !u!114 &3757395767037568670
|
||||
@@ -379,9 +379,3 @@ Transform:
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 6456652935746308080}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!198 &8844865646353305354 stripped
|
||||
ParticleSystem:
|
||||
m_CorrespondingSourceObject: {fileID: 2532683062447540474, guid: 16595acc1c95e1843870f6d5ed6b3ad8,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 6456652935746308080}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
70
Assets/Project Files/Scripts/JoonasP/PlayerInfo.cs
Normal file
70
Assets/Project Files/Scripts/JoonasP/PlayerInfo.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerInfo : MonoBehaviour
|
||||
{
|
||||
private int health;
|
||||
|
||||
private int essence_basic;
|
||||
|
||||
private GameObject rightHandHeld;
|
||||
private GameObject leftHandHeld;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
health = 5;
|
||||
essence_basic = 0;
|
||||
rightHandHeld = null;
|
||||
leftHandHeld = null;
|
||||
}
|
||||
|
||||
public void AddHealth(int value)
|
||||
{
|
||||
health += value;
|
||||
if (health <= 0)
|
||||
{
|
||||
Debug.Log("NO HEALTH REAMINING");
|
||||
}
|
||||
}
|
||||
|
||||
public void AddEssenceBasic(int value)
|
||||
{
|
||||
if (essence_basic + value < 0)
|
||||
{
|
||||
Debug.Log("NOT ENOUGH ESSENCE");
|
||||
}
|
||||
else essence_basic += value;
|
||||
}
|
||||
|
||||
public void AddLeftHand(GameObject obj)
|
||||
{
|
||||
leftHandHeld = obj;
|
||||
}
|
||||
|
||||
public void AddRightHand(GameObject obj)
|
||||
{
|
||||
rightHandHeld = obj;
|
||||
}
|
||||
|
||||
public void RemoveLeftHand()
|
||||
{
|
||||
leftHandHeld = null;
|
||||
}
|
||||
|
||||
public void RemoveRightHand()
|
||||
{
|
||||
rightHandHeld = null;
|
||||
}
|
||||
|
||||
public GameObject GetLeftHand()
|
||||
{
|
||||
return leftHandHeld;
|
||||
}
|
||||
|
||||
public GameObject GetRightHand()
|
||||
{
|
||||
return rightHandHeld;
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Project Files/Scripts/JoonasP/PlayerInfo.cs.meta
Normal file
11
Assets/Project Files/Scripts/JoonasP/PlayerInfo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51150922d2ca8cc44b6fc27d9365a8d4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user