Exemplo n.º 1
0
    public override void Tick()
    {
        base.Tick();

        if (currentCorpse != null)
        {
            currentCorpse.AdvanceDecay();

            if (currentCorpse.DecayLevel == EDecayLevel.WellDone)
            {
                //AudioManager.Instance.PlayVoiceLine(AudioManager.);
                AudioManager.Instance.PlayVoiceLine(AudioManager.Instance.ClipsNonViable[UnityEngine.Random.Range(0, AudioManager.Instance.ClipsNonViable.Count)]);
                DropCorpse();
            }
        }

        StreetSpriteSort sordo = GetComponent <StreetSpriteSort>();

        if (sordo != null)
        {
            IInteractable closestInteractable = EntityManager.Instance.GetClosestInteractableWithinRange(gameObject.transform.position, sordo.street);
            if (CurrentClosestInteractable != closestInteractable)
            {
                CurrentActionProgress = 0.0f;
                HUD.Instance.SetProgressBarProgress(0.0f);
            }
            CurrentClosestInteractable = closestInteractable;
        }
        else
        {
            CurrentClosestInteractable = null;
        }

        if (CurrentClosestInteractable != null)
        {
            TooltipRenderer.sprite = CurrentClosestInteractable.GetInteractIcon();
        }
        else
        {
            TooltipRenderer.sprite = null;
        }


        // if (CurrentClosestInteractable != closestInteractable && closestInteractable != null)
        // {
        //     Debug.Log("Player is near interactable: " + closestInteractable);
        // }
    }