Exemplo n.º 1
0
        public override void ConfirmCast()
        {
            var ray = AbilityHelper.GetScreenRay();

            if (!AbilityHelper.TryGetWorld(ray, out var hit))
            {
                return;
            }
            var pos = Self.transform.position;
            var dir = hit.point - pos;

            CastVectorTarget(pos, dir);
        }
Exemplo n.º 2
0
        public override void ConfirmCast()
        {
            if (!Checker.AllowCast())
            {
                return;
            }

            var ray = AbilityHelper.GetScreenRay();

            if (!AbilityHelper.TryGetWorldOrEntity(ray, out var hit))
            {
                return;
            }
            var unitCast = AbilityHelper.TryGetActor(hit.collider, out var actor);

            if (actor == Self)
            {
                return;
            }
            var position = unitCast
                ? actor.transform.position
                : hit.point;

            if (!CastRange.InRange(position))
            {
                return;
            }

            if (unitCast)
            {
                if (!Checker.AllowTarget(actor))
                {
                    return;
                }

                Checker.DoCast();
                CastObjectTarget(actor);
            }
            else
            {
                Checker.DoCast();
                CastGroundTarget(position);
            }

            Modules.Abilitiable.NotifyAbilityCast(new AbilityEventArgs(Self, Checker.MagicCost.Cost));
        }
Exemplo n.º 3
0
        private void FixedUpdate()
        {
            var  variant    = GetVariant();
            var  ray        = AbilityHelper.GetScreenRay();
            bool isHovering = false;

            if (Physics.Raycast(ray, out var hit, MaxDistance, Mask))
            {
                isHovering = AbilityHelper.TryGetActor(hit.collider, out _);
            }
            var desired = GetCursorIcon(variant, isHovering);

            //We cant set the cursor every frame, because it doesnt move when you do
            if (desired != _prev)
            {
                SetCursor(desired, CursorMode.Auto);
                _prev = desired;
            }
        }
Exemplo n.º 4
0
        public override void ConfirmCast()
        {
            if (!Checker.AllowCast())
            {
                return;
            }
            var ray = AbilityHelper.GetScreenRay();

            if (!AbilityHelper.TryGetWorldOrEntity(ray, out var hit))
            {
                return;
            }

            var unitTarget = AbilityHelper.TryGetActor(hit.collider, out var actor);

            if (actor == Self)
            {
                return;
            }

            if (!unitTarget && !CastRange.InRange(hit.point))
            {
                return;
            }
            if (unitTarget && !CastRange.InRange(actor))
            {
                return;
            }


            Checker.DoCast();
            if (!unitTarget)
            {
                CastGroundTarget(hit.point);
            }
            else
            {
                CastObjectTarget(actor);
            }

            Modules.Abilitiable.NotifyAbilityCast(new AbilityEventArgs(Self, View.StatCost.Cost));
        }
Exemplo n.º 5
0
        public override void ConfirmCast()
        {
            var ray = AbilityHelper.GetScreenRay();

            if (!AbilityHelper.TryGetWorld(ray, out var hit))
            {
                return;
            }
            if (!CheckBuilder.AllowCast())
            {
                return;
            }
            CastRange.MaxDistance = _overheat.Active ? _overheatCastRange : _castRange;
            if (!CastRange.InRange(hit.point))
            {
                return;
            }
            CheckBuilder.DoCast();
            CastGroundTarget(hit.point);
            Modules.Abilitiable.NotifyAbilityCast(new AbilityEventArgs(Self, View.StatCost.Cost));
        }