Thanks for the help I appreciate it. I'm new to modding and writing scripts so there is certainly a lot I still have to learn. Anyways I tried your recommendation to inherit the ItemActionAttack. This is what I receive in SDX when i build the mod.
\SDXModding-master\Targets\7DaysToDie\Mods\GodAuger\Scripts\ItemActionAugerRayTest.cs(6,14): error CS0534: 'ItemActionAugerRayTest' does not implement inherited abstract member 'ItemAction.ExecuteAction(ItemActionData, bool)'
ERROR: Failed to compile Mods.dll
ERROR: Task Compile mod scripts failed
I'm not really sure how to fix this, sounds like i have to write some additional code into the script but i dont know how. If anyone could shed some light on this i would greatly appreciate it. I'll provide the code to my project below. I got the basics of it to work in unity but I needed to test some things in the game before building more onto it. I commented the destroy.object out so I could test the debug.log and pull some tags from the game.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ItemActionAugerRayTest : ItemActionAttack
{
private readonly Collider[] overlappers;
private Vector3 hit1vector;
void Start () {
}
void Update()
{
Ray ray = new Ray(transform.position, transform.forward);
Debug.DrawRay(ray.origin, ray.direction, Color.cyan);
if (Input.GetMouseButton(0))
{
RaycastHit Hit1;
if (Physics.Raycast(ray, out Hit1, 10.0f))
{
//Debug.Log(hit1.transform.name);
//Debug.Log(hit1.transform.position);
hit1vector = new Vector3(Hit1.transform.position.x, Hit1.transform.position.y, Hit1.transform.position.z + 5);
Collider[] colliders = GetOverLappers(hit1vector);
for each (Collider hit in colliders)
{
//Debug.Log(gameObject.transform.position);
Debug.Log(hit.GetComponent<Collider>().tag);
// if(hit.GetComponent<Collider>().tag == "Block")
// {
// Destroy(hit.gameObject);
//}
}
}
}
}
Collider[] GetOverLappers(Vector3 hit2)
{
return Physics.OverlapSphere(hit2, 5);
}
void FixedUpdate()
{
}
}
// Update is called once per frame