예제 #1
0
 /**
  *  Enable this item- should be called when an item
  *  is unequipped. This will re-enable the BoxCollider2D
  *  and RigiBody2D components. Will set it's parent to
  *  null, and Active to false (so it won't render)
  *
  *  @param EquipmentItem item The item
  **/
 private void EnableItem(EquipmentItem item)
 {
     item.transform.parent = null;
     item.gameObject.SetActive(false);
     item.GetComponent <BoxCollider2D>().enabled   = true;
     item.GetComponent <Rigidbody2D>().isKinematic = false;
 }
예제 #2
0
 /**
  *  Disable this item- should be called when an item is
  *  equipped. This will disable the BoxCollider2D and
  *  RigidBody2D components. It will set the item to Active
  *  and it's parent to the equipment container- as well as
  *  setting it's localPosition to Vector3.zero, relying on
  *  the position of the item in the spritesheet
  *
  *  @param EquipmentItem item The item
  **/
 private void DisableItem(EquipmentItem item)
 {
     item.gameObject.SetActive(true);
     item.gameObject.transform.parent              = equipmentContainer.transform;
     item.transform.localPosition                  = Vector3.zero;
     item.GetComponent <BoxCollider2D>().enabled   = false;
     item.GetComponent <Rigidbody2D>().isKinematic = true;
 }