public static DnPActionManager GetInstance() { if (_instance == null) { _instance = new DnPActionManager(); } return(_instance); }
public void moveBoat() { if (boatCapacity() != 2 && theGame.state == State.Idle) { if (boat_side == 1) { // from start DnPActionManager.GetInstance().ApplyActionToObj(boat_obj, boatEndPos, speed); boat_side = 2; } else { // boat_side = 2, from end DnPActionManager.GetInstance().ApplyActionToObj(boat_obj, boatStartPos, speed); boat_side = 1; } theGame.state = State.Moving; } }
void getOnTheBoat(GameObject obj) { if (boatCapacity() != 0) { obj.transform.parent = boat_obj.transform; Vector3 target = new Vector3(); if (boat[0] == null) { boat[0] = obj; target = boat_obj.transform.position + leftBoatPos; } else { boat[1] = obj; target = boat_obj.transform.position + rightBoatPos; } DnPActionManager.GetInstance().ApplyActionToObj(obj, target, speed); } }
public void getOffTheBoat(int side) { if (boat[side] != null) { Vector3 target = new Vector3(); boat[side].transform.parent = null; if (theGame.state == State.Idle) { if (boat_side == 2) { if (boat[side].tag == "Priest") { target = getCharacterPosition(priestEndPos, priests_end.Count - 1); priests_end.Push(boat[side]); } else if (boat[side].tag == "Devil") { target = getCharacterPosition(devilEndPos, devils_end.Count - 1); devils_end.Push(boat[side]); } } else { // 1 if (boat[side].tag == "Priest") { target = getCharacterPosition(priestStartPos, priests_start.Count - 1); priests_start.Push(boat[side]); } else if (boat[side].tag == "Devil") { target = getCharacterPosition(devilStartPos, devils_start.Count - 1); devils_start.Push(boat[side]); } } } DnPActionManager.GetInstance().ApplyActionToObj(boat[side], target, speed); boat[side] = null; } }