protected override void UpdateFollowState() { #region Action MoveControl.Move(PlayerTarget.position); MoveControl.LookAt(PlayerTarget.position); aniControlBoss.SpeedPercent = MoveControl.Magnitude / 2; #endregion #region Transtions float pointDistance = Distance(MonitoringPoint.position, transform.position); if (pointDistance > RadiusLimitMonitoringPoint) { // Personagem muito longe do ponto de origem // EnterState(TypeStateCharacter.Back); return; } float playerDistance = Distance(PlayerTarget.position, transform.position); if (playerDistance > RadiusPlayerDistance) { // Detectou o jogador // EnterState(TypeStateCharacter.Back); return; } if (playerDistance <= RadiusAttack) { // Detectou o jogador e está em área de ataque // //EnterState(TypeStateCharacter.Attack); AttacksVerification(); return; } #endregion }
// Update is called once per frame void Update() { GetInputs(); //if (inputTimeIncrease > 0) //{ // timeScale += inputTimeIncrease * 0.01f; //} //else if (inputTimeDecrease > 0 && !isCooldown) { timer -= Time.deltaTime; ui.Cooldown = timer / timerLimit; timeSense.gameObject.SetActive(true); if (timer <= 0) { timer = 0; ui.Cooldown = 0; isCooldown = true; } } else { if (!isCooldown && !isCooldownControl) { isCooldown = true; } timer += Time.deltaTime; ui.Cooldown = timer / timerLimit; timeSense.gameObject.SetActive(false); if (timer > timerLimit) { timer = timerLimit; isCooldown = false; } } if (inputShoot) { weapon.efetuarDisparo(); } moveControl.Jump(inputJump); moveControl.Move(inputForward, inputTurn, inputRotationY, inputRun); if (Input.GetKey(KeyCode.Q)) { //Fire(); } }
// Update is called once per frame void Update() { GetInputs(); moveControl.Move(inputForward, inputTurn); // Debug // if (IsDebug) { if (hitBox != null) { hitBox.enabled = IsDebug; } } }
protected override void UpdateBackState() { #region Action MoveControl.Move(MonitoringPoint.position); MoveControl.LookAt(MonitoringPoint.position); aniControlBoss.SpeedPercent = MoveControl.Magnitude / 2; #endregion #region Transtions float pointDistance = Distance(MonitoringPoint.position, transform.position); //Debug.Log("pointDistance: " + pointDistance); if (pointDistance <= RadiusMonitoringPoint) { // Chegou a ponto de origem // // radiusMonitoringPoint precisa ser igual ao navAgent.StoppingDistance // EnterState(TypeStateCharacter.Move); return; } #endregion }
protected override void UpdateSpecialAttack1MidState() { #region Action Old //// Olhar para o player // //MoveControl.Move(PlayerTarget.position); //MoveControl.LookAt(PlayerTarget.position); //aniControlBoss.SpeedPercent = MoveControl.Magnitude / 2; #endregion #region Transtions Old //timer += Time.deltaTime; //if (timer >= 5) //{ // timer = 0; // EnterState(TypeStateCharacter.SpecialAttack1End); // return; //} // Enter // #endregion #region Action MoveControl.Move(ListWayPoints[ActualWp].position); MoveControl.LookAt(ListWayPoints[ActualWp].position); //aniControlBoss.SpeedPercent = MoveControl.Magnitude / 2; #endregion #region Transtions //float playerDistance = Distance(playerTarget.position, transform.position); //if (playerDistance <= radiusPlayerDistance) //{ // // Detectou o jogador // // EnterState(TypeStateCharacter.Follow); // return; //} float pointDistance = Distance(ListWayPoints[ActualWp].position, transform.position); if (pointDistance <= RadiusMonitoringPoint) { // Chegou no destino // //EnterState(TypeStateCharacter.Move); //return; if (ActualWp + 1 >= ListWayPoints.Count) { ActualWp = 0; } else { ActualWp++; } if (!isStartPointAttack) { if (ListWayPoints[ActualWp].position.Equals(startPointAttack.position)) { isStartPointAttack = true; } } else { if (ListWayPoints[ActualWp].position.Equals(startPointAttack.position)) { EnterState(TypeStateCharacter.SpecialAttack1End); } } } #endregion // Leave // //ActualWp++; //if (ActualWp >= ListWayPoints.Count) //{ // ActualWp = 0; // if (!IsPatrolStart) // IsPatrolCompleted = true; //} }