wand power value affects spells
This commit is contained in:
@@ -13,6 +13,8 @@ public class ActionGestureInteraction : MonoBehaviour
|
||||
public float projectileSpeed = 30;
|
||||
|
||||
private bool holdingWand;
|
||||
private float wandPower;
|
||||
private string wandElement;
|
||||
|
||||
public AudioSource noEssenceAudio;
|
||||
|
||||
@@ -28,6 +30,7 @@ public class ActionGestureInteraction : MonoBehaviour
|
||||
if (player.GetComponent<PlayerInfo>().GetRightHand() != null)
|
||||
{
|
||||
if (player.GetComponent<PlayerInfo>().GetRightHand().name.StartsWith("wand")) holdingWand = true;
|
||||
wandPower = player.GetComponent<PlayerInfo>().GetRightHand().GetComponent<WandData>().power;
|
||||
}
|
||||
else holdingWand = false;
|
||||
|
||||
@@ -55,6 +58,7 @@ public class ActionGestureInteraction : MonoBehaviour
|
||||
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));
|
||||
shield.GetComponent<ShieldController>().health = 3 * wandPower;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -182,6 +186,7 @@ public class ActionGestureInteraction : MonoBehaviour
|
||||
{
|
||||
Debug.LogWarning("INSTANTIATE BOLT");
|
||||
var projectileObj = Instantiate(item, rightHandTransform.position, playerCamera.transform.rotation) as GameObject;
|
||||
projectileObj.GetComponent<Projectile>().damage = 1 * wandPower;
|
||||
projectileObj.GetComponent<Rigidbody>().velocity = (playerCamera.transform.forward).normalized * projectileSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ public class Projectile : MonoBehaviour
|
||||
private bool collided;
|
||||
Vector3 oldEulerAngles;
|
||||
|
||||
public float damage;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// Will always be destroyed after 10 seconds.
|
||||
@@ -29,7 +31,7 @@ public class Projectile : MonoBehaviour
|
||||
if (collision.gameObject.tag != "IceBolt" && collision.gameObject.tag != "Player" && !collided)
|
||||
{
|
||||
collided = true;
|
||||
if (collision.gameObject.name == "Dummy") Destroy(collision.gameObject); //REPLACE WITH ENEMY TAG CHECK
|
||||
if (collision.gameObject.name == "Dummy") Destroy(collision.gameObject); //REPLACE WITH ENEMY TAG CHECK AND DAMAGE CHECKING
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user