// Update is called once per frame void Update() { setPostion(priest_begin, priest_begin_position, object_move); setPostion(devil_begin, devil_begin_position, object_move); setPostion(priest_end, priest_end_position, object_move); setPostion(devil_end, devil_end_position, object_move); setPostion(onTheWay, on_ship_left_position, object_move_at_the_boat); if (ship_info == ship_location.moving_to_end) { float step = 3 * Time.deltaTime; ship.transform.position = Vector3.MoveTowards(ship.transform.position, ship_end_position, step); if (ship.transform.position == ship_end_position) { ship_info = ship_location.end; game_state = State.normal; } } else if (ship_info == ship_location.moving_to_begin) { float step = 3 * Time.deltaTime; ship.transform.position = Vector3.MoveTowards(ship.transform.position, ship_begin_position, step); if (ship.transform.position == ship_begin_position) { ship_info = ship_location.begin; game_state = State.normal; } } else { check(); } }
void Awake() { land_begin_position.Set(-6, 0, 0); land_end_position.Set(6, 0, 0); priest_begin_position.Set(-8, 1, 0); priest_end_position.Set(4, 1, 0); devil_begin_position.Set(-5.3f, 1, 0); devil_end_position.Set(6.5f, 1, 0); object_move.Set(1, 0, 0); object_move_at_the_boat.Set(0.5f, 0, 0); on_ship_left_position.Set(-0.3f, 1.5f, 0); on_ship_right_positon.Set(0.3f, 1.5f, 0); ship_begin_position.Set(-1.7f, 0, 0); ship_end_position.Set(1.7f, 0, 0); priest_begin = new Queue <GameObject>(); priest_end = new Queue <GameObject>(); devil_begin = new Queue <GameObject>(); devil_end = new Queue <GameObject>(); onTheWay = new Queue <GameObject>(); game_state = State.normal; ship_info = ship_location.begin; SSDirector director = SSDirector.getInstance(); director.currentSceneController = this; director.currentSceneController.LoadResources(); }
public void drive() { if (onTheWay.Count > 0) { if (ship_info == ship_location.begin) { ship_info = ship_location.moving_to_end; } else if (ship_info == ship_location.end) { ship_info = ship_location.moving_to_begin; } game_state = State.moving; } }