Wand element crafting. Comments on projectile logic when assigning elements to enemies
This commit is contained in:
@@ -35,6 +35,7 @@ public class ActionGestureInteraction : MonoBehaviour
|
||||
{
|
||||
holdingWand = true;
|
||||
wandPower = player.GetComponent<PlayerInfo>().GetRightHand().GetComponent<WandData>().power;
|
||||
wandElement = player.GetComponent<PlayerInfo>().GetRightHand().GetComponent<WandData>().element;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -193,6 +194,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<Projectile>().element = wandElement;
|
||||
projectileObj.GetComponent<Rigidbody>().velocity = (playerCamera.transform.forward).normalized * projectileSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ public class Projectile : MonoBehaviour
|
||||
Vector3 oldEulerAngles;
|
||||
|
||||
public float damage;
|
||||
private string element = null;
|
||||
public string element = null;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -35,6 +35,11 @@ public class Projectile : MonoBehaviour
|
||||
collided = true;
|
||||
if (obj.CompareTag("Slime"))
|
||||
{
|
||||
//Enemy element check!
|
||||
//Null element = damage * 0.75
|
||||
//Weak against enemy element = damage * 0.5
|
||||
// Strong against enemy element = damage * 2
|
||||
|
||||
obj.GetComponent<SlimeAI>().GetHit(Mathf.RoundToInt(damage));
|
||||
}
|
||||
Destroy(gameObject);
|
||||
|
||||
Reference in New Issue
Block a user