public void ThrowStick() { playerSoundManager.PlayBark(); montyStateVariables.GetFetchStick().transform.GetChild(0).GetComponent <SpriteRenderer>().enabled = true; montyStateVariables.playerHasStick = false; montyStateVariables.montyHasStick = false; montyStateVariables.stickThrown = true; montyStateVariables.GetFetchStick().GetComponent <Rigidbody2D>().gravityScale = 1; montyStateVariables.GetFetchStick().GetComponent <Rigidbody2D>().velocity = montyStateVariables.CalculateThrowVelocity(); montyStateVariables.GetFetchStick().GetComponent <Rigidbody2D>().freezeRotation = false; summaryJournal.timesFetchPlayed++; }
private void Update() { if (!inFetch && !inTutorial) { timer += Time.deltaTime; if (!generated) { random = Random.Range(5, 15); generated = true; } if (timer >= random) { generated = false; timer = 0; playerSoundManager.PlayBark(); } if (stateVariables.callRequestMade) { currentState = "move towards"; SwitchState(); } else if (currentState == "move towards" && stateVariables.desintationReached && !stateVariables.isSitting) { currentState = "wait"; SwitchState(); } else if (currentState == "wait") { sitTimer += Time.deltaTime; if (sitTimer > Random.Range(stateVariables.randomWaitRange.x, stateVariables.randomWaitRange.y)) { stateVariables.isSitting = true; currentState = "sit"; SwitchState(); } } else if (stateVariables.distFromPlayer >= stateVariables.distanceToFollow) { currentState = "roam"; SwitchState(); } } else if (inFetch) { currentState = "fetch"; SwitchState(); } else if (inTutorial) { currentState = "launch"; SwitchState(); } if (currentState != "sit") { stateVariables.isSitting = false; } if (currentState != "wait") { sitTimer = 0; } }