コード例 #1
0
 private void Awake()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
     }
     Instance = this;
 }
コード例 #2
0
    private void SwitchToBattingPhaseOnHomeBaseTouch()
    {
        hUDScript.SetTheBaseString("1");
        WorldStateMachine.SetCurrentState(WorldState.BATTING);


        /*
         *  -Cinemachine shit for batting phase on bases
         */
    }
コード例 #3
0
    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
         */
    }
コード例 #4
0
 public void PushThePlayerForwardRealHard(CallbackContext context)
 {
     if (context.performed && WorldStateMachine.GetCurrentState() == WorldState.RUNNING)
     {
         if (canDash)
         {
             canDash = false;
             StartCoroutine(Dash());
         }
     }
 }
コード例 #5
0
    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;
        }
    }
コード例 #6
0
    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);
        }
    }
コード例 #7
0
    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;
        }
    }
コード例 #8
0
    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;
        }
    }
コード例 #9
0
    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());
        }
    }
コード例 #10
0
 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");
 }
コード例 #11
0
 public Temp(WorldStateMachine sm) : base(sm)
 {
     lookTablet = Camera.main.transform.forward;
 }
コード例 #12
0
 public WorldState(WorldStateMachine sm)
 {
     this.SM = sm;
 }
コード例 #13
0
 public Final(WorldStateMachine sm) : base(sm)
 {
     question = GameObject.Find("Canvas").transform.FindChild("Question").gameObject;
     question.SetActive(false);
 }
コード例 #14
0
 public Idle(WorldStateMachine sm) : base(sm)
 {
 }
コード例 #15
0
 public RollCall(WorldStateMachine sm) : base(sm)
 {
     uiTablet = GameObject.Find("Canvas").transform.FindChild("Tablet").gameObject;
 }