//For spectral hand deletions public void deleteHand(SpectralHandler handToDelete) { if (handToDelete == spectralHand1) { spectralHand1 = null; } else { spectralHand2 = null; } }
public void destroyOtherHand(SpectralHandler callingHand) { if (spectralHand2 == callingHand) { if (spectralHand1) { Destroy(spectralHand1.gameObject); spectralHand1 = null; } } else { if (spectralHand2) { Destroy(spectralHand2.gameObject); spectralHand2 = null; } } }
public void CastSpell(Vector3 position, Vector3 direction, Transform characterModel) { if (castTimer < 0.0f) { if (currentSpell == ThirdPersonUserControl.Spell.Fireball) { GameObject fireball = (GameObject)Instantiate(fireballPrefab, transform.position + direction * 3.0f, transform.rotation); fireball.GetComponent <FireballHandler>().Launch(direction); } else if (currentSpell == ThirdPersonUserControl.Spell.GroundSpike) { RaycastHit hitInfo; if (Physics.Raycast(position, direction, out hitInfo, maxSpellRange, groundSpikeLayerMask)) { Vector3 spawnPosition = new Vector3(hitInfo.point.x, hitInfo.point.y - groundSpikePrefab.transform.localScale.y - 0.5f, hitInfo.point.z); Instantiate(groundSpikePrefab, spawnPosition, transform.rotation); } } else { if (spectralHand1) { spectralHand2 = spectralHand1; } GameObject hand = (GameObject)Instantiate(spectralHandPrefab, transform.position, transform.rotation); spectralHand1 = hand.GetComponent <SpectralHandler>(); spectralHand1.setDirection(direction); spectralHand1.player = this; spectralHand1.characterModel = characterModel; } castTimer = spellCooldown; } }