public void Pickup() { // Get nearest m_CurrentInterectable = GetNearestInterectable(); // Null Check if (!m_CurrentInterectable) { return; } // Already held, check if (m_CurrentInterectable.m_ActiveHand) { m_CurrentInterectable.m_ActiveHand.Drop(); } // Position m_CurrentInterectable.transform.position = transform.position; // Attach Rigidbody targetBody = m_CurrentInterectable.GetComponent <Rigidbody>(); m_Joint.connectedBody = targetBody; // Set active hand m_CurrentInterectable.m_ActiveHand = this; }
private Interacting GetNearestInterectable() { Interacting nearest = null; float minDistance = float.MaxValue; float distance = 0.0f; foreach (Interacting interectable in m_ContactInterectables) { distance = (interectable.transform.position - transform.position).sqrMagnitude; if (distance < minDistance) { minDistance = distance; nearest = interectable; } } return(nearest); }
public void Drop() { // Null check if (!m_CurrentInterectable) { return; } // Apply velocity Rigidbody targetBody = m_CurrentInterectable.GetComponent <Rigidbody>(); targetBody.velocity = m_Pose.GetVelocity(); targetBody.angularVelocity = m_Pose.GetAngularVelocity(); // Detach m_Joint.connectedBody = null; // Clear m_CurrentInterectable.m_ActiveHand = null; m_CurrentInterectable = null; }
/// <summary> /// /// </summary> void Start() { // Atribui o estado inicial caso seja valido. if (initialState == null || initialState.gameObject != gameObject) { Debug.LogError("No initial state."); } else { state = initialState; moving = GetComponent <Moving>(); saberCombat = GetComponent <SaberCombat>(); forceCombat = GetComponent <ForceCombat>(); interacting = GetComponent <Interacting>(); defending = GetComponent <Defending>(); damage = GetComponent <Damage>(); dying = GetComponent <Dying>(); row = GetComponent <Row>(); playerInput = GetComponent <PlayerInput>(); } }
//tested public async Task HandleEvaluationWithMedicalRepAsync(Evaluation ev, Visit visit, Interacting interacting) { var rep = await _medicalRepRepo.GetUserAsyncWithAllHisInfo(ev.Visit.MedicalRepId); //tested if (ev.Type && interacting == Interacting.Add || interacting == Interacting.Modify && ev.Type) { ++rep.LikeCount; } //tested if (!ev.Type && interacting == Interacting.Add || interacting == Interacting.Modify && !ev.Type) { ++rep.DisLikeCount; } //tested if (ev.Type && interacting == Interacting.Delete || interacting == Interacting.Modify && !ev.Type) { --rep.LikeCount; } //tested else if (!ev.Type && interacting == Interacting.Delete || interacting == Interacting.Modify && ev.Type) { --rep.DisLikeCount; } UnActiveRepIfDeserve(visit.MedicalRep); /** * Handle UniqueUsers Count */ var countOfEvaluation = await _evaluationRepo.TimesTheUserEvaluateAnotherUserVisitsAsLikeWithNoTracking( visit.MedicalRepId, ev.EvaluatorId); if ((countOfEvaluation == 0 && (ev.Type && interacting == Interacting.Add)) || (countOfEvaluation == 0 && (ev.Type && interacting == Interacting.Modify))) { rep.UniqueUsers++; } else if ((countOfEvaluation == 1 && (ev.Type && interacting == Interacting.Delete)) || (countOfEvaluation == 1 && (!ev.Type && interacting == Interacting.Modify))) { rep.UniqueUsers--; } }
private void Interacting(Interacting interacting, TouristBrainComponent tourist, MovementComponent movement) { movement.Direction.Value = Vector2.zero; }