Пример #1
0
    void DoFacing()
    {
        Vector3      facingVector = player.transform.position - this.transform.position;
        EntityFacing facing       = Facing.DirectionToFacing(facingVector);

        animator.Play("ArcherWalk" + facing.ToString());
    }
Пример #2
0
    private void PursuePlayer()
    {
//		if (modeTime > pursuitTime)
//		{
//      }

        if (modeTime > pursuitTime)
        {
            Mode = AIMode.Aim;
            //lock in facing
            facing = Facing.DirectionToFacing(Player.Instance.transform.position - this.transform.position);
        }
        else
        {
            destination = FindClosestAlignedDistance(this.transform.position, Player.Instance.transform.position, preferredFireDistance);
            Vector3 movement = destination - this.transform.position;
            float   timedPositioningSpeed = moveSpeed * Time.fixedDeltaTime;
            if (movement.magnitude < timedPositioningSpeed)
            {
                Mode = AIMode.Aim;
                //lock in facing
                facing = Facing.DirectionToFacing(Player.Instance.transform.position - this.transform.position);
            }
            else
            {
                movement = movement.normalized * timedPositioningSpeed;
            }
            base.MoveWithSliding(movement);
        }
    }