protected override void FSMFixedUpdate() { //CurrentState.Reason(playerTransform, transform); //CurrentState.Act(playerTransform, transform); CurrentState.Reason(playerTransform); CurrentState.Act(Fish.transform); }
protected override void OnFixedUpdate() { if (a < 10) { a++; return; } if (AICenter.Ins.MaxIndex < 0) { return; } if (num > AICenter.Ins.MaxIndex) { num = 0; } GameObject TargetPlayer = AICenter.Ins.Getplayer(num); if (TargetPlayer == null) { return; } CurrentState.Reason(TargetPlayer, this); CurrentState.Act(TargetPlayer, this); num++; }
protected override void FSMUpdate() { if (CurrentState != null && isServer) { CurrentState.Reason(); CurrentState.Act(); // If we don't have a target, do nothing if (Target == null) { return; } // If the target is NOT in front of us if (EnemyUtilities.GetAngle(transform, Target) > 1) { // We want to slowly increase out rotation speed multiplier RotationMultiplier = Mathf.Lerp(RotationMultiplier, 2.5f, Time.deltaTime * 0.5f); } else { // Else we are looking at the target RotationMultiplier = Mathf.Lerp(RotationMultiplier, 1f, Time.deltaTime * 0.5f); } // Look at the target float rotSpeed = RotationSpeed * RotationMultiplier; Quaternion neededRotation = Quaternion.LookRotation(Target.position - transform.position, transform.up); transform.rotation = Quaternion.Slerp(transform.rotation, neededRotation, Time.deltaTime * rotSpeed); // Move forward transform.position += transform.forward * MoveSpeed * Time.deltaTime; } }
// Update each frame. protected override void FSMUpdate() { if (CurrentState != null) { CurrentState.Reason(); CurrentState.Act(); } }
protected override void FSMFixedUpdate() { //Do this if (CurrentState != null && !MenuManager.Instance.Sleeping) { CurrentState.Act(); } }
//Update each frame protected override void FSMUpdate() { //Check for health elapsedTime += Time.deltaTime; //Make the AI reason and act based on its current state CurrentState.Reason(playerTransform, transform); CurrentState.Act(playerTransform, transform); }
protected override void FSMFixedUpdate() { _rigidbody.velocity = Vector3.zero; CurrentState.Reason(_playerTransfrom, transform); if (_isFreeze) { return; } CurrentState.Act(_playerTransfrom, transform); }
protected override void FSMUpdate() { if (TargetTrans == null) { return; } CurrentState.Reason(); CurrentState.Act(); }
protected override void FSMFixedUpdate() { CurrentState.Reason(this); CurrentState.Act(this); if (Time.time - lastTime > 0.2f) { NetworkManager.SendUpdatePlayerInfo(transform.position, transform.rotation.eulerAngles, animationManager.AnimStartName); lastTime = Time.time; } }
protected override void FSMUpdate() { elapsedTime += Time.deltaTime; CurrentState.Reason(playerTransform, transform); CurrentState.Act(playerTransform, transform); StateText.text = "AI STATE IS: " + GetStateString(); if (debugDraw) { UsefullFunctions.DebugRay(transform.position, transform.forward * 5.0f, Color.red); } }
/// <summary> /// Call this every time the machine should update. Eg. every frame. /// </summary> /// <param name="deltaTime"></param> public void Update(float deltaTime) { var currentState = CurrentState; if (currentState != null) { currentState.Reason(); // we only want to update the state if it's still the current one if (currentState == CurrentState) { CurrentState.Act(deltaTime); } } }
protected override void FSMFixedUpdate() { //最近玩家 Transform player = GetCloselyPlayer(playerTransform); //玩家死亡 if (player.GetComponent <Player>().Hp == 0) { player = null; } //当前状态进行转换 CurrentState.Reason(player, transform); //在新的状态下ACT CurrentState.Act(player, transform); //更新路点 if (path.IsReach(transform)) { path.NextWaypoint(); } }
protected override void FSMLateUpdate() { CurrentState.Reason(this); CurrentState.Act(this); }
/// <summary> /// 固定帧更新 /// </summary> protected override void UpdateFixedFrame() { CurrentState.Reason(_playerTransfrom, transform); CurrentState.Act(_playerTransfrom, transform); }
protected override void FSMFixedUpdate() { CurrentState.Reason(playerTransform, transform); CurrentState.Act(playerTransform, transform); CurrentState.ActWithoutPlayer(hitTank, transform); }
protected override void FSMFixedUpdate() { animator.SetFloat("Horizontal", Mathf.Abs(Input.GetAxis("Horizontal"))); CurrentState.Reason(playerTransform); CurrentState.Act(Rig, playerTransform, currentSpeed); }
protected override void FSMFixedUpdate() { CurrentState.Reason(enemys, transform); CurrentState.Act(enemys, transform); }
public override void FSMUpdate(float delta) { CurrentState.HandleTransitions(); CurrentState.Act(delta); }
protected override void FixedUpdateFSM() { CurrentState.Reason(playerTransform, transform); CurrentState.Act(playerTransform, transform); }
public void Act() { Health -= 1; CurrentState?.Act(this); }
protected override void FSMFixedUpdate() { CurrentState.Reason(playerTransform, this); CurrentState.Act(playerTransform, this); }
void FixedUpdate() { CurrentState.Reason(PlayerGO, this.gameObject); CurrentState.Act(PlayerGO, this.gameObject); }