public void LoadPrefabs() { GameObject river = (GameObject)Instantiate(Resources.Load("Prefabs/River", typeof(GameObject)), Vector3.up, Quaternion.identity, null); river.name = "River"; fromShore = new ShoreControl("From"); toShore = new ShoreControl("To"); boat = new BoatControl(); for (int i = 0; i < 3; i++) { ItemControl item = new ItemControl("Priest"); item.item.name = "Priest" + i; item.item.transform.position = fromShore.GetEmptyPosition(); item.GetOnShore(fromShore); fromShore.GetOnShore(item); itemCtrls[i] = item; } for (int i = 0; i < 3; i++) { ItemControl item = new ItemControl("Devil"); item.item.name = "Devil" + i; item.item.transform.position = fromShore.GetEmptyPosition(); item.GetOnShore(fromShore); fromShore.GetOnShore(item); itemCtrls[i + 3] = item; } }
public void ItemClick(ItemControl itemCtrl) { Debug.Log("ItemClick"); if (itemCtrl.isOnBoat) { ShoreControl side; if (boat.status == 1) { side = fromShore; } else { side = toShore; } Debug.Log(side.GetEmptyPosition()); boat.GetOffBoat(itemCtrl); //itemCtrl.MoveTo(side.GetEmptyPosition()); MyActionManager.MoveItem(itemCtrl, side.GetEmptyPosition()); // add in v2 itemCtrl.GetOnShore(side); side.GetOnShore(itemCtrl); user.step++; } else { if (boat.IsFull()) { return; } Debug.Log(itemCtrl.item.name + " getting on boat"); ShoreControl side = itemCtrl.shoreCtrl; if (side.status != boat.status) { return; } side.GetOffShore(itemCtrl.item.name); //Debug.Log(MyActionManager); //Debug.Log(itemCtrl); //Debug.Log(boat); //itemCtrl.MoveTo(boat.GetOnBoat(itemCtrl)); MyActionManager.MoveItem(itemCtrl, boat.GetOnBoat(itemCtrl)); // add in v2 itemCtrl.GetOnBoat(boat); user.step++; } user.status = Check(); }