public void BassOn() { _bassState = BassState.On; }
public void BassOff() { _bassState = BassState.Off; }
public void ChangeState(BassState state) { Debug.Log("ChangeState" + bassState.ToString() + " →" + state.ToString()); switch (state) { case BassState.Result: GameController.Instance.ChangeStateTo(GameMode.Result); break; case BassState.Stay: if (bassState == BassState.Back) { VisibleBass(false); isAttentioned = false; CreateTerritory(parameters.range); useObstacleAvoidance = false; delayEvery = 0.0f; //start at still SetMinMaxSpeed(0.01f, 0.03f, 2.0f, 5.0f); isReachedMovePosition = true; //dont use delayStill delayStill = Random.Range(2.0f, 6.0f); //dont use delatReached delayReached = 0.0f; //set offset to float up down positionOffset = GetRandomFloatingPosition(); howLongToDetectReached = (Constants.BassBihaviour.posOffsetWhenScaleOne * transform.lossyScale.x) / 2.0f; } else { Debug.Log("Inpossible State Change"); return; } break; case BassState.Chase: if (bassState == BassState.Stay) { GameController.Instance.BassIsChasing(true, gameObject.transform); SetMinMaxSpeed(0.05f, 0.1f, 7.0f, 20.0f); prevMove = LureController.Instance.appeal.moveState; howLongToDetectReached = Random.Range(Constants.BassBihaviour.minDistanceWhenChaseScaleOne, Constants.BassBihaviour.maxDistanceWhenChaseScaleOne) * transform.lossyScale.x; GetNewPoint(LureController.Instance.gameObject.transform.position, true, true, 0.0f, 4.0f, 0.0f); ZeroElapsedTime(); delayReached = 0.5f; isUpState = IsUpstate(true); SetChusenKakuritu(); keikaTime = 0.0f; isJustReeling = true; } else { Debug.Log("Inpossible State Change"); return; } break; case BassState.Bite: if (bassState != BassState.Stay && bassState != BassState.Chase && bassState != BassState.Bite) { Debug.Log("Inpossible State Change"); return; } else { GameController.Instance.BassIsChasing(true, gameObject.transform); SetMinMaxSpeed(0.05f, 0.1f, 7.0f, 20.0f); howLongToDetectReached = transform.lossyScale.x; GetNewPoint(LureController.Instance.gameObject.transform.position, true, true, 0.0f, 4.0f, 0.0f); ZeroElapsedTime(); delayReached = 0.0f; delayEvery = 20.0f; } break; case BassState.Fight: if (bassState != BassState.Bite) { Debug.Log("Inpossible State Change"); return; } else { SetMinMaxSpeed(0.05f, 0.1f, 7.0f, 20.0f); isJumping = false; stamina2 = parameters.stamina; delayEvery = 0.0f; //animator.SetTrigger("bite"); if (LureController.Instance.mover.IsOnSuimen()) { WaterController.Instance.SplashAt(transform.position, transform.localScale.x); AudioController.Play("bite"); isReachedMovePosition = false; fightState = FightState.Tukkomi; } else { if (parameters.KASSEILEVEL > 0.3f) { if (Random.value <= parameters.KASSEILEVEL) { if (Random.value < 0.5f) { anime.OneShotAnime("SwimReturnBack"); } else { isReachedMovePosition = false; fightState = FightState.Tukkomi; } } else { isReachedMovePosition = false; fightState = FightState.NotFoocked; } } else { isReachedMovePosition = false; fightState = FightState.NotFoocked; } } delayReached = 1.0f; if (transform.localScale.x > 1.0f) { dragPower = 0.01f; } else { dragPower = 0.01f + ((1.0f - transform.localScale.x) * 0.04f); } anime.OneShotAnime("bite"); delayStill = 0.5f; GameController.Instance.ChangeStateTo(GameMode.Fight); LureController.Instance.gameObject.SetActive(false); LureController.Instance.gameObject.transform.parent = rureFoockPosition; LureController.Instance.gameObject.transform.localPosition = Vector3.zero; } break; case BassState.Back: if (bassState == BassState.Stay || bassState == BassState.Back) { Debug.Log("Inpossible State Change"); return; } else { howLongToDetectReached = (Constants.BassBihaviour.posOffsetWhenScaleOne * transform.lossyScale.x) / 2.0f; delayReached = 0.0f; delayStill = 0.0f; delayEvery = 10.0f; useObstacleAvoidance = false; GetNewPoint(parameters.spawnedPosiion, true, true, Random.Range(0.3f, 0.5f), 4.0f, 0.0f); } break; } if (timeEvery != 0.0f) { timeEvery = 0.0f; } ZeroElapsedTime(); bassState = state; }