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(); }