Пример #1
0
 protected override void FSMFixedUpdate()
 {
     //CurrentState.Reason(playerTransform, transform);
     //CurrentState.Act(playerTransform, transform);
     CurrentState.Reason(playerTransform);
     CurrentState.Act(Fish.transform);
 }
Пример #2
0
    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++;
    }
Пример #3
0
    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;
        }
    }
Пример #4
0
 // Update each frame.
 protected override void FSMUpdate()
 {
     if (CurrentState != null)
     {
         CurrentState.Reason();
         CurrentState.Act();
     }
 }
Пример #5
0
 protected override void FSMFixedUpdate()
 {
     //Do this
     if (CurrentState != null && !MenuManager.Instance.Sleeping)
     {
         CurrentState.Act();
     }
 }
Пример #6
0
    //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);
    }
Пример #7
0
 protected override void FSMFixedUpdate()
 {
     _rigidbody.velocity = Vector3.zero;
     CurrentState.Reason(_playerTransfrom, transform);
     if (_isFreeze)
     {
         return;
     }
     CurrentState.Act(_playerTransfrom, transform);
 }
Пример #8
0
    protected override void FSMUpdate()
    {
        if (TargetTrans == null)
        {
            return;
        }

        CurrentState.Reason();
        CurrentState.Act();
    }
Пример #9
0
 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;
     }
 }
Пример #10
0
 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);
     }
 }
Пример #11
0
        /// <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);
                }
            }
        }
Пример #12
0
    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();
        }
    }
Пример #13
0
 protected override void FSMLateUpdate()
 {
     CurrentState.Reason(this);
     CurrentState.Act(this);
 }
Пример #14
0
 /// <summary>
 /// 固定帧更新
 /// </summary>
 protected override void UpdateFixedFrame()
 {
     CurrentState.Reason(_playerTransfrom, transform);
     CurrentState.Act(_playerTransfrom, transform);
 }
Пример #15
0
 protected override void FSMFixedUpdate()
 {
     CurrentState.Reason(playerTransform, transform);
     CurrentState.Act(playerTransform, transform);
     CurrentState.ActWithoutPlayer(hitTank, transform);
 }
Пример #16
0
 protected override void FSMFixedUpdate()
 {
     animator.SetFloat("Horizontal", Mathf.Abs(Input.GetAxis("Horizontal")));
     CurrentState.Reason(playerTransform);
     CurrentState.Act(Rig, playerTransform, currentSpeed);
 }
Пример #17
0
 protected override void FSMFixedUpdate()
 {
     CurrentState.Reason(enemys, transform);
     CurrentState.Act(enemys, transform);
 }
Пример #18
0
 public override void FSMUpdate(float delta)
 {
     CurrentState.HandleTransitions();
     CurrentState.Act(delta);
 }
Пример #19
0
 protected override void FixedUpdateFSM()
 {
     CurrentState.Reason(playerTransform, transform);
     CurrentState.Act(playerTransform, transform);
 }
Пример #20
0
 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);
 }