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

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