Пример #1
0
        public void bot_stopAbility(string abilityName)
        {
            if (_game.UserHandler.UserExistsAndReady(Context.ConnectionId))
            {
                try
                {
                    Ship ship = _game.UserHandler.GetUserShip(Context.ConnectionId);

                    if (ship.Controllable.Value)
                    {
                        ship.DeactivateAbility(abilityName);
                    }
                }
                catch (Exception e)
                {
                    _logger.LogError("registerAbilityStart", e);
                }
            }
        }
Пример #2
0
        public void registerAbilityStop(string abilityName, bool pingBack, long commandID)
        {
            if (_game.UserHandler.UserExistsAndReady(Context.ConnectionId))
            {
                try
                {
                    if (pingBack)
                    {
                        Clients.Caller.pingBack();
                    }

                    Ship ship = _game.UserHandler.GetUserShip(Context.ConnectionId);

                    if (ship.Controllable.Value)
                    {
                        ship.DeactivateAbility(abilityName, commandID);
                    }
                }
                catch (Exception e)
                {
                }
            }
        }
Пример #3
0
        public async Task registerAbilityStop(string abilityName, Vector2 at, double angle, Vector2 velocity, bool pingBack)
        {
            if (_game.UserHandler.UserExistsAndReady(Context.ConnectionId))
            {
                try
                {
                    if (pingBack)
                    {
                        await Clients.Client(Context.ConnectionId).SendAsync("pingBack");
                    }

                    Ship ship = _game.UserHandler.GetUserShip(Context.ConnectionId);

                    if (ship.Controllable.Value)
                    {
                        ship.DeactivateAbility(abilityName, at, angle, velocity);
                    }
                }
                catch (Exception e)
                {
                    _logger.LogError("registerAbilityStop", e);
                }
            }
        }
Пример #4
0
        public void registerAbilityStop(string abilityName, Vector2 at, double angle, Vector2 velocity, bool pingBack)
        {
            if (_game.UserHandler.UserExistsAndReady(Context.ConnectionId))
            {
                try
                {
                    if (pingBack)
                    {
                        Clients.Caller.pingBack();
                    }

                    Ship ship = _game.UserHandler.GetUserShip(Context.ConnectionId);

                    if (ship.Controllable.Value)
                    {
                        ship.DeactivateAbility(abilityName, at, angle, velocity);
                    }
                }
                catch (Exception e)
                {
                    ErrorLog.Instance.Log(e);
                }
            }
        }