Пример #1
0
        public void CastSpell(int spellId)
        {
            if (!Player.ExistsIn(World))
            {
                return;
            }

            if (balance.SpellInfosById.TryGetValue(spellId, out SpellInfo spellInfo) && spellInfo.ExplicitTargetType == SpellExplicitTargetType.Destination)
            {
                spellTargeting.SelectSpellTargetDestination(spellInfo);
            }
            else
            {
                SpellCastRequestEvent spellCastRequest = SpellCastRequestEvent.Create(Bolt.GlobalTargets.OnlyServer);
                spellCastRequest.SpellId       = spellId;
                spellCastRequest.MovementFlags = (int)Player.MovementFlags;
                spellCastRequest.Send();
            }
        }
Пример #2
0
        protected override void OnUpdate(float deltaTime)
        {
            base.OnUpdate(deltaTime);

            if (!Player.ExistsIn(World))
            {
                return;
            }

            if (Input.GetMouseButtonDown(0) && !Input.GetMouseButton(1) && !InterfaceUtils.IsPointerOverUI)
            {
                Ray ray = cameraReference.WarcraftCamera.Camera.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(ray, out var hit, float.MaxValue, PhysicsReference.Mask.Characters | PhysicsReference.Mask.Ground))
                {
                    if (World.UnitManager.TryFind(hit.collider, out Unit target))
                    {
                        input.SelectTarget(target);
                    }
                }
            }
        }