Beispiel #1
0
    // Update is called once per frame
    void LateUpdate()
    {
        current_state.update(this);
        if (char_type == CharType.NPC || char_type == CharType.NPC_Melee)
        {
            //Debug.Log (root.get_path ());
            if (!root.IsActive)
            {
                root.Activate(gameObject);
            }
            root.Update(0, gameObject);
        }

        rigid.MovePosition(rigid.position + (Vector2)(move_direction * speed * Time.deltaTime));

        if (walk_progress < 1.0f)
        {
            walk_progress += (Time.deltaTime * speed) / length;
            rigid.MovePosition(Vector3.Lerp(start_position, walk_target, Mathf.Clamp01(walk_progress)));
            target(walk_target);
        }

        float axis_input = Input.GetAxis("Mouse ScrollWheel");

        if (Mathf.Abs(axis_input) > 0)
        {
            weapons [selected_weapon].gameObject.SetActive(false);
            selected_weapon = (selected_weapon + (int)Mathf.Sign(axis_input) + weapons.Length) % weapons.Length;
            weapons [selected_weapon].gameObject.SetActive(true);
        }
    }