Пример #1
0
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        wall_requester.SetWallSolved(ele_wall);
        eleva = animator.GetBehaviour <ElevatorState>().GetElevator();
        //Debug.Log("elevator in door state = " + eleva.name);
        List <GameObject> solvedlist = wall_requester.GetSolvedList();

        Debug.Log("is ele wall solved =" + solvedlist.Contains(ele_wall));
        elevatorInitiated = true;
        robotic_wall.wallToTarget_controller.Robot_Move_Switch(true);
        robotic_wall.wallToTarget_controller.Set_Target(eleva.transform.GetChild(0).gameObject);
        //since wall is over to move to target, this elevator door is initiated
        if (robotic_wall.wallToTarget_controller.Get_State())
        {
            animator.SetBool("ElevatorDoorInitiated", true);
        }
        foreach (Animator states in statesList)
        {
            elevatorInitiated = elevatorInitiated & states.GetBool("ElevatorDoorInitiated");
        }
        if (elevatorInitiated)
        {
            timer = timer + 1;
        }

        if (timer > 200)
        {
            animator.SetBool("ElevatorInitiated", elevatorInitiated);
            timer = 0;
        }
    }
Пример #2
0
    //allocate a standby point to the robotic wall
    public GameObject Allocate_StandbyPoint(GameObject roboticWall)
    {
        print(roboticWall.name);
        //sort the standby points by the distance between robotic wall and standby point, from small to large
        foreach (GameObject stand in standby_list_available)
        {
            float dis = DistanceToVirWall(roboticWall, stand);
            //print(stand.name + "distance =" + dis);
        }
        slovedWallList = wall_requester.GetSolvedList();
        standby_list_available.Sort(delegate(GameObject phyW1, GameObject phyW2)
        {
            if (DistanceToVirWall(roboticWall, phyW1) < DistanceToVirWall(roboticWall, phyW2))
            {
                return(-1);
            }
            else
            {
                return(1);
            }
        });

        /*List<GameObject> tempo_standby_list = standby_list_available;
         * foreach(GameObject wall in slovedWallList)
         * {
         *  print(wall.name);
         *  foreach(GameObject standbyPoint in tempo_standby_list)
         *  {
         *      if (Judge_Side(wall, wall) == Judge_Side(wall, standbyPoint))
         *      {
         *          print("deleted point:" + standbyPoint.name);
         *          tempo_standby_list.Remove(standbyPoint);
         *      }
         *  }
         * }*/
        GameObject target = standby_list_available[0];

        //print("allocate_standbypoint");
        standby_list_available.Remove(target);
        return(target);
    }