public void ShowPotentialItem(GameObject item) { PowerupMain main = item.GetComponent <PowerupMain>(); PowerupAttachable attach = item.GetComponent <PowerupAttachable>(); StatPack pack = item.GetComponent <PowerupStats>().GetPack(); PowerupAttachable otherItem; StatPack otherPack; if (main.IsEquipped()) { return; } if (attach.isWeapon) { otherItem = controller.GetCar().GetComponent <PowerupManager>().GetWeapon(attach.weaponLocation); damageSliders.ShowPotentialWeapon(attach); } else { otherItem = controller.GetCar().GetComponent <PowerupManager>().GetMod(attach.modLocation); } if (otherItem == null) { otherPack = new StatPack(); } else { otherPack = otherItem.GetComponent <PowerupStats>().GetPack(); } ShowStatBars(pack, otherPack); }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Player" && !attached) { ApplyTo(other.gameObject.GetComponent <PowerupManager>()); } if (attached) { PowerupMain otherPowerup = other.GetComponent <PowerupMain>(); if (otherPowerup != null) { otherPowerup.ApplyTo(appliedManager); } } }