Beispiel #1
0
    public Player(int id, string name, Vector2 position, Map m)
        : base(position, m)
    {
        playerID   = id;
        playerName = name;

        keyboard          = new KeyboardWatch();
        mouse             = new MouseWatch();
        mouse.Perspective = Map.GameCamera;

        float charHeight = 165f;
        float h          = (float)playerTileset.Height / charHeight;
        float w          = ((float)playerTileset.Width / playerTileset.Height);

        playerMesh         = sprite.Mesh;
        playerMesh.Tileset = playerTileset;

        playerMesh.Vertices2 = new Vector2[] {
            new Vector2(-0.5f * w * h, -0.5f + h),
            new Vector2(0.5f * w * h, -0.5f + h),
            new Vector2(0.5f * w * h, -0.5f),
            new Vector2(-0.5f * w * h, -0.5f)
        };

        playerMesh.UV = new Vector2[] {
            new Vector2(0, 1),
            new Vector2(1, 1),
            new Vector2(1, 0),
            new Vector2(0, 0)
        };

        shadow = new PlayerShadow(this, playerMesh);

        dashCooldown  = new Timer(stats.DashCooldown, false);
        dodgeCooldown = new Timer(stats.DodgeCooldown, true);

        hud = new PlayerHud(this);

        ownedWeapons.Add(WeaponList.Pistol);

        size = size * 1.4f;
    }
Beispiel #2
0
    public Map(int id, string filename, GameMode mode)
    {
        currentMap = this;

        this.filename = filename;
        this.mode     = mode;

        myID = id;

        scene = new Scene(filename, this);

        gameCamera = new Camera();
        gameCamera.Use();

        uiCamera            = new Camera();
        uiCamera.Orthogonal = true;

        cameraController = new CameraControl(this, gameCamera);

        keyboard = new KeyboardWatch();
    }
Beispiel #3
0
    public Editor(EditorForm form)
    {
        CurrentEditor = this;

        this.form = form;

        editorCamera = new Camera();
        editorCamera.Use();

        mouse             = new MouseWatch();
        mouse.Perspective = editorCamera;

        keyboard = new KeyboardWatch();

        manipulators = new Manipulator[] { new Manipulator(this), new ManipulatorTranslate(this), new ManipulatorRotate(this), new ManipulatorScale(this), new VertexPen(this) };

        gridModel = new Model();
        gridModel.PrimitiveType = PrimitiveType.Lines;

        List <Vector3> gridVertices = new List <Vector3>();

        for (int i = -50; i <= 50; i++)
        {
            gridVertices.Add(new Vector3(-50f, i, 0));
            gridVertices.Add(new Vector3(50f, i, 0));
            gridVertices.Add(new Vector3(i, -50f, 0));
            gridVertices.Add(new Vector3(i, 50f, 0));
        }

        gridModel.VertexPosition = gridVertices.ToArray();

        cameraControl = new CameraControl(this);
        selectionBox  = new SelectionBox(this);
        meshCreator   = new MeshCreator(this);

        rootLayer = new LayerNode("root", this);
    }