private void Awake() { if (Instance != null) { Destroy(gameObject); } Instance = this; }
private void SwitchToBattingPhaseOnHomeBaseTouch() { hUDScript.SetTheBaseString("1"); WorldStateMachine.SetCurrentState(WorldState.BATTING); /* * -Cinemachine shit for batting phase on bases */ }
private void SwitchToBattingPhaseOnBaseTouch(string nextBaseString) { hUDScript.SetTheBaseString(nextBaseString); WorldStateMachine.SetCurrentState(WorldState.BATTING); //TRIGGER UI MANAGER'S TAUNT/BANK/HOLD MENU HERE /* * -Cinemachine shit for batting phase on bases */ }
public void PushThePlayerForwardRealHard(CallbackContext context) { if (context.performed && WorldStateMachine.GetCurrentState() == WorldState.RUNNING) { if (canDash) { canDash = false; StartCoroutine(Dash()); } } }
void Update() { //Yes this is fine to have in update, the script deactivates itself anyway if (WorldStateMachine.GetCurrentState() == WorldState.RUNNING) { rb.constraints = ~RigidbodyConstraints.FreezePositionX & ~RigidbodyConstraints.FreezePositionY & ~RigidbodyConstraints.FreezePositionZ; //inputActions.Player.EnablePlayer.Disable(); //fielderMain.startPeltingLoop(); this.GetComponent <ActivatePlayer>().enabled = false; } }
public void SpawnTheBaseballPrefabAndSendItInTheDirectionThePlayerIsFacing(bool gold, Vector3 mPos) { var myBaseballObject = Instantiate(baseballPrefab); myBaseballObject.transform.position = mPos; myBaseballObject.transform.rotation = Camera.main.transform.rotation; myBaseballObject.transform.position = myBaseballObject.transform.position + new Vector3(0, 0.5f, 1); if (WorldStateMachine.GetCurrentState() == WorldState.BATTING) { WorldStateMachine.SetCurrentState(WorldState.RUNNING); } }
void FixedUpdate() { if (WorldStateMachine.GetCurrentState() != WorldState.FROZEN) { if (useX == true) { POVCam.m_HorizontalAxis.Value += camInput.x * (sensitivity / 3) * Time.deltaTime; } POVCam.m_VerticalAxis.Value -= camInput.y * (sensitivity / 3) / 2.5f * Time.deltaTime; camInput = Vector2.zero; } }
private void FixedUpdate() { switch (WorldStateMachine.GetCurrentState()) { //No input, aiming only case WorldState.BATTING: break; //Full movement case WorldState.RUNNING: float h = movementInput.x; float v = movementInput.y; Vector3 targetInput = new Vector3(h, 0, v); inputDirection = Vector3.Lerp(inputDirection, targetInput, Time.deltaTime * 10f); Vector3 camForward = Camera.main.transform.forward; Vector3 camRight = Camera.main.transform.right; camForward.y = 0f; camRight.y = 0f; Vector3 desiredDirection = camForward * inputDirection.z + camRight * inputDirection.x; if (desiredDirection.magnitude > 1) { desiredDirection.Normalize(); } Move(desiredDirection); Turn(desiredDirection); break; } if (rb.velocity.magnitude <= stoppingSpeed) { rb.velocity = Vector3.zero; currentSpeed = baseSpeed; playerAnimator.SetBool("heMoving", false); } else { playerAnimator.SetBool("heMoving", true); } if (currentSpeed <= topSpeed) { currentSpeed += acceleration * Time.deltaTime; } }
public void PlayerActivation(CallbackContext callbackContext) { //Accepts players first input, enabling the scene if (callbackContext.performed && WorldStateMachine.GetCurrentState() == WorldState.FROZEN) { WorldStateMachine.SetCurrentState(WorldState.BATTING); } //Call the coroutine to activate player only when you're NOT watching the dolly and when you're locked if (callbackContext.performed && WorldStateMachine.GetCurrentState() == WorldState.BATTING && !DeactiveateCamera.dollyActive) { //StartCoroutine(TimeSlowOnHit()); } }
public Selection(WorldStateMachine sm) : base(sm) { tablet = GameObject.Find("Canvas").transform.FindChild("Tablet").gameObject; lookTablet = Camera.main.transform.forward; lookBlackboard = GameObject.Find("Aula_props").transform.FindChild("LIM").FindChild("LOOKAT"); }
public Temp(WorldStateMachine sm) : base(sm) { lookTablet = Camera.main.transform.forward; }
public WorldState(WorldStateMachine sm) { this.SM = sm; }
public Final(WorldStateMachine sm) : base(sm) { question = GameObject.Find("Canvas").transform.FindChild("Question").gameObject; question.SetActive(false); }
public Idle(WorldStateMachine sm) : base(sm) { }
public RollCall(WorldStateMachine sm) : base(sm) { uiTablet = GameObject.Find("Canvas").transform.FindChild("Tablet").gameObject; }