예제 #1
0
 public Checkpoint(Vector2 dest_pos, Vector2Int tile_position, RouteManager.Orientation begin_orientation, RouteManager.Orientation end_orientation, string action)
 {
     is_right_angle         = true;
     this.begin_orientation = begin_orientation;
     this.end_orientation   = end_orientation;
     this.dest_pos          = dest_pos;
     this.tile_position     = tile_position;
     animation_clip         = PersonRouteManager.get_animation_from_orientation(end_orientation, action);
 }
예제 #2
0
    public virtual IEnumerator bezier_move(Transform location, RouteManager.Orientation orientation, RouteManager.Orientation final_orientation)
    {
        Vector2 position = location.position;
        float   t_param;

        t_param = 1;
        bool final_step = false;

        in_tile = true;
        // change animation clip
        string animation_name = PersonRouteManager.get_animation_from_orientation(final_orientation, "walk");

        StartCoroutine(set_animation_clip(animation_name));
        while (!final_step)
        {
            if (PauseManager.game_is_paused)
            {
                yield return(new WaitForEndOfFrame());

                continue;
            }
            t_param -= Time.deltaTime * speed;

            if (t_param < 0) // set t_param to 0 to get bezier coordinates closer to the destination (and be within tolerance)
            {
                t_param    = 0;
                final_step = true;
            }
            next_position      = bezier_equation(t_param, TrackManager.offset_right_angle_inner_curve);
            next_position      = transform_curve(next_position, orientation, final_orientation) + position; //offset with current position
            transform.position = next_position;
            yield return(new WaitForEndOfFrame());
        }
        set_angle_using_orientation(final_orientation);
        in_tile = false;
    }