public class C_Shell : MonoBehaviour
{
public GameObject shellObject;
public float timealive;
public Vector3 velocity;
public Vector3 position;
public Vector3 lastPosition;
public readonly float mass;
public readonly float drag;
public readonly float force;
public readonly float deflectionAngle;
public C_Shell(GameObject _shellObject, ShellConstants _shellConstants, Vector3 _position, Vector3 _velocity)
{
this.shellObject = _shellObject;
this.mass = _shellConstants.mass;
this.drag = _shellConstants.drag;
this.force = _shellConstants.force;
this.deflectionAngle = _shellConstants.deflectionAngle;
this.position = _position;
this.velocity = _velocity;
}
private void Awake()
{
Debug.Log("no way man omg");
}
private void UpdateVelocity()
{
}
private void UpdatePosition()
{
}
public void UpdateObject()
{
this.UpdateVelocity();
this.UpdatePosition();
}
}
public class Shell_Manager : MonoBehaviour
{
public static Shell_Manager instance;
public List<C_Shell> shells;
public float deleteTime = 3.0f;
private void Awake()
{
if (instance == null)
instance = this;
}
private void FixedUpdate()
{
UpdateShells();
}
private void UpdateShells()
{
for (int i = 0; i < shells.Count; i++)
{
if (shells*.timealive >= deleteTime)*
{
Destroy(shells*.shellObject);*
shells.RemoveAt(i);
continue;
}
shells*.timealive += Time.fixedDeltaTime;*
shells*.UpdateObject();*
}
}
// this func is being called too
void Fire_AP(ShellFire shell)
{
Object prefab = AssetDatabase.LoadAssetAtPath(“Assets/Resources/Prefabs/Shell.prefab”, typeof(GameObject));
shells.Add(new C_Shell(Instantiate(prefab, shell.initialPosition, shell.initialAngle) as GameObject, C_AP.constants, shell.initialPosition, shell.initialDirection));
}
}
I dont know why instance of C_Shell doesnt call Awake or any other method in class