public void SetupSpell(SpellArchetype spellArchetype) { Spells.Add(spellArchetype); spellCanvasView spellCanvasView; spellCanvasView = Instantiate(spellArchetype.UIToSpawn, SpellHandler.transform); spellCanvasView.spellArchetype = spellArchetype; currentSpellCanvas = spellCanvasView; }
void Update() { if (activeSpell != null) { if (resourceManager.amountOfEnergy >= activeSpell.SpellCostInEnergy) { if (activateShowOfSpell && Input.GetMouseButtonUp(0) && !ableToSpawnAgain) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { if (hit.transform.tag == "Floor") { StartCoroutine(CreateSpellThanWait(hit.point)); } } } if (activateShowOfSpell && !ableToSpawnAgain) { ShowSpellDebug(true); grab.notUsingSpell = true; } else//if i still have enough money to click again this doesn't show the spell { ShowSpellDebug(false); grab.notUsingSpell = false; } } else //if i've no money then don't show debug { ShowSpellDebug(false); grab.notUsingSpell = false; } } if (Input.GetMouseButtonUp(1) && activeSpell != null) { for (int i = 0; i < GameObject.Find("Main Camera").GetComponent <SpellManager>().spellCanvases.Count; i++) { GameObject.Find("Main Camera").GetComponent <SpellManager>().spellCanvases[i].isShowing = false; } ShowSpellDebug(false); grab.notUsingSpell = false; ableToSpawnAgain = false; activateShowOfSpell = false; activeSpell = null; } }
public void TakeDamage(AiStatus aiStatus, SpellArchetype spellArchetype) { int finalDamage = 0; int resistance = 0; // switch (aiStatus) { case AiStatus.Physical: resistance = PhysicalResistance; finalDamage = spellArchetype.DamageToEnemy - PhysicalResistance; _aIPriest.healthAmount -= finalDamage; break; case AiStatus.Fear: finalDamage = 0; break; case AiStatus.MentalHealth: resistance = MentalHealthResistance; finalDamage = spellArchetype.DamageToEnemy - MentalHealthResistance; _aIPriest.MentalHealthAmount += finalDamage; break; case AiStatus.Lonelyness: finalDamage = 0; break; case AiStatus.IntestineStatus: finalDamage = 0; break; } CanvasDamage canvasDamage = Instantiate(_gameSettings.CanvasDamagePrefab, spawnPointCanvas.transform.position, new Quaternion()); canvasDamage.SetupCanvasDamage(aiStatus, finalDamage, resistance); UpdateLifeBars(); if (_aIPriest.healthAmount <= 0) { _aIPriest.Die(1); } else if (_aIPriest.MentalHealthAmount >= _aIPriest.MentalHealthMaxAmount) { _aIPriest.Die(0); } }
public void SetSpellToActive(SpellArchetype spellArchetype) { activeSpell = spellArchetype; }