// Use this for initialization protected override void Start() { exciteBear = (ExciteBear)GameObject.FindObjectOfType(typeof(ExciteBear)); velocity.x = -6f; // Random.Range( -6.5f, -5f ); currentState = HFState.PREPARING; base.Start(); }
public override void JumpUp() { if (onGround) { //gravity*1.25f is a good max float gravMultiplier = .9f; velocity.y = Random.Range(gravity * (.6f - groundHeight * .1f), gravity * (.88f - groundHeight * .1f)); } currentState = HFState.AWAITING_HIGH_FIVE; currentDistFromExciteBear = -1f; }
void HitHighFive(float dist) { // successful high five //Time.timeScale = 0; rotationalVelocity = 720f; exciteBear.rotationalVelocity = -720f; SetSlowDownPercentDirectly(Vector2.zero); exciteBear.SetSlowDownPercentDirectly(Vector2.zero); exciteBear.FoundAHighFiver(); currentState = HFState.SUCCESSFUL_HIGH_FIVE; GetComponent <SpriteRenderer>().color = new Color(0, .92f, 1f); OppositeBear[] allOppositeBears = (OppositeBear[])GameObject.FindObjectsOfType(typeof(OppositeBear)); for (int i = 0; i < allOppositeBears.Length; ++i) { if (allOppositeBears[i].currentState == HFState.AWAITING_HIGH_FIVE || allOppositeBears[i].currentState == HFState.PREPARING) { Vector2 newSlowDownPercent = GameManager.Instance.oppositeBearsBaseMovementPercent; newSlowDownPercent.Scale(new Vector2(.4f, .35f)); allOppositeBears[i].SetSlowDownPercentDirectly(newSlowDownPercent); } } GameManager.Instance.GotHighFive(this); }
public State(HFState state, int start) { HFState = state; StartYear = start; EndYear = -1; }
void MissedHighFive() { GetComponent <SpriteRenderer>().color = Color.red; velocity.y -= gravity; currentState = HFState.MISSED_HIGH_FIVE; }