/** * 아이템과 관련된 메세지를 출력하는 함수 * 상황에 따라 3가지 오버로딩 */ // 보통 아이템 관련 메세지 출력하는 오버로딩 함수 public void MakeItemMessage(UnitAction action, ItemManager.Label item) { string s = ""; if (action == UnitAction.EatCapsule) { Debug.Log("정의되지 않은 방법으로 MakeItemMessage를 호출하였습니다." + " EatCapsule로 call시 물 섭취 여부를 true/false로 입력하세요."); return; } if (action == UnitAction.PickItem || action == UnitAction.TakeCapsule) //아이템 습득 { if (itemmanager.GetItemIdentificationInfo(item) == false) { s = "미식별 알약을 얻었습니다."; } else { s = ObjName(item) + " 얻었습니다."; } } else if (action == UnitAction.UseItem || action == UnitAction.InjectItem) // 아이템(소모품) 사용 { s = ObjName(item) + " 사용했습니다."; } else { Debug.Log("정의되지 않은 방법으로 MakeItemMessage를 호출하였습니다."); return; } logger.AddLog(s); }
private Weapon NewWeapon(ItemManager.Label label) { switch (label) { case ItemManager.Label.AutoHandgun: return(new AutoHandgun()); case ItemManager.Label.BlackKnife: return(new BlackKnife()); case ItemManager.Label.Club: return(new Club()); case ItemManager.Label.Hammer: return(new Hammer()); case ItemManager.Label.Lighter: return(new Lighter()); case ItemManager.Label.InjectorWeapon: return(new InjectorWeapon()); case ItemManager.Label.Mess: return(new Mess()); case ItemManager.Label.Nuckle: return(new Nuckle()); case ItemManager.Label.Shock: return(new Shock()); case ItemManager.Label.SharpDagger: return(new SharpDagger()); default: return(null); } }
protected override void Start() { name = "MedicineMaster"; usuability = 100; pill = ItemManager.Label.Empty; base.Start(); }
/** * \see InventoryItem::UseItem * \see Player::UseItem */ public void UseItem(int index) { ItemManager.Label label = player.InventoryList.GetLabel(index); if (player.InventoryList.LabelList[index] != ItemManager.Label.Empty) { foreach (GameObject gObject in GameObject.FindGameObjectsWithTag("ItemPickedUp")) {/* * if(gObject.name==System.Enum.GetName(typeof(ItemManager.Label), label)+"(Clone)") * {gObject.GetComponent<ItemECS>().isUse=true; * break; * }*/ if (gObject.GetComponent <ItemPrefab>().label == player.InventoryList.LabelList[index]) { gObject.GetComponent <ItemECS>().isUse = true; if (player.armor is Tshirts && label == ItemManager.Label.Can) { player.ChangeHp(10); } player.InventoryList.itemManager.ItemIdentify(label); break; } } DumpItem(index); } }
public void PickItem(ItemManager.Label label) { if (player.InventoryList.AddItem(label) == true) { messageMaker.MakeItemMessage(MessageMaker.UnitAction.PickItem, label); player.InventoryList.IdentifyAllTheInventoryItem(); gameManager.EndPlayerTurn(Unit.Action.Items); } }
/** * \see InventoryItem::ThrowCommand * \see Player::ThrowItem */ public void ThrowAwayItem(int index) { ItemManager.Label label = player.InventoryList.GetLabel(index); if (player.InventoryList.LabelList[index] != ItemManager.Label.Empty) { gameManager.Throw(label, index); // if( true == inventoryList.itemManager.LabelToItem( label ).GetType().GetMethod( "ThrownTo" ).DeclaringType.Equals( inventoryList.itemManager.LabelToItem( label ) ) ) //ThrowTo가 구현(override) 되어있으면 } }
protected override void Start() { name = "InjectorCollector"; usuability = 100; injector = ItemManager.Label.Empty; boardmanager = GameObject.Find("BoardManager").GetComponent <BoardManager>(); gamemanager = GameObject.Find("GameManager").GetComponent <GameManager>(); itemmanager = GameObject.Find("ItemManager").GetComponent <ItemManager>(); base.Start(); }
/** 아이템 라벨에 해당하는 가장 작은 인덱스를 가져오는 함수 */ public int Getindex(ItemManager.Label label) { for (int i = 0; i < size; i++) { if (label == labelList[i]) { return(i); } } return(-1); }
/** 해당 라벨에 해당하는 아이템이 있는지 확인한다. */ public bool CheckItem(ItemManager.Label _label) { for (int i = 0; i < size; i++) { if (_label == labelList[i]) { return(true); } } return(false); }
public string Name(ItemManager.Label label) //캡슐 한정 사용 { string name = ""; if (label == ItemManager.Label.CaffeinCapsule1 || label == ItemManager.Label.CaffeinCapsule2 || label == ItemManager.Label.CaffeinCapsule3) { name = "카페인 알약"; } else if (label == ItemManager.Label.CureAll1 || label == ItemManager.Label.CureAll2 || label == ItemManager.Label.CureAll3) { name = "만병통치약"; } else if (label == ItemManager.Label.Hallucinogen1 || label == ItemManager.Label.Hallucinogen2 || label == ItemManager.Label.Hallucinogen3) { name = "환각제"; } else if (label == ItemManager.Label.LiquidFlameMedicine1 || label == ItemManager.Label.LiquidFlameMedicine2 || label == ItemManager.Label.LiquidFlameMedicine3) { name = "매운 알약"; } else if (label == ItemManager.Label.PoisonCapsule1 || label == ItemManager.Label.PoisonCapsule2 || label == ItemManager.Label.PoisonCapsule3) { name = "독약"; } else if (label == ItemManager.Label.Salt1 || label == ItemManager.Label.Salt2 || label == ItemManager.Label.Salt3) { name = "소금"; } else if (label == ItemManager.Label.Soup1 || label == ItemManager.Label.Soup2 || label == ItemManager.Label.Soup3) { name = "수프"; } else if (label == ItemManager.Label.VitaminTablet1 || label == ItemManager.Label.VitaminTablet2 || label == ItemManager.Label.VitaminTablet3) { name = "비타민 알약"; } else if (label == ItemManager.Label.Painkiller1) { name = "진정제"; } else { Debug.Log("이름이 정의되지 않은 아이템이 있습니다."); return("Unnamed Item"); } return(name); }
public void SpreadWater(int index) { ItemManager.Label label = player.InventoryList.GetLabel(index); if (player.InventoryList.LabelList[index] != ItemManager.Label.Empty) { foreach (GameObject gObject in GameObject.FindGameObjectsWithTag("ItemPickedUp")) { if (gObject.name == System.Enum.GetName(typeof(ItemManager.Label), label) + "(Clone)") { GameObject.Destroy(gObject); player.DeleteBuff(new Burn(1)); break; } } messageMaker.MakeItemMessage(MessageMaker.UnitAction.UseItem, player.InventoryList.LabelList[index]); DumpItem(index); } }
/** * When player add an item, it find the location where the item should be and put the item by assigning appropriate sprite and label. * The sprite for the label is taken by the function itemManager.LabelToSprite. * \param label When player licked item, the gameObject calls this function with label of the item. * \see Player::PickItem(ItemManager.Label) and * \see Item::OnMouseUpAsButton * There is a debug log function. */ public bool AddItem(ItemManager.Label label, GameObject gObject) { int location; for (location = 0; location < size; location++) { if (labelList [location] == ItemManager.Label.Empty || labelList[location] == label) { break; } } if (location < size) { if (labelList[location] == ItemManager.Label.Empty) { labelList[location] = label; inventoryObject[location].GetComponent <Image>().sprite = gObject.GetComponent <Image>().sprite; inventoryObject[location].GetComponent <InventoryItem>().Index = location; //남길지 말지 if (itemManager.GetItemIdentificationInfo(labelList[location])) { inventoryObject[location].GetComponentInChildren <UnityEngine.UI.Text>().text = labelList[location].ToString(); } numberOfSameItems[location] = 1; return(true); } else if (label == labelList[location] && ItemManager.LabelToType(labelList[location]) != ItemManager.ItemType.Weapon && ItemManager.LabelToType(labelList[location]) != ItemManager.ItemType.Armor) { numberOfSameItems[location]++; return(true); } else { return(false); } } else { Debug.Log("인벤토리가 꽉 찼다."); return(false); } }
/** * 아이템과 관련된 메세지를 출력하는 함수 * 상황에 따라 3가지 오버로딩 */ public void MakeCannotMessage(ItemManager.Label label) { string s = ""; ItemManager.ItemType type = ItemManager.LabelToType(label); if (type == ItemManager.ItemType.Injector) { s = "지금은 이 주사기를 사용할 수 없습니다."; } else if (type == ItemManager.ItemType.Card) { s = "이 문은 잠겨있습니다. 문 옆에 카드 리더기가 있습니다."; } else { s = "Undefined CannotMessage Called"; Debug.Log("지정되지 않은 예외 상황에서 MakeCannotMessage를 사용했습니다."); } logger.AddLog(s); }
private Armor NewArmor(ItemManager.Label label) { switch (label) { case ItemManager.Label.BloodJacket: return(new BloodJacket()); case ItemManager.Label.CleanDoctorCloth: return(new CleanDoctorCloth()); case ItemManager.Label.DamagedDoctorCloth: return(new DamagedDoctorCloth()); case ItemManager.Label.FullPlated: return(new FullPlated()); case ItemManager.Label.Padding: return(new Padding()); case ItemManager.Label.Patient: return(new Patient()); case ItemManager.Label.Tshirts: return(new Tshirts()); default: return(null); } }
/** * \see InventoryItem::UnequipCommand * \see Player::UnequipItem */ public void UnequipItem(int index) { ItemManager.Label label = player.InventoryList.GetLabel(index); if (player.InventoryList.LabelList[index] != ItemManager.Label.Empty) { Item weaponorarmor = player.InventoryList.itemManager.LabelToItem(label); if (weaponorarmor is Weapon) { player.weapon = new DefaultWeapon(); player.weaponindex = -1; GameObject.Find("WeaponImage").GetComponent <UnityEngine.UI.Image>().sprite = Empty; } else { player.armor = new DefaultArmor(); player.armorindex = -1; GameObject.Find("ArmorImage").GetComponent <UnityEngine.UI.Image>().sprite = Empty; } } gameManager.EndPlayerTurn(Unit.Action.Items); }
//TakeCapsule시 여러 개를 획득할 때 한정으로 사용하는 오버로딩 함수 public void MakeItemMessage(UnitAction action, ItemManager.Label item, int n) { string s = ""; if (action != UnitAction.TakeCapsule) { Debug.Log("정의되지 않은 방법으로 MakeItemMessage를 호출하였습니다."); return; } else { if (itemmanager.GetItemIdentificationInfo(item) == false) { s = "미식별 알약 " + n + "개를 얻었습니다."; } else { s += Name(item) + " " + n + "개를 얻었습니다."; } } logger.AddLog(s); }
//EatCapsule시 한정하여 사용하는 오버로딩 함수, 물을 사용했는지를 인자로 받는다 public void MakeItemMessage(UnitAction action, ItemManager.Label item, bool water) { string s = ""; if (ItemManager.LabelToType(item) != ItemManager.ItemType.Capsule) { Debug.Log("정의되지 않은 방법으로 MakeItemMessage를 호출하였습니다."); return; } else { if (water) { s = ObjName(item) + " 물과 함께 복용했습니다."; } else { s += AndName(item) + " 함께 먹을 물이 없어 억지로 삼켰습니다."; } } logger.AddLog(s); }
public void AddItem(ItemManager.Label label) { int location; for (location = 0; location < size; location++) { Debug.Log(inventoryObject); if (labelList [location] == ItemManager.Label.Empty) { break; } } if (location < size) { labelList [location] = label; inventoryObject [location].GetComponent <SpriteRenderer> ().sprite = itemManager.LabelToSprite(label); } else { Debug.Log("아이템이 꽉찼다."); } }
public void PickItem(ItemManager.Label label) { inventoryList.AddItem(label); }
/** After the player turn, enemies attack to player. * It finds all the enemies in the board and make them attack to player. * If there are enemies, it turns currentSituation true. If not, it turns currentSituation false. * \see Rat::OnMouseUpAsButton */ /** * @todo 던지는 상황에 대한 구현 필요 */ /* * public void Throw(ItemManager.Label label) { * GameObject[] enemyList = GameObject.FindGameObjectsWithTag( "Enemy" ); * GameObject [] bossList = GameObject.FindGameObjectsWithTag ("Boss"); * for(int i = 0; i < bossList.Length;i++ ) * { * ThrowToEnemy (bossList [i].GetComponent<Enemy> (), label); * } * for( int i = 0; i < enemyList.Length; i++ ) { * ThrowToEnemy( enemyList[ i ].GetComponent<Enemy>(), label ); * }*/ public void Throw(ItemManager.Label label, int index) { ThrowFlag = true; throwLabel = label; ThrowIndex = index; }
/** * @todo I need to delete this function? */ /** * item을 사용하고 효과에 따른 메서드를 실행한다 */ public void UseItem(ItemManager.Label label) { itemManager.LabelToItem(label); }
private string ObjName(ItemManager.Label label) { string name = ""; if (label == ItemManager.Label.AutoHandgun) { name = "자동권총 'F'를"; } else if (label == ItemManager.Label.BlackKnife) { name = "전투식 키보드를"; } else if (label == ItemManager.Label.Club) { name = "각목을"; } else if (label == ItemManager.Label.Hammer) { name = "망치를"; } else if (label == ItemManager.Label.Lighter) { name = "라이터를"; } else if (label == ItemManager.Label.Mess) { name = "스마트폰을"; } else if (label == ItemManager.Label.Nuckle) { name = "라텍스 장갑을"; } else if (label == ItemManager.Label.SharpDagger) { name = "팩트리어트 미사일을"; } else if (label == ItemManager.Label.Shock) { name = "제세동기를"; } else if (label == ItemManager.Label.InjectorWeapon) { name = "피펫을"; //미구현 } else if (label == ItemManager.Label.BloodJacket) { name = "대학원생의 조끼을"; } else if (label == ItemManager.Label.CleanDoctorCloth) { name = "깔끔한 실험복을"; } else if (label == ItemManager.Label.DamagedDoctorCloth) { name = "낡은 실험복을"; } else if (label == ItemManager.Label.FullPlated) { name = "판금 갑옷을"; } else if (label == ItemManager.Label.Padding) { name = "두꺼운 패딩을"; } else if (label == ItemManager.Label.Patient) { name = "야구잠바을"; } else if (label == ItemManager.Label.Tshirts) { name = "티셔츠를"; } else if (label == ItemManager.Label.MorfinDrug) { name = "곰국을"; } else if (label == ItemManager.Label.AdrenalineDrug) { name = "에너지 드링크를"; } else if (label == ItemManager.Label.RingerSolution) { name = "갈배 사이다를"; } else if (label == ItemManager.Label.Can) { name = "'L' 샌드위치를"; } else if (label == ItemManager.Label.Water) { name = "물을"; } else if (label == ItemManager.Label.Bandage) { name = "붕대를"; } else if (label == ItemManager.Label.Medicine) { name = "약품을"; } else if (label == ItemManager.Label.WhiteCard) { name = "하얀 키 카드를"; } else if (label == ItemManager.Label.BlackCard) { name = "검정 키 카드를"; } else if (label == ItemManager.Label.YellowCard) { name = "노란 키 카드를"; } else if (label == ItemManager.Label.CaffeinCapsule1 || label == ItemManager.Label.CaffeinCapsule2 || label == ItemManager.Label.CaffeinCapsule3) { name = "카페인 알약을"; } else if (label == ItemManager.Label.CureAll1 || label == ItemManager.Label.CureAll2 || label == ItemManager.Label.CureAll3) { name = "만병통치약을"; } else if (label == ItemManager.Label.Hallucinogen1 || label == ItemManager.Label.Hallucinogen2 || label == ItemManager.Label.Hallucinogen3) { name = "환각제를"; } else if (label == ItemManager.Label.LiquidFlameMedicine1 || label == ItemManager.Label.LiquidFlameMedicine2 || label == ItemManager.Label.LiquidFlameMedicine3) { name = "매운 알약을"; } else if (label == ItemManager.Label.PoisonCapsule1 || label == ItemManager.Label.PoisonCapsule2 || label == ItemManager.Label.PoisonCapsule3) { name = "독약을"; } else if (label == ItemManager.Label.Salt1 || label == ItemManager.Label.Salt2 || label == ItemManager.Label.Salt3) { name = "소금을"; } else if (label == ItemManager.Label.Soup1 || label == ItemManager.Label.Soup2 || label == ItemManager.Label.Soup3) { name = "수프를"; } else if (label == ItemManager.Label.VitaminTablet1 || label == ItemManager.Label.VitaminTablet2 || label == ItemManager.Label.VitaminTablet3) { name = "발포 비타민을"; } else if (label == ItemManager.Label.Painkiller1) { name = "진통제를"; } else { Debug.Log("이름이 정의되지 않은 아이템이 있습니다."); return("Unnamed Item"); } return(name); }
public bool AddItem(ItemManager.Label label) { int locationEmpty; int locationSameLabel; for (locationEmpty = 0; locationEmpty < size; locationEmpty++) { if (labelList[locationEmpty] == ItemManager.Label.Empty) { break; } } for (locationSameLabel = 0; locationSameLabel < size; locationSameLabel++) { if (labelList[locationSameLabel] == label) { break; } } if (locationEmpty < size || locationSameLabel < size) { if (locationSameLabel < size && ItemManager.LabelToType(labelList[locationSameLabel]) != ItemManager.ItemType.Armor && ItemManager.LabelToType(labelList[locationSameLabel]) != ItemManager.ItemType.Weapon) { numberOfSameItems[locationSameLabel]++; return(true); } else if (locationEmpty < size) { labelList[locationEmpty] = label; inventoryObject[locationEmpty].GetComponent <Image>().sprite = itemManager.LabelToSprite(label); inventoryObject[locationEmpty].GetComponent <InventoryItem>().Index = locationEmpty; if (itemManager.GetItemIdentificationInfo(labelList[locationEmpty])) { inventoryObject[locationEmpty].GetComponentInChildren <UnityEngine.UI.Text>().text = labelList[locationEmpty].ToString(); } numberOfSameItems[locationEmpty] = 1; if (ItemManager.LabelToType(labelList[locationEmpty]) == ItemManager.ItemType.Armor) { armors[locationEmpty] = NewArmor(label); armors[locationEmpty].setRank(ItemManager.LabelToCategory(label)); armors[locationEmpty].SetMaxDefbyRank(armors[locationEmpty].rank); } else if (ItemManager.LabelToType(labelList[locationEmpty]) == ItemManager.ItemType.Weapon) { weapons[locationEmpty] = NewWeapon(label); weapons[locationEmpty].setRank(ItemManager.LabelToCategory(label)); weapons[locationEmpty].SetMaxAtkbyRank(weapons[locationEmpty].rank); } return(true); } return(false); } else { Debug.Log("인벤토리가 꽉 찼다."); return(false); } }
public void UseItem(ItemManager.Label label) { playerAction.UseItem(inventoryList.Getindex(label)); }
public virtual void talk(Player player, ItemManager.Label label) //아이템 집어넣은 npc와의 대화 { }
// Use this for initialization void Start() { buttons = gameObject.GetComponentsInChildren <Button>(); pill = ItemManager.Label.Empty; Init(); }
public override void talk(Player player) { if (usuability == 100) { if (boardmanager.WhichFloor == 5) { player.InventoryList.AddItem(ItemManager.Label.BlackKnife);//전설주사기로 바꿔. usuability = 0; player.InventoryList.InjecCommuni = false; CantTalkBox dBox = (gObject = Instantiate(dialogBox[1], new Vector2(0 + GameObject.Find("PlayerUI").transform.position.x, 2 + GameObject.Find("PlayerUI").transform.position.y), Quaternion.identity, GameObject.Find("PlayerUI").transform)).GetComponent <CantTalkBox>(); dBox.npc = this; dBox.GetComponentInChildren <UnityEngine.UI.Text>().text = "감사합니다. 여기 제가 가지고 있던 비상식량과 알약을 가져가세요."; player.GetInventoryList().isDialogBoxOn = false; //다이얼로그 끝난 정보 저장 } else { Array values = Enum.GetValues(typeof(ItemManager.ItemCategory)); ItemManager.ItemCategory randomBar1 = (ItemManager.ItemCategory)values.GetValue(UnityEngine.Random.Range(0, values.Length)); ItemManager.ItemCategory randomBar2 = (ItemManager.ItemCategory)values.GetValue(UnityEngine.Random.Range(0, values.Length)); while (ItemManager.CategoryToType(randomBar1) != ItemManager.ItemType.Capsule || randomBar1 == ItemManager.ItemCategory.CureAll || ItemManager.CategoryToType(randomBar2) != ItemManager.ItemType.Capsule || randomBar2 == ItemManager.ItemCategory.CureAll || randomBar1 == randomBar2 ) { randomBar1 = (ItemManager.ItemCategory)values.GetValue(UnityEngine.Random.Range(0, values.Length)); randomBar2 = (ItemManager.ItemCategory)values.GetValue(UnityEngine.Random.Range(0, values.Length)); } ItemManager.Label label1 = ItemManager.CategoryToLabel(randomBar1, boardmanager.WhichFloor); ItemManager.Label label2 = ItemManager.CategoryToLabel(randomBar2, boardmanager.WhichFloor); /* * player.PlayerAction.PickItem( label1 ); * player.PlayerAction.PickItem( label2 ); * player.PlayerAction.PickItem( ItemManager.Label.Can ); * player.PlayerAction.PickItem( ItemManager.Label.Can ); * player.PlayerAction.PickItem( ItemManager.Label.Water ); * player.PlayerAction.PickItem( ItemManager.Label.Water );*/ //아이템 포지션 설정. Vector2 nowPos = new Vector2(boardmanager.XPos * BoardManager.horizontalMovement, boardmanager.YPos * BoardManager.verticalMovement); Vector2 [] GenPos = new Vector2 [6]; for (var i = 0; i < 6; i++) { GenPos [i] = new Vector2(-5 + 2 * i, 0); } itemmanager.InstantiateItem(randomBar1, GenPos[0] + nowPos); itemmanager.InstantiateItem(randomBar2, GenPos[1] + nowPos); itemmanager.InstantiateItem(ItemManager.ItemCategory.Can, GenPos[2] + nowPos); itemmanager.InstantiateItem(ItemManager.ItemCategory.Can, GenPos[3] + nowPos); itemmanager.InstantiateItem(ItemManager.ItemCategory.Water, GenPos[4] + nowPos); itemmanager.InstantiateItem(ItemManager.ItemCategory.Water, GenPos[5] + nowPos); usuability = 0; player.InventoryList.InjecCommuni = false; CantTalkBox dBox = (gObject = Instantiate(dialogBox[1], new Vector2(0 + GameObject.Find("PlayerUI").transform.position.x, 2 + GameObject.Find("PlayerUI").transform.position.y), Quaternion.identity, GameObject.Find("PlayerUI").transform)).GetComponent <CantTalkBox>(); dBox.npc = this; dBox.GetComponentInChildren <UnityEngine.UI.Text>().text = "감사합니다. 여기 제가 가지고 있던 비상식량과 알약을 가져가세요."; player.GetInventoryList().isDialogBoxOn = false; //다이얼로그 끝난 정보 저장 } } else { Debug.Log("InjectorCollector error: talk shld not work when usuablility = 0"); usuability = 0; } }