void SelectObject() { if (!Toolbox.Instance.EqualToHeld(raycastedObj)) { //if the object is already a selected object: if (raycastedSelectable.GetSelected()) { //unselect it selectedObjs.Remove(raycastedObj); raycastedSelectable.OffSelect(); //play deselect sound effect audioSource.clip = deselectClip; audioSource.Play(); } else { FlippableObject flippableRaycastedObj = raycastedReticleObj as FlippableObject; if (flippableRaycastedObj == null) { raycastedSelectable.OnSelect(); } else { if (!(pickUp.heldObject) && flippableRaycastedObj && flippableRaycastedObj.MaxFlipCheck(false)) { selectedObjs.Add(raycastedObj); flippableRaycastedObj.OnSelect(); } } //play the sound effect audioSource.clip = selectClip; audioSource.Play(); } } }
// Use this for initialization void Start() { flippable = GetComponent <FlippableObject>(); actionsOnAction = GetComponent <TakeMultipleActionsOnAction>(); }