Okay so im new to c# and functions and such. I only have one error “error cs1501 no overload for method ‘onCollisionEnter’ takes ‘0’ arguments” and i know that this is probably simple but could someone help?
using UnityEngine;
using System.Collections;
using System.Linq;
public class shooting : MonoBehaviour {
public GameObject bullet;
float bulletImpulse = 75f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetButtonDown("Fire1")){
Camera cam = Camera.main;
GameObject theBullet = (GameObject)Instantiate(bullet, transform.position + cam.transform.forward, transform.rotation);
theBullet.rigidbody.AddForce(cam.transform.forward * bulletImpulse, ForceMode.Impulse);
OnCollisionEnter();
}
}
float dmg = 20;
void OnCollisionEnter(Collider hit){
if(hit.tag == "enemy"){
hit.transform.SendMessage("Damage",dmg);
}
}
}
That is my shooting.cs script thats on my player and here is my enemy logic script.
using UnityEngine;
using System.Collections;
public class enemyLogic : MonoBehaviour {
float health = 90;
void Damage(float dmg){
health -= dmg;
}
void Update (){
if(health <=0){
Destroy(gameObject);
}
}
}