seem to not be able to keep the fire on the crate the fire spawns but is offset sometime?
also is there a way to lock the crate for x amount of time?
also is there a way to lock the crate for x amount of time?
private void SpawnLoot(int amount, BaseEntity EntitySpawn)
{
if (amount == 0)
return;
for (int j = 0; j < amount; j++)
{
Vector3 randsphere = UnityEngine.Random.onUnitSphere;
Vector3 entpos = (EntitySpawn.transform.position + new Vector3(0f, 1.5f, 0f)) + (randsphere * UnityEngine.Random.Range(-2f, 3f));
var ent = crates;
BaseEntity crate = GameManager.server.CreateEntity(ent, entpos, Quaternion.LookRotation(randsphere), true);
crate.Spawn();
Rigidbody rigidbody;
rigidbody = crate.gameObject.AddComponent<Rigidbody>();
FireBall fireBall = GameManager.server.CreateEntity(fireball) as FireBall;
//SpawnFireball(crate);
if (rigidbody != null)
{
rigidbody.isKinematic = false;
rigidbody.useGravity = true;
rigidbody.mass = 0.55f;
rigidbody.interpolation = RigidbodyInterpolation.Interpolate;
rigidbody.drag = 0.25f;
rigidbody.angularDrag = 0.1f;
rigidbody.AddForce((EntitySpawn.transform.forward + (EntitySpawn.transform.right * UnityEngine.Random.Range(-5f, 5f))) * 50);
Puts("Calling for fireballs.");
fireBall.Spawn();
fireBall.SetParent(crate);
fireBall.GetComponent<Rigidbody>().isKinematic = true;
fireBall.GetComponent<Collider>().enabled = false;
fireBall.Invoke(fireBall.Extinguish, 120);
}
}
}