Пример #1
0
    void onFootballerDynamicDataGet(string alias, GeoLib.Vector2 position, GeoLib.Vector2 velocity, int enduraneState)
    {
        foreach (Player player in players)
        {
            if (player.Data.Alias == alias)
            {
                player.EnduranceState = enduraneState;
                player.Position       = new Godot.Vector2((float)position.X, (float)position.Y);
                player.Velocity       = new Godot.Vector2((float)velocity.X, (float)velocity.Y);;

                if (player.Data.Alias == SessionData.User.Alias)
                {
                    playerDataPanel.Update(enduraneState, player.Velocity);
                }
            }
        }
    }
    Godot.Vector2 getFlyableLaunchForce()
    {
        GeoLib.Vector2 mousePos   = new GeoLib.Vector2(flyable.GetGlobalMousePosition().x, flyable.GetGlobalMousePosition().y);
        GeoLib.Vector2 flyablePos = new GeoLib.Vector2(flyable.Position.x, flyable.Position.y);

        MathLine strikeLine = new MathLine(mousePos, flyablePos);
        double   angle      = strikeLine.GetAcuteAngle();

        float xForce = Flyable.FORCE * (float)Math.Cos(angle);
        float yForce = Flyable.FORCE * (float)Math.Sin(angle);

        Godot.Vector2 hitForce = new Godot.Vector2(xForce, yForce);

        if (mousePos.X < flyablePos.X)
        {
            hitForce *= -1;
        }

        return(hitForce);
    }
Пример #3
0
 void onBallDataGet(GeoLib.Vector2 position, GeoLib.Vector2 velocity)
 {
     ball.Position = new Godot.Vector2((float)position.X, (float)position.Y);
     ball.Velocity = new Godot.Vector2((float)velocity.X, (float)velocity.Y);
 }