Exemplo n.º 1
0
 public void PickedUpByPlayer(MonoBehaviour ourObject)
 {
     heldStatus = HeldStatuses.Carried;
     inSconce   = false;
     if (ourObject.GetComponent <Sconce>() != null)
     {
         previousSconce = currentSconce;
         currentSconce  = null;
     }
     instabilityStatus = InstabilityStatus.FreshPickedUp;
     StartCoroutine(MoveUs(transform.position, GameHandler.fatherOrbHoldTransform.position, GameHandler.player));
     transform.parent = player.transform;
     //posOffset = transform.localPosition;
     if (PickedUp != null)
     {
         PickedUp(this);
     }
     StartCoroutine(BeingCarried());
 }
Exemplo n.º 2
0
    public IEnumerator BeingCarried()
    {
        //this coroutine handles the orb being carried by the player
        carriedOrChanneled = true;
        heldStartTime      = Time.time;

        while (elapsedTime < durationHeld)
        {
            FloatMe();


            if (timeRefreshed)
            {
                //if something triggered the time to refresh, like the "memory" that has this function
                elapsedTime       = 0;
                instabilityStatus = InstabilityStatus.FreshPickedUp;
                OrbRefreshedWrapper();
                timeRefreshed = false;
            }
            if (inSconce)
            {
                //if the player places the orb in a sconce, reset and break free
                elapsedTime = 0;
                yield break;
            }
            if (cancelCarryCoroutineEarly)
            {
                //if the coroutine was cancelled early, like by the function that allows the player to return to a previous sconce
                elapsedTime = 0;
                yield break;
            }

            if (elapsedTime >= durationBeforeFizzing && instabilityStatus != InstabilityStatus.Fizzing)
            {
                instabilityStatus = InstabilityStatus.Fizzing;
                OrbFizzing();
            }
            if (elapsedTime >= durationBeforeRedHot && instabilityStatus != InstabilityStatus.RedHot)
            {
                instabilityStatus = InstabilityStatus.RedHot;
                OrbRedHot();
            }
            if (elapsedTime >= durationBeforeCritical && instabilityStatus != InstabilityStatus._Critical)
            {
                instabilityStatus = InstabilityStatus._Critical;
                OrbCritical();
            }
            if (!movingToObject)
            {
                //we want to pause the timer while the object is being moved from a sconce or to a memory

                elapsedTime += Time.deltaTime;
            }
            yield return(null);
        }
        elapsedTime        = 0;
        carriedOrChanneled = false;
        if (heldStatus == HeldStatuses.Carried)
        {
            //if the player was carrying the orb when time ran out
            OrbOverheated();
        }
        else if (heldStatus == HeldStatuses.Channeled)
        {
            //if the player was channeling the orb when time ran out
            //OrbScreamWrapper();
        }
    }