public virtual bool Search(bool quitting = false) { searchProgress += searchSpeed * GameTime.Time.deltaTime; if (searchProgress >= 100) { searchProgress = 0; searching = false; ProgressBar.HideUI(progressBarID); if (!quitting) { jobCanvas.gameObject.SetActive(true); jobCanvas.anim.ReOpen(); } else { JobManager.Instance.QuitJob(); quitting = false; } PlayerAnimationHelper.ResetAnimations(); return(true); } return(false); }
static IEnumerator <float> StartWalking(Vector3 TargetPosition, Action callback) { TargetPosition = new Vector3(TargetPosition.x, TargetPosition.y, 1); Vector3 StartPosition = Player.transform.position; PlayerAnimationHelper.ResetAnimations(); GameLibOfMethods.doingSomething = true; GameLibOfMethods.canInteract = false; GameLibOfMethods.cantMove = true; Player.anim.SetBool("Walking", true); float T = 0; Vector3 temp = Player.transform.position; while (true) { if (!GameTime.Clock.Paused) { T += 0.04f * GameTime.Time.deltaTime / GameTime.Time.fixedDeltaTime; var dif = (TargetPosition - temp).normalized; if (Mathf.Abs(dif.x) < dif.y) { Player.anim.SetFloat("Vertical", dif.y); } else { Player.anim.SetFloat("Horizontal", dif.x); } Player.anim.SetBool("Walking", true); GameLibOfMethods.player.transform.position = Vector3.Lerp(temp, TargetPosition, T); PlayerAnimationHelper.HandlePlayerFacing(); // if our value has reached the total, break out of the loop if (T >= 1) { break; } } yield return(0f); } Player.anim.SetBool("Walking", false); callback?.Invoke(); LastPositionBeforeWalk = StartPosition; }
void Progression(ComputerInteractionModel type) { type.progress += type.speed * GameTime.Time.deltaTime; if (type.progress >= 100) { type.progress = 0; type.currentActive = false; ProgressBar.HideUI(progressBarID); //reward funcion; PlayerAnimationHelper.ResetAnimations(); } }
public override void FinishUsing(bool cancel) { CurrentAction.EndAction(); ResetObjectState(cancel); void ResetAction() { SpriteControler.Instance.ChangeSortingOrder(0); GetComponent <SpriteRenderer>().sortingOrder = 0; } PlayerAnimationHelper.ResetAnimations(); PlayerCommands.WalkBackToLastPosition(ResetAction); PlayerCommands.JumpOff(0, action); void action() => SpriteControler.Instance.ChangeSortingOrder(0); }
public override void FinishUsing(bool cancel) { ResetObjectState(cancel); if (pcFunctions == null) { pcFunctions = FindObjectOfType <HomePCInteractions>(); } pcFunctions.FinishActions(); void ResetAction() { SpriteControler.Instance.ChangeSortingOrder(0); GetComponent <SpriteRenderer>().sortingOrder = 0; } PlayerAnimationHelper.ResetAnimations(); PlayerCommands.WalkBackToLastPosition(ResetAction); GamePauseHandler.UnSubscribeCloseEvent(EscCloseEvent); }
public void InteractWith(GameObject interactableObject) { GameTime.Clock.ResetSpeed(); if (GameTime.Clock.Paused) { return; } Debug.Log("Interacting"); if (!interactableObject) { Debug.LogWarning("InteractWith() called with null parameters."); } else if (interactableObject.GetComponent <IInteractable>() != null) { //henrique - added the option to check if the Interface that displays options in a menu if (interactableObject.gameObject.GetComponent <ImenuInteraction>() != null) { interactableObject.gameObject.GetComponent <ImenuInteraction>().OpenMenu(); } else { PlayerAnimationHelper.ResetAnimations(); var interactable = interactableObject.GetComponent <IInteractable>(); System.Action Interact = interactable.Interact; FindObjectOfType <PathFinding.PlayerPathfinding>().MoveTo(interactable.interactionOptions.PlayerStandPosition, 2, Interact); GameLibOfMethods.doingSomething = true; StartCoroutine(DelayInteractionMenu(interactable, interactable.interactionOptions.PlayerStandPosition, Interact)); } } else if (interactableObject.GetComponent <Item>()) { Inventory.PlaceOnBag(interactableObject.GetComponent <Item>()); } }