Esempio n. 1
0
        public void Attack(
            GameObject target,
            Guid allianceGuid)
        {
            _timeLeft -= Time.fixedDeltaTime;
            if (_timeLeft > 0)
            {
                return;
            }
            var heading = target.transform.position - transform.position;
            var right   = transform.right;
            var dot     = Vector3.Dot(
                right,
                heading);
            var angle = Vector3.Angle(right, heading);

            if (angle < 20)
            {
                Shell.CheckComponent <UsualRocket>(_ =>
                                                   ShellHelper.InitShell <UsualRocket>(
                                                       Shell,
                                                       target,
                                                       transform.position,
                                                       allianceGuid))
                ?.CheckComponent <MonoBehaviour>(_ =>
                                                 throw new ArgumentException("Unknown shell", nameof(RocketLauncher)));
                _timeLeft = ReloadTime;
            }
        }
Esempio n. 2
0
        public void Attack(
            GameObject target,
            Guid allianceGuid)
        {
            _timeLeft -= Time.fixedDeltaTime;
            if (_timeLeft > 0)
            {
                return;
            }

            Shell.CheckComponent <UsualBullet>(_ =>
                                               ShellHelper.InitShell <UsualBullet>(
                                                   Shell,
                                                   target,
                                                   transform.position,
                                                   allianceGuid))
            ?.CheckComponent <MonoBehaviour>(_ =>
                                             throw new ArgumentException("Unknown shell", nameof(RocketLauncher)));
            _timeLeft = ReloadTime;
        }