void Update()
    {
        var direction = Vector3.zero;
        var forward   = Quaternion.AngleAxis(-90, Vector3.up) * Camera.main.transform.right;

        if (Screen.lockCursor)
        {
            if (Input.GetKey(KeyCode.W))
            {
                direction += forward;
            }
            if (Input.GetKey(KeyCode.S))
            {
                direction -= forward;
            }
            if (Input.GetKey(KeyCode.A))
            {
                direction -= Camera.main.transform.right;
            }
            if (Input.GetKey(KeyCode.D))
            {
                direction += Camera.main.transform.right;
            }

            if (Input.GetMouseButtonDown(0))
            {
                character.Attack();
            }

            var orbit = Camera.main.gameObject.GetComponent <Orbit>();
            if (orbit != null)
            {
                orbit.Data.Azimuth += Input.GetAxis("Mouse X") / 100;
                orbit.Data.Zenith  += Input.GetAxis("Mouse Y") / 100;
                orbit.Data.Zenith   = Mathf.Clamp(orbit.Data.Zenith, -0.8f, 0f);
                orbit.Data.Length  += (-6 - orbit.Data.Length) / 10;
            }

            if (Input.GetMouseButtonDown(1))
            {
                character.Attack();
                var skillDeployer = this.gameObject.GetComponent <CharacterSkillDeployer>();
                if (skillDeployer != null)
                {
                    skillDeployer.DeployWithAttacking();
                }
            }
        }

        direction.Normalize();
        character.Move(direction);
    }
    void Update()
    {
        var direction = Vector3.zero;

        if (aiTime <= 0)
        {
            aiState = Random.Range(0, 4);
            aiTime  = Random.Range(10, 100);
        }
        else
        {
            aiTime--;
        }
        if (ObjectTarget)
        {
            float distance = Vector3.Distance(ObjectTarget.transform.position, this.gameObject.transform.position);

            if (distance <= 2)
            {
                transform.LookAt(ObjectTarget.transform.position);
                if (aiTime <= 0)
                {
                    if (aiState == 1)
                    {
                        character.Attack();
                    }
                }
            }
            else
            {
                if (aiState == 1)
                {
                    transform.LookAt(ObjectTarget.transform.position);
                    direction = this.transform.forward;
                    direction.Normalize();
                    character.Move(direction);
                }
            }
        }
        else
        {
            ObjectTarget = GameObject.FindGameObjectWithTag(TargetTag);
        }
    }