public void Initalize(Player owner, ExplosionProperties eProperties, HitProperties hProperties) { if (eProperties == null) { Debug.LogError("Null reference explosion properties"); Destroy(gameObject); } m_Owner = owner; m_Properties = eProperties; m_HitProperties = hProperties; ExplosionBehaviour(); m_IsInitialized = true; }
// Start is called before the first frame update private void Start() { m_ObjectParent = transform.Find("PickupObject"); m_ObjectParent.GetComponent <ItemPickupCollider>().PickupEvent += OnPickup; m_ExplosionObject = Resources.Load("Prefabs/Explosions/PickupExplosion") as GameObject; m_ExplosionProperties = Resources.Load("Properties/Explosions/PickupExplosion") as ExplosionProperties; // Assign the pickup item switch (m_PickupType) { case PickupType.Health: m_PickupItem = new HealthPickup(); break; case PickupType.Weapon: m_PickupItem = new WeaponPickup(); break; default: Debug.LogError("Missing pickup type!"); break; } m_PickupItem.Init(this); // Set the model GameObject pickupModel = m_PickupItem.GetPickupModel(); m_PickupModel = Instantiate(pickupModel, m_ObjectParent); List <Vector3> offsets = m_PickupItem.GetLocalTransformOffset(); m_PickupModel.transform.localPosition = offsets[0]; m_PickupModel.transform.localEulerAngles = offsets[1]; m_PickupModel.transform.localScale = offsets[2]; }
public void SetExplosionProperties(ExplosionProperties value) { explosionProperties = value; }