예제 #1
0
파일: AI.cs 프로젝트: Valensta/otherside
    public void Init()
    {
        /*
         * if (Central.Instance != null && Central.Instance.level_list.levels[Central.Instance.current_lvl].test_mode)
         * {
         *  howclose = 0.01f;
         *  stopwhen = 0.01f;
         *  notsure = 0.01f;
         *
         * }
         * else
         * {
         *  howclose = 0.25f;
         * }*/
        avg_speed          = 0f;
        distance_travelled = 0f;
        time_lived         = 0f;

        dead             = false;
        rotation_steps   = Mathf.FloorToInt(4f / rotation_lerp_amount);
        init_orientation = false;
        my_dogtag.Init();
        previous_step = transform.position;
        //	if (orient){StartCoroutine("OrientMe");}
        if (my_rigidbody == null)
        {
            my_rigidbody = this.GetComponent <Rigidbody2D>();
        }
        current_speed = speed;
        hit           = false;
        forward_only  = true;

        InvokeRepeating("updateLastPosition", 2, 1f);

        if (velocityType == VelocityType.AngularVelocity)
        {
            velocity_lerp = 1f;
        }
        else
        {
            velocity_lerp = 0.1f;
        }

        StartCoroutine(NewPath());
    }