static public Spell StringToSpell(string spellType) { Spell behavior = null; switch (spellType) { case "AddHealth": behavior = new AddHealth(); break; case "Antidote": behavior = new Antidote(); break; case "Armor": behavior = new Armor(); break; case "DieOff": behavior = new DieOff(); break; case "Revive": behavior = new Revive(); break; } return(behavior); }
private void Update() { // Pressing E while standing in front of an interactable enables the artifact viewer for that object if (Input.GetKeyDown(KeyCode.E)) { // remove any active tutorials meltTutorial.SetActive(false); createTutorial.SetActive(false); Vector3 camPos = playerCamera.position; RaycastHit hit; if (!pmScript.enabled) { DisableArtifactViewer(true); } else if (Physics.Raycast(camPos, playerCamera.TransformDirection(Vector3.forward), out hit, interactReach, interactableMask)) { Interactable interactable = hit.collider.GetComponent <Interactable>(); Key key = hit.collider.GetComponent <Key>(); Keyhole keyhole = hit.collider.GetComponent <Keyhole>(); Antidote antidote = hit.collider.GetComponent <Antidote>(); if (interactable != null) { InteractWithArtifact(hit.collider.gameObject); hit.collider.gameObject.SetActive(false); } else if (key != null) { key.Collect(); } else if (keyhole != null) { keyhole.PlaceKeyOnKeyhole(); } else if (antidote != null) { antidotePickupSource.clip = antidotePickupSound; antidotePickupSource.Play(); antidote.Collect(); } else if (hit.collider.CompareTag("gun")) { gunObject.SetActive(true); toolScript.enabled = true; meltTutorial.SetActive(true); menuManager.playerHasTool = true; hit.collider.gameObject.SetActive(false); } else if (hit.collider.CompareTag("Tool Component")) { toolScript.canFreeze = true; hit.collider.gameObject.SetActive(false); createTutorial.SetActive(true); freezerAttachment.SetActive(false); fuelBar.SetActive(true); toolScript.toolFuel = startingFuelPercent * toolScript.capacity; } } } }
static void Main(string[] args) { PersonRP Andrew = new PersonRP(Gender.Male, Race.Human, Condition.Normal, "Andrew", 18, 100, 20, 100); PersonRP Tommy = new PersonRP(Gender.Male, Race.Human, Condition.Normal, "Andrew", 18, 100, 5, 50); Console.WriteLine("Информация о персонаже: " + Andrew.InfoCharacter()); Console.WriteLine("Сравнение по опыту: " + Andrew.CompareTo(Tommy)); Console.WriteLine("HP в процентах: " + Tommy.hp_percents()); ArteDeadWater adw = new ArteDeadWater(ArteDeadWaterVolume.large); ArteDeadWater adw_2 = new ArteDeadWater(ArteDeadWaterVolume.large); ArteDeadWater adw_3 = new ArteDeadWater(ArteDeadWaterVolume.large); ArteFrogLegsDeco afld = new ArteFrogLegsDeco(); MagicPersonRP Kim = new MagicPersonRP(Gender.Male, Race.Human, Condition.Normal, "Kim", 18, 100, 90, 50, 2000, 5000, true, true, 30); MagicPersonRP Jenek = new MagicPersonRP(Gender.Male, Race.Human, Condition.Poisoned, "Jenek", 18, 100, 90, 50, 2000, 5000, true, true, 30); MagicPersonRP Dima = new MagicPersonRP(Gender.Male, Race.Human, Condition.Dead, "Dima", 18, 100, 90, 50, 2000, 5000, true, true, 30); Console.WriteLine("Состояние маны изначально: " + Kim.CURRENT_AMOUNT_OF_MAGIC); Kim.PickUpArtefact(adw); Kim.PickUpArtefact(adw_3); Kim.ApplyArtefact(0, 0, Kim); Console.WriteLine("Состояние маны после мёртвой воды: " + Kim.CURRENT_AMOUNT_OF_MAGIC); Kim.SetArtefactPower(0, 100); Kim.PickUpArtefact(adw_2); Kim.ThrowArtefact(1); //Kim.PassArte(0,Tommy); Tommy.PickUpArtefact(afld); Console.WriteLine("Состояние до: " + Tommy.CONDITION_OF_PERSON); Tommy.ApplyArtefact(0, 0, Tommy); Console.WriteLine("Состояние после: " + Tommy.CONDITION_OF_PERSON); ArteLightninhStaff als = new ArteLightninhStaff(); Tommy.PickUpArtefact(als); Console.WriteLine("ХП до посоха: " + Kim.CURRENT_AMOUNT_OF_HP); Tommy.ApplyArtefact(0, 10, Kim); Console.WriteLine("ХП после посоха: " + Kim.CURRENT_AMOUNT_OF_HP); ArteLivingWater alw = new ArteLivingWater(ArteLivingWaterVolume.large); Tommy.PickUpArtefact(alw); Console.WriteLine("ХП до воды: " + Tommy.CURRENT_AMOUNT_OF_HP); Tommy.ApplyArtefact(1, 0, Tommy); Console.WriteLine("ХП после воды: " + Tommy.CURRENT_AMOUNT_OF_HP); ArteVasiliskEye ave = new ArteVasiliskEye(); Tommy.PickUpArtefact(ave); Console.WriteLine("Состояние до Василиска: " + Tommy.CONDITION_OF_PERSON); Tommy.ApplyArtefact(1, 0, Tommy); Console.WriteLine("Состояние после Василиска: " + Tommy.CONDITION_OF_PERSON); ArtePoisonousSaliva aps = new ArtePoisonousSaliva(); Tommy.PickUpArtefact(aps); Console.WriteLine("Состояние до слюны: " + Kim.CONDITION_OF_PERSON + " " + Kim.CURRENT_AMOUNT_OF_HP); Tommy.ApplyArtefact(1, 0, Kim); Console.WriteLine("Состояние после слюны: " + Kim.CONDITION_OF_PERSON + " " + Kim.CURRENT_AMOUNT_OF_HP); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// Healt_up hu = new Healt_up(true, true, 20, 5); Kim.AddSpell(hu); Console.WriteLine("Здоровье до заклинания: " + Kim.CURRENT_AMOUNT_OF_HP); Kim.SpellDO(hu); Console.WriteLine("Здоровье после заклинания: " + Kim.CURRENT_AMOUNT_OF_HP); Kim.CONDITION_OF_PERSON = Condition.Ill; ToCure tc = new ToCure(true, 20); Kim.AddSpell(tc); Console.WriteLine("Состояние до заклинания: " + Kim.CONDITION_OF_PERSON); Kim.SpellDO(tc); Console.WriteLine("Состояние после заклинания: " + Kim.CONDITION_OF_PERSON); Kim.CONDITION_OF_PERSON = Condition.Poisoned; Antidote antd = new Antidote(true, 20); Jenek.AddSpell(antd); Jenek.SpellDO(antd); Console.WriteLine("Состояние после заклинания: " + Jenek.CONDITION_OF_PERSON); ToAlive ta = new ToAlive(true, 20); Dima.AddSpell(ta); Dima.SpellDO(ta, Dima); Console.WriteLine("Состояние после заклинания: " + Dima.CONDITION_OF_PERSON); Armor arm = new Armor(true, 20, 50000); Jenek.AddSpell(arm); Jenek.SpellDO(arm); Console.WriteLine("Броня после заклинания: " + Jenek.STATUS_RES); UnFreeze ufr = new UnFreeze(true, 20); Kim.CONDITION_OF_PERSON = Condition.Paralyzed; Jenek.AddSpell(ufr); Jenek.SpellDO(ufr, Kim); Console.WriteLine("После анфриз: " + Kim.CONDITION_OF_PERSON + " " + Kim.CURRENT_AMOUNT_OF_HP); }