Пример #1
0
    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;
    }
Пример #2
0
    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);
    }
Пример #3
0
    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;
    }
Пример #4
0
 /// <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--;
            }
        }
Пример #6
0
 private void Interacting(Interacting interacting, TouristBrainComponent tourist, MovementComponent movement)
 {
     movement.Direction.Value = Vector2.zero;
 }