public override void Launch(RangeWeapon weapon) { if (_missileToLaunch != null) { Ray ray = new Ray(projectileSpawnTransform.position, projectileSpawnTransform.forward); if (Physics.Raycast(ray, out RaycastHit hit, maxDistanceToHit)) { hit.collider.gameObject.HandleComponent <ITarget>(target => currentTarget = hit.transform); print(hit.collider.name); } MissileProps newMissileProps = new MissileProps { acceleration = missileProps.acceleration, rotationSpeed = missileProps.rotationSpeed, damage = weapon.rangeWeaponProps.damage, speed = weapon.rangeWeaponProps.projectileSpeed, startForce = missileProps.startForce, timeToDestroy = missileProps.timeToDestroy, timeToFly = missileProps.timeToFly, }; _missileToLaunch.Launch(currentTarget, ray, newMissileProps); _missileToLaunch = null; StartCoroutine(LoadMissileWithDelay(timeToReload)); } }
public abstract void Launch(RangeWeapon weapon);
public override void Launch(RangeWeapon weapon) { Bullet bullet = BulletPool.Instance.Get(); bullet.Launch(weapon.rangeWeaponProps.damage, weapon.rangeWeaponProps.projectileSpeed, projectileSpawnTransform.position, weapon.transform.rotation); }