예제 #1
0
파일: PathDraw.cs 프로젝트: chemming/SRL_1
    void SaveData()
    {
        Vector3 posAfter = transform.position;
        Quaternion orientAfter = transform.rotation;
        if (posBefore == new Vector3(0,0,0))
            posBefore = posAfter;
        if (orientBefore == new Quaternion(0,0,0,0))
            orientBefore = orientAfter;

            string itemType = "none";
        if(this.selectedItem != null)
        {
            itemType = selectedItem.GetComponent<ItemThink>().param_weight;
        }
        ActionData act = new ActionData(param_robotType,itemType,posBefore,posAfter,orientBefore,orientAfter,iteration);
        act.AddPosition("obstacle",FindClosestItem("obstacle").transform.position);
        if(FindClosestItem("robot") != null)
            act.AddPosition("robot",FindClosestItem("robot").transform.position);
        act.AddPosition("goal",FindClosestItem("goal").transform.position);
        if(FindClosestItem("item") != null)
            act.AddPosition("item",FindClosestItem("item").transform.position);
        if(selectedItem != null)
            act.AddPosition("selectedItem",selectedItem.gameObject.transform.position);
        act.Store();
    }