Wand element crafting. Comments on projectile logic when assigning elements to enemies

This commit is contained in:
joonasp
2022-05-02 11:28:01 +03:00
parent f2db095ab9
commit 9e3bb66973
18 changed files with 1782 additions and 1043 deletions

View File

@@ -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;
}
}

View File

@@ -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);