Ejemplo n.º 1
0
        public void bot_startAbility(string abilityName)
        {
            if (_game.UserHandler.UserExistsAndReady(Context.ConnectionId))
            {
                try
                {
                    Ship ship = _game.UserHandler.GetUserShip(Context.ConnectionId);

                    if (ship.Controllable.Value)
                    {
                        ship.ActivateAbility(abilityName);
                    }
                }
                catch (Exception e)
                {
                    _logger.LogError("registerAbilityStart", e);
                }
            }
        }
Ejemplo n.º 2
0
        public void registerAbilityStart(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.ActivateAbility(abilityName, commandID);
                    }
                }
                catch (Exception e)
                {
                }
            }
        }
Ejemplo n.º 3
0
        public async Task registerAbilityStart(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.ActivateAbility(abilityName, at, angle, velocity);
                    }
                }
                catch (Exception e)
                {
                    _logger.LogError("registerAbilityStart", e);
                }
            }
        }
Ejemplo n.º 4
0
        public void registerAbilityStart(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.ActivateAbility(abilityName, at, angle, velocity);
                    }
                }
                catch (Exception e)
                {
                    ErrorLog.Instance.Log(e);
                }
            }
        }