public async Task <IActionResult> Edit(int id, [Bind("CureId,Name,Description")] Cure cure) { if (id != cure.CureId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cure); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CureExists(cure.CureId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cure)); }
void CheckCureTaken() { Vector3 positionGoal = runGoal; Vector3 selfPosition = transform.position; //Debug.Log("distance" + Vector3.Distance(positionGoal, positionPlayer)); if (Vector3.Distance(positionGoal, selfPosition) < 3f) { Cure tempCure = currentCureObject.GetComponent <Cure>(); float tempProbability; tempProbability = probabilityToGeSick[tempCure.deseaseIdcure] - tempCure.inmunity; if (tempProbability > 0.5f) { probabilityToGeSick[tempCure.deseaseIdcure] -= tempCure.inmunity; } else { probabilityToGeSick[tempCure.deseaseIdcure] = 0.5f; } if (desease != null && desease.virusId == tempCure.deseaseIdcure) { Cure(); myMaterial.color = healthyColor; } currentCureObject.SetActive(false); StopAllCoroutines(); SetGoal(); StartCoroutine(CheckTarget()); } }
public async Task <IActionResult> Create([Bind("CureId,Name,Description")] Cure cure) { if (ModelState.IsValid) { _context.Add(cure); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(cure)); }
private void HandleCureFinished(Cure cure) { float score = cure.CalculateEffectiveness(); string output = (score > 0) ? "Thanks, I feel much better!" : "Ouch, that did more harm than good!"; if (score == float.NegativeInfinity) { output = "Silence..."; } scenarioText.GetComponent <TypedText>().UpdateText(output); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Ent" && desease == null) { desease = other.gameObject.GetComponent <Actor>().desease; if (CheckInfection()) { isSick = true; Debug.Log("Contagiado"); } else { desease = null; Debug.Log("Salvado"); } } if (other.gameObject.tag == "Cure") { Cure tempCure = other.gameObject.GetComponent <Cure>(); float tempProbability = probabilityToGeSick[tempCure.deseaseIdcure] - tempCure.inmunity; if (tempProbability > 0.5f) { probabilityToGeSick[tempCure.deseaseIdcure] -= tempCure.inmunity; } else { probabilityToGeSick[tempCure.deseaseIdcure] = 0.5f; } if (desease != null && desease.virusId == tempCure.deseaseIdcure) { Cure(); } other.gameObject.SetActive(false); } if (other.gameObject.tag == "CureZone") { Cure(); } if (other.gameObject.tag == "Medicina") { timeWithSick -= 15f; timeToDie -= 15f; } }
// Stops a game and resets all variables public void StopGame() { StopRoundTimer(); StopGenericTimer(); Round = Team1Score = Team2Score = 0; RoundResult = 0; CurrentCurePosition = -1; AllPlayers.Clear(); Team1.Clear(); Team2.Clear(); Cure.Clear(); PlayedMinigames.Clear(); Team1Lead = Team2Lead = null; VoiceChannel = null; CurrentMinigame = null; RoundInProgress = GenericTimerActive = false; LastColorIndexUsed = -1; LastColorUsed = DiscordColor.None; }
//public localPlayer; // Start is called before the first frame update void Start() { gameObject.name = "Local"; if (isLocalPlayer) { PlayerCamera.SetActive(true); } else { PlayerCamera.SetActive(false); } door = null; cure = Cure.None; GlobalVariables.patientList.Add(this); patientID = GlobalVariables.patientList.Count; health.text = String.Concat("Health: :", GetRandomHealth().ToString()); ButtonHandler.EnableDisableButtons(false); //this.gameObject.GetComponent<Camera>(). }
/// <summary> /// 初始化施法執行效果清單 /// </summary> protected void InitExecute(string _executeListStr) { TriggerTargetList = new List <ExecuteCom>(); string executeListStr = _executeListStr; string[] executeStr = executeListStr.Split(','); //以迴圈加入所有執行元件 for (int i = 0; i < executeStr.Length; i++) { string[] executeColumn = executeStr[i].Split(':'); //執行類型 string type = executeColumn[0]; //執行ID int executeID = int.Parse(executeColumn[1]); //如果執行ID為0則跳過此執行 if (executeID == 0) { continue; } //依照執行類型與執行ID加入執行的元件 switch (type) { case "D": //傷害效果 Damage damage = new Damage(executeID, Self); TriggerTargetList.Add(damage); break; case "C": //治癒效果 Cure cure = new Cure(executeID, Self); TriggerTargetList.Add(cure); break; case "B": //狀態效果 Buffer buffer = new Buffer(executeID, Self); TriggerTargetList.Add(buffer); break; default: Debug.LogWarning(string.Format("施法ID:{0}的施法效果類型{0)無法判定,必須為D、C、B", ID, type)); break; } } }
public void Spawn() { // int count = (GameManager.Instance.BoatCount / 2); int count = GameManager.Instance.BoatCount - 1; for (int i = 0; i < count; i++) { Vector3 point = GameManager.Instance.RandomPoint; point.y = -0.5f; GameObject go = Instantiate( this.cure, point, Quaternion.identity ); Cure c = go.GetComponent <Cure>(); c.Spawner = this; this.cures.Add(c); } }
// Randomly generate the cure for both teams public void GenerateCure(bool StartGame) { var random = new Random(); if (StartGame) { // Clear any previous solution Cure.Clear(); for (var ind = 0; ind < MaxRounds; ++ind) { Cure.Add(RandomNoun(random)); } } else { // TIE round // Generate cure word for both teams depending on current round // because we tied, and people got stuck on the current words. Cure[CurrentCurePosition] = RandomNoun(random); } }
/// <summary> /// 拾取道具 /// </summary> private void PickUpProps(PropsType propsType, PropsBase props) { switch (propsType) { case PropsType.Cure: Cure cure = props as Cure; if (cure != null) { Dispatch(AreaCode.AUDIO, AudioEvent.PLAY_PICKUP_CURE, Camera.main.transform.position); Dispatch(AreaCode.GAME, GameEvent.GAME_AUGMENT_HP, cure.Value); //给玩家加血 Dispatch(AreaCode.GAME, GameEvent.GAME_REMOVE_PROPS_SEND, cure.id); //移除道具 } break; case PropsType.Food: Food food = props as Food; if (food != null) { Dispatch(AreaCode.AUDIO, AudioEvent.PLAY_PICKUP_FOOD, Camera.main.transform.position); Dispatch(AreaCode.GAME, GameEvent.GAME_AUGMENT_HG, food.value); Dispatch(AreaCode.GAME, GameEvent.GAME_REMOVE_PROPS_SEND, food.id); } break; case PropsType.Arms: Arm arm = props as Arm; if (arm != null) { Dispatch(AreaCode.AUDIO, AudioEvent.PLAY_PICKUP_ARM, Camera.main.transform.position); PickUpArms(arm); } break; default: break; } }
private void HandleScoreUpdated(Cure cure) { score += Mathf.RoundToInt(cure.CalculateEffectiveness()); }
/// <summary> /// Medicine that heals and cures an ailment /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="description"></param> /// <param name="healAmount"></param> /// <param name="cure"></param> /// <param name="worth"></param> /// <param name="amount"></param> /// <param name="maxAmount"></param> public Medicine(int id, string name, string description, Texture2D sprite, int healAmount, Cure cure, int worth, int amount, int maxAmount, bool cureAilment = true) { Useable = true; Id = id; Name = name; Description = description; Sprite = sprite; HealAmount = healAmount; if (cureAilment) Cures = cure; else inflict = cure; Useable = true; Worth = worth; Amount = amount; MaxAmount = maxAmount; Kind = ItemKind.Medicine; }
/// <summary> /// 初始化施法執行效果清單 /// </summary> protected void InitExecute(string _executeListStr) { TriggerTargetList = new List<ExecuteCom>(); string executeListStr = _executeListStr; string[] executeStr = executeListStr.Split(','); //以迴圈加入所有執行元件 for (int i = 0; i < executeStr.Length; i++) { string[] executeColumn = executeStr[i].Split(':'); //執行類型 string type = executeColumn[0]; //執行ID int executeID = int.Parse(executeColumn[1]); //如果執行ID為0則跳過此執行 if (executeID == 0) continue; //依照執行類型與執行ID加入執行的元件 switch (type) { case "D"://傷害效果 Damage damage = new Damage(executeID, Self); TriggerTargetList.Add(damage); break; case "C"://治癒效果 Cure cure = new Cure(executeID, Self); TriggerTargetList.Add(cure); break; case "B"://狀態效果 Buffer buffer = new Buffer(executeID, Self); TriggerTargetList.Add(buffer); break; default: Debug.LogWarning(string.Format("施法ID:{0}的施法效果類型{0)無法判定,必須為D、C、B", ID, type)); break; } } }
public void AddCure(Cure newCure) { cureList.Add(newCure); }
public Priest(string name) : base(name) { Ability = new Cure(); }
public void MarkCollected(Cure cure) { this.cures.Remove(cure); }