//public bool crewDrive(Crewman crewman)//항해시키기 //{ // if (whoDrive() == null && actingCheck(crewman)) // { // crewman.setDrive(true); // crewman.setActingType(Acting.DRIVE); // return true; // } // else if(whoDrive() != null && actingCheck(crewman)) // { // crewDriveStop(whoDrive()); // crewman.setDrive(true); // crewman.setActingType(Acting.DRIVE); // return true; // } // return false; //} public void crewDriveStop(Crewman crewman)//항해그만두기 { if (crewman.getDrive()) { crewman.setDrive(false); } }
protected void TriggerTaskAssignment(SimulationTime time, Phase phase, Crewman crewman, SimulationTask task = null) { if (this.OnTaskAssignment != null) { this.OnTaskAssignment(time, phase, crewman, task); } }
public bool crewmanEat(Crewman crewman)//식사 { if (actingCheck(crewman)) { stealDrive(crewman); if (GameManager.Instance.Food > 0) { if (crewman.getfull() < 4) { GameManager.Instance.Food -= 1; crewman.setfull(crewman.getfull() + 1); return(true); } UIManager.Instance.showMessage("배가 부릅니다."); } else { UIManager.Instance.showMessage("식량이 부족합니다."); } return(false); } return(false); }
public bool crewmanFishing(Crewman crewman)//낚시하기 { int time = -1; if (actingCheck(crewman)) { stealDrive(crewman); if (crewman.getbehavior() >= 1) { if (GameManager.Instance.getNowFishingRod().Durability > 0) { crewman.setFishing(true); crewman.setActingType(Acting.FISHING); crewman.setbehavior(crewman.getbehavior() - 1); GameManager.Instance.getNowFishingRod().Durability -= 2; time = calendar.time + 1; if (time >= 24) { time -= 24; } crewman.settime(time); return(true); } UIManager.Instance.showMessage("낚시대의 내구도가 부족합니다."); } UIManager.Instance.showMessage("행동력이 부족합니다."); } return(false); }
public void initUI() { // 선원 정보를 이용하여 UI 갱신 for (int i = 0; i < crewUIs.Length; i++) { crewUIs[i].gameObject.SetActive(false); crewStatusUIs[i].gameObject.SetActive(false); } for (int i = 0; i < CrewmanManager.Instance.howManyCrewman(); i++) { Crewman _crewman = CrewmanManager.Instance.getCrewman(i); crewUIs[i].setCrewImage(getCrewImage(_crewman)); crewStatusUIs[i].setCrewImage(getCrewImage(_crewman)); refreshCrewUI(i); crewUIs[i].gameObject.SetActive(true); crewStatusUIs[i].gameObject.SetActive(true); } //sheepStatusUI.setShipDescriptionText("요트 설명 적힐곳"); initShipStatusImage(); // 요트 상태 창 이미지 변경 }
private void UpdateInteraction() { if (!Essentials.UnityIsNull(this.retriggerInteract)) { this.retriggerInteract.model.interact.interact.TryStart(this); this.retriggerInteract = null; } }
public void crewmanWakeUpCount(Crewman crewman)//시간이 되면 깨우기 { if (crewman.gettime() == calendar.time) { crewman.setSleep(false); crewman.setActingType(Acting.NOTHING); } }
public void stealDrive(Crewman crewman) { crewman.setActingType(Acting.NOTHING); if (crewman == GameManager.Instance.Sail.DriveCrew) { GameManager.Instance.Sail.DriveCrew = null; } }
private void OnStopInteraction() { if (Essentials.UnityIsNull(this.currentInteractor)) { return; } this.currentInteractor = null; }
public void dieCrewman(Crewman crewman)//해당되는 crewman삭제 { crewmanList.Remove(crewman); for (int i = 0; i < crewmanList.Count; i++) { crewmanList[i].setindex(i); } UIManager.Instance.initUI(); // 선원 변경 되었기때문에 UI 초기화 필요 }
private void RetriggerInteract() { if (Essentials.UnityIsNull(this.currentInteractor)) { return; } this.retriggerInteract = this.currentInteractor; this.currentInteractor.model.interact.interact.ForceStop(); }
public bool crewmanFishingYes(Crewman crewman, FishingRod fishingRod)//낚시 성공 실패 { if (Random.Range(0.0f, 100.0f) < (crewman.getfishing() + fishingRod.FishingProbability)) { return(true); } else { return(false); } }
private void refreshUI() { refreshEtcUI(); refreshSheepStatusUI(); for (int i = 0; i < CrewmanManager.Instance.howManyCrewman(); i++) { Crewman _crewman = CrewmanManager.Instance.getCrewman(i); refreshCrewUI(i); } }
public bool actingCheck(Crewman crewman)//행동을 하는지, 행동을 하면 false, 안하면 true { //if( Acting.NOTHING == crewman.whatActing()) //{ // return true; //} if (crewman.getActingType() == Acting.NOTHING || crewman.getActingType() == Acting.DRIVE) { return(true); } UIManager.Instance.showMessage("다른 행동을 하는중입니다."); return(false); }
private void refreshCrewUI(int crewIndex) { // 선원 데이터를 가져와서 UI 갱신 Crewman _crew = CrewmanManager.Instance.getCrewman(crewIndex); crewUIs[crewIndex].setNowActMark(actingEnumToString(_crew.getActingType())); crewUIs[crewIndex].setActGauge(_crew.getbehavior()); crewUIs[crewIndex].setHungerGauge(_crew.getfull()); crewStatusUIs[crewIndex].setCrewNowActText(actingEnumToString(_crew.getActingType())); crewStatusUIs[crewIndex].setLeftActText(10, _crew.getbehavior()); crewStatusUIs[crewIndex].setHungerText(4, _crew.getfull()); crewStatusUIs[crewIndex].setCrewJobText(getCrewJob(_crew)); }
public bool crewDrive(Crewman crewman) { for (int i = 0; i < crewmanList.Count; i++) { if (crewmanList[i].getActingType() == Acting.DRIVE) { crewmanList[i].setActingType(Acting.NOTHING); } } crewman.setActingType(Acting.DRIVE); GameManager.Instance.Sail.DriveCrew = crewman; return(true); }
public void showSelectMenu(int index) { Crewman _crew = CrewmanManager.Instance.getCrewman(index); if (_crew.getActingType() == Acting.NOTHING || _crew.getActingType() == Acting.DRIVE) { Vector2 _size = selectMenu.GetComponent <RectTransform>().sizeDelta; CanvasScaler scaler = myCanvas.GetComponentInParent <CanvasScaler>(); selectMenu.GetComponent <RectTransform>().anchoredPosition = new Vector2(Input.mousePosition.x * scaler.referenceResolution.x / Screen.width - scaler.referenceResolution.x / 2 + _size.x / 2, Input.mousePosition.y * scaler.referenceResolution.y / Screen.height - scaler.referenceResolution.y / 2 + _size.y / 2); selectMenu.SetActive(true); showCrewHighlight(index); selectCrewIndex = index; } }
public bool crewmanSleep(Crewman crewman)//재우기 { int behavior; int time = -1; if (actingCheck(crewman)) { stealDrive(crewman); if (7 <= calendar.time && calendar.time < 19) { crewman.setSleep(true); crewman.setActingType(Acting.SLEEP); behavior = crewman.getbehavior() + 5; if (behavior > 10) { behavior = 10; } crewman.setbehavior(behavior); time = calendar.time + 4; if (time >= 24) { time -= 24; } } else { crewman.setSleep(true); crewman.setActingType(Acting.SLEEP); crewman.setbehavior(10); time = calendar.time + 6; if (time >= 24) { time -= 24; } } crewman.settime(time); return(true); } return(false); }
public bool crewmanFishingCount(Crewman crewman)//시간이 되면 낚시 그만두기 true면 그만 false면 계속 { if (crewman.gettime() == calendar.time) { crewman.setFishing(false); crewman.setActingType(Acting.NOTHING); if (crewmanFishingYes(crewman, GameManager.Instance.getNowFishingRod())) { GameManager.Instance.Food += 2; UIManager.Instance.showMessage("낚시 성공! \n식량 2를 획득하였습니다."); return(true); } else { UIManager.Instance.showMessage("낚시 실패!"); return(false); } } return(false); }
private Sprite getCrewImage(Crewman crewData) { if (crewData is Captain) { return(captineSprite); } else if (crewData is Engineer) { return(engineerSprite); } else if (crewData is Mate) { return(mateSprite); } else if (crewData is Angler) { return(anglerSprite); } return(null); }
private string getCrewJob(Crewman crewData) { if (crewData is Captain) { return("선장"); } else if (crewData is Engineer) { return("엔지니어"); } else if (crewData is Mate) { return("항해사"); } else if (crewData is Angler) { return("강태공"); } return(null); }
public bool crewmanRepair(Crewman crewman)// 수리하기 { if (actingCheck(crewman)) { if (crewman.gettype() == 1) { if (crewman.getbehavior() >= 2) { crewman.setbehavior(crewman.getbehavior() - 2); return(true); } } else if (crewman.getbehavior() >= 3) { crewman.setbehavior(crewman.getbehavior() - 3); return(true); } UIManager.Instance.showMessage("행동력이 부족합니다."); } return(false); }
public void slectCrewmanRepair(Crewman crewman) { stealDrive(crewman); }
// this is the actual submarine simulation public static void Demo() { // recruit crew Crewman crewman1 = new Crewman(); Crewman crewman2 = new Crewman(); Equipment probe1 = new Equipment(); Equipment probe2 = new Equipment(); Scientist scientist1 = new Scientist(probe1); Scientist scientist2 = new Scientist(probe2); List <Human> crew = new List <Human>() { crewman1, crewman2, scientist1, scientist2 }; // build life support system Waste waste = new Waste(); waste.Volume = 0.0; FoodContainer container = new FoodContainer(200.0); container.Volume = 200.0; OxygenBottle bottle1 = new OxygenBottle(10000.0); OxygenBottle bottle2 = new OxygenBottle(10000.0); bottle1.Volume = bottle2.Volume = 10000.0; List <OxygenBottle> bottles = new List <OxygenBottle>() { bottle1, bottle2 }; LifeSupportSystem system = new LifeSupportSystem(bottles, container, waste, crew); // build engine FuelNuclear fuel = new FuelNuclear(); FuelTank tank = new FuelTank(50.0, fuel); tank.Volume = tank.MaxCapacity; Engine engie = new Engine(tank, waste); // all transportable items will contribute to total weight List <ITransportable> transportables = new List <ITransportable>() { probe1, probe2, crewman1, crewman2, scientist1, scientist2, waste, container, bottle1, bottle2, fuel, tank }; double baseWeight = 1000.0; double totalWeight = baseWeight; foreach (ITransportable item in transportables) { totalWeight += item.Weight; } Console.WriteLine("Initial submarine weight: " + totalWeight); // we also want to remember all items we need to take care of when visiting a port List <IVisitPort> itemsToRemember = new List <IVisitPort>() { waste, container, bottle1, bottle2, tank }; // a number of different travel options List <double> tripDistances = new List <double>() { 10.0, 250.0, 1e3, 1e6 }; foreach (double distance in tripDistances) { Console.WriteLine(); // calculate total weight totalWeight = baseWeight; foreach (ITransportable item in transportables) { totalWeight += item.Weight; } Console.WriteLine("Current submarine weight: " + totalWeight); // how much time would it take to travel? double time = distance / engie.GetVelocity(totalWeight); // do we have enough fuel? if (!engie.CheckFuelBeforeTravel(time)) { Console.WriteLine("Not enough fuel to travel " + distance + " km!"); Console.WriteLine("Available fuel: " + tank.Volume); Console.WriteLine("Required travel time: " + time.ToString(".#") + " hours"); continue; } // do we have enough supplies? if (!system.CheckSuppliesBeforeTravel(time)) { Console.WriteLine("Not enough supplies to travel " + distance + " km!"); Console.WriteLine("Available food: " + container.Volume); Console.WriteLine("Available oxygen: " + (bottle1.Volume + bottle2.Volume)); Console.WriteLine("Required travel time: " + time.ToString(".#") + " hours"); continue; } // if everything is ok - let's go on a trip! Console.WriteLine("Travel destination accepted [" + distance + " km]"); engie.Travel(time); system.Run(time); scientist1.Work(time); scientist2.Work(time); // for comparison, calculate total weight again totalWeight = baseWeight; foreach (ITransportable item in transportables) { totalWeight += item.Weight; } Console.WriteLine("Current submarine weight: " + totalWeight.ToString(".")); // back to the port - let's see how much did it cost double totalCost = 0.0; foreach (IVisitPort item in itemsToRemember) { totalCost += item.VisitPort(); } Console.WriteLine("Total trip cost: " + totalCost.ToString(".")); // now repeat for a different travel option } }
private void OnStartInteraction(Crewman crewman) { this.currentInteractor = crewman; }
public CrewmanViewModel(Crewman crewman) { this.crewman = crewman; }
public bool removeCrewmanHaveList(Crewman crewman) { return(crewmenHaveList.Remove(crewman)); }
private void OnAddCrewman(Crewman crewman) { this.crewmanVMs.Add(new CrewmanViewModel(crewman)); }
public void addCrewmanHaveList(Crewman crewman) { crewmenHaveList.Add(crewman); }
private void OnRemoveCrewman(Crewman crewman) { this.crewmanVMs.RemoveAll((vm) => ReferenceEquals(vm.crewman, crewman)); }