protected void Shoot(Vector3 dir) { Vector3 pos = _shotPoint.transform.position; for (int i = 0; i < _numToFire; ++i) { GameObject bulletObj = GameObject.Instantiate(_prefab); IShootable bullet = bulletObj.GetComponent <IShootable>(); Vector3 randomAxis = VectorUtil.RandUnitVec3(); float spreadAmt = Vector3.Cross(randomAxis, dir).magnitude *_randomSpread; Vector3 spreadDir = Quaternion.AngleAxis(spreadAmt, randomAxis) * dir; bullet.Init(pos, spreadDir); _lastShotObject = bulletObj; } _mana.Spend(_manaCost); _cooledDownTime = Time.time + _cooldown; if (_autoFireRate > 0.0f) { _autoFireTime = Time.time + (1.0f / _autoFireRate); } }