//what happens when we pick up the object void StartMoving() { if (select.selectedObject.GetComponent <ObjectMovable>() == null) { return; } movingObject = select.selectedObject; movingObject.GetComponent <Collider>().enabled = false; movingObject.GetComponent <ObjectMovable>().isMoving = true; isMoving = true; //if the object can be worn by the avatar, spawn the indicator of where we should put it ObjectWearable wear = movingObject.GetComponent <ObjectWearable>(); if (wear != null) { wear.StartIndicator(); } }
//what happens if we decide to drop the object void StopMoving() { isMoving = false; movingObject.GetComponent <ObjectMovable>().isMoving = false; movingObject.GetComponent <Collider>().enabled = true; movingObject.GetComponent <ObjectMovable>().ResetPlacement(); //if the object is also wearable, do this ObjectWearable wear = movingObject.GetComponent <ObjectWearable>(); if (wear != null) { //if we drop the object in a correct place to equip it if (cast.selectedObjectTransform == wear.ColliderIndicator) { wear.StartWearing(); //we start the sequence of equipping the item } else //or { wear.StopIndicator(); //we turn of the indicator } } movingObject = null; }