Hello!
I am new to Game design, and currently, I am working on a Unity 2D game that has elemental aspects for the enemies as well as the player’s attacks(bullets).
so far i’ve made the shooting script and added switch weapon function but i am not sure how to approach adding damage to the different bullets and making the enemies taking damage depending on their elements and the player’s bullets.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Shooting : MonoBehaviour
{
public GameObject[] bullets;
private float shootingDelay = 0.35f;
private float cooldownTimer = 0.5f;
public int currentBullet = 0;
void Update()
{
if (Input.GetKeyDown(KeyCode.X))
{
++currentBullet;
if (currentBullet+1 > bullets.Length)
{
currentBullet = 0;
}
}
cooldownTimer -= Time.deltaTime;
if (Input.GetButton("Fire1") && cooldownTimer <= 0)
{
cooldownTimer = ShootingDelay;
Debug.Log("Pew!");
Instantiate(bullets[currentBullet], transform.position, transform.rotation);
}
}
}
Thanks in Advance, Any and every bit of help/advice would be appreciated, or any way to set me on the right path to tackle this.