public override void AttackPressed(Vector3 spawnPosition, Vector3 spawnDirection, Vector3?targetPosition = default(Vector3?)) { Casting = true; coneInstance = GameObject.Instantiate(IceConePrefab, spawnPosition, Quaternion.LookRotation(spellSource.forward, Vector3.up)); coneInstanceScript = coneInstance.GetComponentInChildren <IceCone>(); coneInstance.transform.parent = spellSource; }
private void EndCast() { Casting = false; if (coneInstance != null) { Destroy(coneInstance.gameObject); coneInstance = null; coneInstanceScript = null; } }
/// <summary> /// 发射雷球 /// </summary> private void FireIceCone() { GameObject iceCone = poolManager.GetGameObject(IceCone.ICE_CONE); IceCone a = iceCone.GetComponent <IceCone>(); a.SetThrower(gameObject); a.SetStartPosition(transform.position); a.SetTargetLayerName("Player"); a.SetDamage(2); a.SetMaxExistTime(8.0f); a.SetDirection(flyingDirection); }