public void SpellUpdate(SpellCasting spellCasting) { bool tmp = Input.GetAxisRaw("Spell 1") > 0f; if (tmp != fireAxis[0]) { if (tmp) { spellCasting.SpellPressed(0); } else { spellCasting.SpellReleased(0); } } fireAxis[0] = tmp; tmp = Input.GetAxisRaw("Spell 2") < 0f; if (tmp != fireAxis[1]) { if (tmp) { spellCasting.SpellPressed(1); } else { spellCasting.SpellReleased(1); } } fireAxis[1] = tmp; if (Input.GetButtonDown("Spell 3")) { spellCasting.SpellPressed(2); } else if (Input.GetButtonUp("Spell 3")) { spellCasting.SpellReleased(2); } if (Input.GetButtonDown("Spell 4")) { spellCasting.SpellPressed(3); } else if (Input.GetButtonUp("Spell 4")) { spellCasting.SpellReleased(3); } }
public void SpellUpdate(ref SpellCasting spellCasting) { if (Input.GetButtonDown("Spell 1")) { spellCasting.SpellPressed(0); } else if (Input.GetButtonUp("Spell 1")) { spellCasting.SpellReleased(0); } if (Input.GetButtonDown("Spell 2")) { spellCasting.SpellPressed(1); } else if (Input.GetButtonUp("Spell 2")) { spellCasting.SpellReleased(1); } if (Input.GetButtonDown("Spell 3")) { spellCasting.SpellPressed(2); } else if (Input.GetButtonUp("Spell 3")) { spellCasting.SpellReleased(2); } if (Input.GetButtonDown("Spell 4")) { spellCasting.SpellPressed(3); } else if (Input.GetButtonUp("Spell 4")) { spellCasting.SpellReleased(3); } if (spellCasting.casting) { spellCasting.CastUpdate(rayCast.BoardRayCast()); } }
private void Awake() { rayCast = this.GetComponent <Prototype.RayCast>(); joystickController = new JoystickController(); keyboardController = new KeyboardController(rayCast); spellCasting = new SpellCasting(this); playerUnits.items.Clear(); for (int i = 0; i < units.Length && units[i] != null; i++) { unitPortraits[i].gameObject.SetActive(true); units[i] = Instantiate(units[i]); units[i].gameObject.SetActive(false); units[i].Initialize(this, unitPortraits[i]); } currentUnit = units[0]; currentAnimator = currentUnit.GetComponentInChildren <Animator>(); currentUnit.transform.position = playerSpawn; currentUnit.gameObject.SetActive(true); playerUnits.Add(currentUnit); GetComponent <CameraController>().UpdateTarget(currentUnit.gameObject); spellCasting.UpdateSpellBook(ref currentUnit.spellBook); }