예제 #1
0
 /// <summary>
 /// Konštruktor inicializuje všetko potrebné
 /// </summary>
 /// <param name="paBocneMenu">trieda, ktorá spravuje bočné menu</param>
 public TlacitkaNaPloche(BocneMenu paBocneMenu)
 {
     aHra       = Hra.DajInstanciu();
     aKamera    = Kamera.DajInstanciu();
     aBocneMenu = paBocneMenu;
     aStav      = false;
 }
예제 #2
0
        /// <summary>
        /// Vykonanie pohybu. Vie sa �iasto�ne vyh�ba� prek�kam a �iasto�ne h�ada� trasu,
        /// preto potrebuje vodiace b�je, ktor� musia by� umiestnen� "dostato�ne" spr�vne...
        /// </summary>
        public override void VykonajPohyb()
        {
            if (Strateny) return;
            if (aAktualnyFrame == FramePohyb)
            {
                bool podarilosa = aPreferenciaPohybu ? PohybPreferencia1() : PohybPreferencia2();

                if (podarilosa)
                {
                }
                else if (Poloha.Stlpec > aPolohaDo.Stlpec || Poloha.Stlpec < aPolohaDo.Stlpec ||
                         Poloha.Riadok > aPolohaDo.Riadok || Poloha.Riadok < aPolohaDo.Riadok)
                {
                    aPokusyNahPoh = 0;
                    NahodnyPohyb();
                    ZmenPreferenciu();
                }
                else
                {
                    JeVCieli = true;
                    Zastav();
                }
                if (Strateny)
                {
                    Sprava.Info("Lo� sa stratila");
                    Kamera.DajInstanciu().VycentrujPohlad(Poloha);
                }
                aAktualnyFrame = 0;
            }
            aAktualnyFrame++;
        }
예제 #3
0
        public Kamera Update(Kamera kamera)
        {
            var result = kamera;

            _kameraServices.Update(kamera);

            return(result);
        }
예제 #4
0
        public Kamera Delete(Kamera kamera)
        {
            var result = kamera;

            _kameraServices.Delete(kamera);

            return(result);
        }
예제 #5
0
        public Kamera Ekle(Kamera kamera)
        {
            var result = kamera;

            _kameraServices.Add(kamera);

            return(result);
        }
        public Robot(string kodSerii, int nrSerii)
        {
            this._kodSerii = kodSerii;
            this._nrSerii  = nrSerii;
            this._wlaczony = false;

            kamera   = new Kamera();
            mikrofon = new Mikrofon();
            glosnik  = new Glosnik();
            lampa    = new Lampa();
        }
예제 #7
0
 public GrafikHändelser(IGrafikkommandon grafikkommandon, IBild tileset, IBuffertväxlare buffertväxlare, IVisa visaSpelvärld, Kamera kamera, IVisa visaStatus, ISkärm skärm)
 {
     _gl             = grafikkommandon;
     _tileset        = tileset;
     _buffertväxlare = buffertväxlare;
     _visaSpelvärld  = visaSpelvärld;
     _visaStatus     = visaStatus;
     _kamera         = kamera;
     _scaleFactor    = 4.0;
     _skärm          = skärm;
 }
예제 #8
0
파일: Program.cs 프로젝트: ic15b092/oom
        static void Main(string[] args)
        {
            Kamera X = new Kamera("Sony STC300IR", 3.0, 800);
            Kamera Z = new Kamera("Geovision BL1300", 1.3, 670);

            Console.WriteLine("Die Bezeichnung der X Kamera ist {0}.", X.Bezeichnung);
            Console.WriteLine("Die Aufloesung der Z Kamera ist {0}MP.", Z.Aufloesung);
            var neuerPreis = X.UpdatePreis(790);

            Console.WriteLine("Der Preis der X Kamera ist EUR{0}.", X.Preis);
        }
예제 #9
0
        public void Uppdaterar_skärmens_storlek_med_en_faktor_4()
        {
            var visaSpelvärld   = Substitute.For <IVisa>();
            var visaStatus      = Substitute.For <IVisa>();
            var grafikkommandon = Substitute.For <IGrafikkommandon>();
            var buffertväxlare  = Substitute.For <IBuffertväxlare>();
            var kamera          = new Kamera(new Skärmyta(10, 10));
            var skärm           = Substitute.For <ISkärm>();
            var grafikhändelser = new GrafikHändelser(grafikkommandon, null, buffertväxlare, visaSpelvärld, kamera, visaStatus, skärm);

            grafikhändelser.ÄndraStorlek(16, 20);

            skärm.Received().ÄndraStorlek(new Skärmyta(4, 5));
        }
예제 #10
0
 /// <summary>
 /// Vykreslenie obr�zku s krontrolou, �i sa nach�dza na kamere
 /// </summary>
 /// <param name="paGafika"></param>
 public void DrawImage(Graphics paGafika)
 {
     aKamera = Kamera.DajInstanciu();
     if (Skryte) return;
     if (aX >= (aKamera.OdsadenieX - 2) * Policko.cVelkostPolicka && aX < (aKamera.OdsadenieX + Kamera.cPocetOkienStplce - PozadieMenu.cPosunZBoku) * Policko.cVelkostPolicka)
     {
         if (aY >= (aKamera.OdsadenieY - 2) * Policko.cVelkostPolicka && aY < (aKamera.OdsadenieY + Kamera.cPocetOkienRiadky - PozadieMenu.cPosunZVrchu) * Policko.cVelkostPolicka)
         {
             int tempX = aX - aKamera.OdsadenieX * Policko.cVelkostPolicka + Policko.cVelkostPolicka * PozadieMenu.cPosunZBoku;
             int tempY = aY - aKamera.OdsadenieY * Policko.cVelkostPolicka + Policko.cVelkostPolicka * PozadieMenu.cPosunZVrchu;
             paGafika.DrawImage(aObrazok, tempX, tempY);
             aObdlznik = new Rectangle(tempX, tempY, aSirkaPX, aVyskaPX);
         }
     }
 }
예제 #11
0
        /// <summary>
        /// Vyhľadanie trasy pokocou dijkstru
        /// </summary>
        /// <param name="paPolohaDo"></param>
        /// <returns></returns>
        public override bool NajdiTrasu(Poloha paPolohaDo)
        {
            JeVCieli        = false;
            aHranaNaTrase   = 0;
            aPoziciaNaHrane = 0;

            aTrasa = DijkstrovAlg.NajdiTrasu(Poloha, paPolohaDo, Druh);
            if (aTrasa == null)
            {
                Strateny = true;
                Sprava.Info("Vlak sa stratil");
                Kamera.DajInstanciu().VycentrujPohlad(Poloha);
                return(false);
            }
            return(true);
        }
예제 #12
0
    public void StartFile(Texture tex)
    {
        Debug.Log("Kauel: StartFile()");

        singleton = this;

        Mode = KameraMode.File;

        // if (NatCam.IsPlaying) NatCam.Pause();
        // if (NatCam.IsRunning) NatCam.StopPreview();
        ConfigureForTexture(tex);

        DetectEdges();

        PanelSelector.HideAll();
    }
예제 #13
0
        public override void LoadContent(ContentManager content, GraphicsDeviceManager Graphics)
        {
            graphicdevice = Graphics.GraphicsDevice;
            //Jannicks-Teil
            effect = new BasicEffect(graphicdevice);
            levelloader.Array_Loader(content);

            //Gabriels-Teil
            player    = new Player(lichtPos - lichtDir, content.Load <Model>("3DModelle/Player"), levelnummer, content, ref levelloader);
            camera    = new Kamera(player.position);
            licht     = new Lichtstrahl(content.Load <Model>("3DModelle/partikel"), lichtPos, lichtDir, levelnummer, content.Load <Effect>("Shader/PartikelEffect"), content.Load <SoundEffect>("Audio/Tür"));
            pausemenü = new PauseMenü(content, anzahllevel, levelnummer);
            tutorial.LoadContent(content);

            //Annes-Teil
            timer.setFont(content);
            timer.setTexture(content);
            timer.Position  = new Vector2(50, 15);
            score           = content.Load <Texture2D>("2DTexturen/Score");
            schriftartscore = content.Load <SpriteFont>("Fonts/Normal");
        }
예제 #14
0
        protected override void OnLoad(EventArgs e)
        {
            cam = new Kamera(this, new Vector3(0.0f, 0.0f, 3.0f), new Vector3(0, 0, 0), 0.1f, 0.05f);

            VertexBuffer <float> vbo = new VertexBuffer <float>();

            vbo.Bind();
            vbo.BufferData(vertices);

            boxVao = new VertexArray();
            boxVao.Bind();
            boxVao.SetVertexAttrib <float>(0, 3, VertexAttribPointerType.Float, false, 8, 0); //pos
            boxVao.SetVertexAttrib <float>(1, 3, VertexAttribPointerType.Float, false, 8, 3); //norm
            boxVao.SetVertexAttrib <float>(2, 2, VertexAttribPointerType.Float, false, 8, 6); //texCoord
            boxVao.Unbind();

            lampVao = new VertexArray();
            lampVao.Bind();
            vbo.Bind();                                                                        //müssen wir nochmal
            lampVao.SetVertexAttrib <float>(0, 3, VertexAttribPointerType.Float, false, 8, 0); //pos
            lampVao.SetVertexAttrib <float>(1, 3, VertexAttribPointerType.Float, false, 8, 3); //norm
            lampVao.SetVertexAttrib <float>(2, 2, VertexAttribPointerType.Float, false, 8, 6); //texCoord
            lampVao.Unbind();
            vbo.Unbind();


            lightingShader = new ShaderProgram(Shader.FromFile("Shader/vertexBase.c"), Shader.FromFile("Shader/fragmentBase.c"));
            lampShader     = new ShaderProgram(Shader.FromFile("Shader/vertexBase.c"), Shader.FromFile("Shader/fragmentLamp.c"));

            diffuseMapTexture  = new Texture("Data/container2.png", 0, "material.diffuse");
            specularMapTexture = new Texture("Data/container2_specular.png", 1, "material.specular");

            containerMat = new Material();
            containerMat.AddTexture("diffuse", diffuseMapTexture);
            containerMat.AddTexture("specular", specularMapTexture);
            containerMat.AddFloat("shininess", 32.0f);

            GL.Enable(EnableCap.DepthTest);
        }
예제 #15
0
        protected override void OnLoad(EventArgs e)
        {
            cam = new Kamera(this, new Vector3(0, 0, 2), new Vector3(0), 0.2f, 0.1f);

            lightingShader = new ShaderProgram(Shader.FromFile(basicVertexSrc), Shader.FromFile(lightingFragSrc));
            lampShader     = new ShaderProgram(Shader.FromFile(basicVertexSrc), Shader.FromFile(lampFragSrc));

            diffuseMap  = new Texture("Data/container2.png", 0, "diffuse");
            specularMap = new Texture("Data/container2_specular.png", 1, "specular");

            VertexBuffer <float> vbo = new VertexBuffer <float>();

            vbo.Bind();
            vbo.BufferData(vertices);

            //container vao
            containerVao = new VertexArray();
            containerVao.Bind();
            int vertexStride = (3 + 3 + 2) * 4;

            GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, vertexStride, 0); //0 = pos in basic_vertex.c
            GL.EnableVertexAttribArray(0);
            GL.VertexAttribPointer(1, 3, VertexAttribPointerType.Float, false, vertexStride, 12);
            GL.EnableVertexAttribArray(1);
            GL.VertexAttribPointer(2, 2, VertexAttribPointerType.Float, false, vertexStride, 24);
            GL.EnableVertexAttribArray(2);
            containerVao.Unbind();

            lampVao = new VertexArray();
            lampVao.Bind();
            vbo.Bind();                                                                          //so vao knows to use this
            GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, vertexStride, 0); //0 = pos in basic_vertex.c
            GL.EnableVertexAttribArray(0);
            lampVao.Unbind();
            GL.Enable(EnableCap.DepthTest);
        }
예제 #16
0
 public void Delete(Kamera kamera)
 {
     _kameraDal.Delete(kamera);
 }
예제 #17
0
 public void Update(Kamera kamera)
 {
     _kameraDal.Update(kamera);
 }
예제 #18
0
 void Awake()
 {
     kameraScript = Camera.main.GetComponent <Kamera>();
 }
예제 #19
0
    public Game()
    {
        one = 1;
        map = new Map();
        performanceinfo = new DictionaryStringString();
        AudioEnabled = true;
        AutoJumpEnabled = false;
        playerPositionSpawnX = 15 + one / 2;
        playerPositionSpawnY = 64;
        playerPositionSpawnZ = 15 + one / 2;

        TextureId = new int[MaxBlockTypes][];
        for (int i = 0; i < MaxBlockTypes; i++)
        {
            TextureId[i] = new int[6];
        }
        TextureIdForInventory = new int[MaxBlockTypes];
        language = new Language();
        lastplacedblockX = -1;
        lastplacedblockY = -1;
        lastplacedblockZ = -1;
        mLightLevels = new float[16];
        sunlight_ = 15;
        mvMatrix = new StackMatrix4();
        pMatrix = new StackMatrix4();
        mvMatrix.Push(Mat4.Create());
        pMatrix.Push(Mat4.Create());
        whitetexture = -1;
        cachedTextTexturesMax = 1024;
        cachedTextTextures = new CachedTextTexture[cachedTextTexturesMax];
        for (int i = 0; i < cachedTextTexturesMax; i++)
        {
            cachedTextTextures[i] = null;
        }
        packetLen = new IntRef();
        ENABLE_DRAW2D = true;
        AllowFreemove = true;
        enableCameraControl = true;
        textures = new DictionaryStringInt1024();
        ServerInfo = new ServerInformation();
        menustate = new MenuState();
        mouseleftclick = false;
        mouseleftdeclick = false;
        wasmouseleft = false;
        mouserightclick = false;
        mouserightdeclick = false;
        wasmouseright = false;
        ENABLE_LAG = 0;
        znear = one / 10;
        CameraMatrix = new GetCameraMatrix();
        ENABLE_ZFAR = true;
        TotalAmmo = new int[GlobalVar.MAX_BLOCKTYPES];
        LoadedAmmo = new int[GlobalVar.MAX_BLOCKTYPES];
        AllowedFontsCount = 1;
        AllowedFonts = new string[AllowedFontsCount];
        AllowedFonts[0] = "Verdana";
        fov = Game.GetPi() / 3;
        cameratype = CameraType.Fpp;
        ENABLE_TPP_VIEW = false;
        basemovespeed = 5;
        movespeed = 5;
        RadiusWhenMoving = one * 3 / 10;
        playervelocity = new Vector3Ref();
        LocalPlayerId = -1;
        dialogs = new VisibleDialog[512];
        dialogsCount = 512;
        blockHealth = new DictionaryVector3Float();
        playertexturedefault = -1;
        a = new AnimationState();
        constRotationSpeed = one * 180 / 20;
        modmanager = new ClientModManager1();
        particleEffectBlockBreak = new ModDrawParticleEffectBlockBreak();
        PICK_DISTANCE = 4.1f;
        selectedmodelid = -1;
        grenadetime = 3;
        rotationspeed = one * 15 / 100;
        entities = new Entity[entitiesMax];
        for (int i = 0; i < entitiesMax; i++)
        {
            entities[i] = null;
        }
        entitiesCount = 512;
        PlayerPushDistance = 2;
        const int KeysMax = 256;
        keyboardState = new bool[KeysMax];
        for (int i = 0; i < KeysMax; i++)
        {
            keyboardState[i] = false;
        }
        keyboardStateRaw = new bool[KeysMax];
        for (int i = 0; i < KeysMax; i++)
        {
            keyboardStateRaw[i] = false;
        }
        overheadcameradistance = 10;
        tppcameradistance = 3;
        TPP_CAMERA_DISTANCE_MIN = 1;
        TPP_CAMERA_DISTANCE_MAX = 10;
        options = new OptionsCi();
        overheadcameraK = new Kamera();
        fillAreaLimit = 200;
        speculativeCount = 0;
        speculative = new Speculative[speculativeMax];
        typinglog = new string[1024 * 16];
        typinglogCount = 0;
        NewBlockTypes = new Packet_BlockType[GlobalVar.MAX_BLOCKTYPES];
        localplayeranim = new AnimationState();
        localplayeranimationhint = new AnimationHint();
        enable_move = true;
        handTexture = -1;
        modelViewInverted = new float[16];
        GLScaleTempVec3 = Vec3.Create();
        GLRotateTempVec3 = Vec3.Create();
        GLTranslateTempVec3 = Vec3.Create();
        identityMatrix = Mat4.Identity_(Mat4.Create());
        Set3dProjectionTempMat4 = Mat4.Create();
        getAsset = new string[1024 * 2];
        PlayerStats = new Packet_ServerPlayerStats();
        mLightLevels = new float[16];
        for (int i = 0; i < 16; i++)
        {
            mLightLevels[i] = one * i / 15;
        }
        soundnow = new BoolRef();
        camera = Mat4.Create();
        packetHandlers = new ClientPacketHandler[256];
        player = new Entity();
        player.position = new EntityPosition_();
        currentlyAttackedEntity = -1;
        ChatLinesMax = 1;
        ChatLines = new Chatline[ChatLinesMax];
        ChatLineLength = 64;
        audio = new AudioControl();
        CameraEyeX = -1;
        CameraEyeY = -1;
        CameraEyeZ = -1;
        controls = new Controls();
        movedz = 0;
        taskScheduler = new TaskScheduler();
        commitActions = ListAction.Create(16 * 1024);
        constWallDistance = 0.3f;
        mouseSmoothing = true;
    }
예제 #20
0
 /// <summary>
 /// kon�truktor
 /// </summary>
 public ZakladObrazku()
 {
     aKamera = Kamera.DajInstanciu();
     Skryte = false;
 }
예제 #21
0
 public void Add(Kamera kamera)
 {
     _kameraDal.Add(kamera);
 }
예제 #22
0
/*
 *  void OnStart(Texture preview)
 *  {
 *      // Create texture
 *      Texture2D _texture2D = new Texture2D(preview.width, preview.height, TextureFormat.RGBA32, false, false);
 *
 *      _texture2D.ReadPixels(new Rect(0, 0, preview.width, preview.height), 0, 0);
 *      _texture2D.Apply();
 *
 *      RawImageCamera.texture = _texture2D;
 *      // Scale the panel to match aspect ratios
 *      aspectFitter.aspectRatio = preview.width / (float)preview.height;
 *      // Create pixel buffer
 *    //  Video_buffer = new byte[preview.width * preview.height * 4];
 *  }
 *
 *  /*
 *
 *  void OnFrame()
 *  {
 *      Texture2D texture = new Texture2D(NatCamCamera.PreviewResolution.x, NatCamCamera.PreviewResolution.y, TextureFormat.RGBA32, false, false);
 *      // Capture the preview frame
 *      NatCamCamera.CaptureFrame(Video_buffer);
 *      // Convert to greyscale
 *    //  ConvertToGrey(Video_buffer);
 *      // Fill the texture with the greys
 *      texture.LoadRawTextureData(Video_buffer);
 *      texture.Apply();
 *      RawImageCamera.texture = texture;
 *
 *  }
 *
 */
    /*
     *      void OnStart (Texture preview) {
     *          // Create texture
     *          texture = new Texture2D(preview.width, preview.height, TextureFormat.RGBA32, false, false);
     *          rawImage.texture = texture;
     *          // Scale the panel to match aspect ratios
     *          aspectFitter.aspectRatio = preview.width / (float)preview.height;
     *          // Create pixel buffer
     *          buffer = new byte[preview.width * preview.height * 4];
     *      }
     *
     *      void OnFrame () {
     *          // Capture the preview frame
     *          deviceCamera.CaptureFrame(buffer);
     *          // Convert to greyscale
     *          ConvertToGrey(buffer);
     *          // Fill the texture with the greys
     *          texture.LoadRawTextureData(buffer);
     *          texture.Apply();
     *      }
     *
     */
    public void Init()
    {
        Debug.Log("Kauel: Init()");

        singleton = this;
    }
예제 #23
0
    void Start()
    {
        Debug.Log("Kauel: Start()");

        singleton = this;
    }
예제 #24
0
    public void StartCamera()
    {
        //   if (NatCamCamera == null) {
        //      Debug.Log("entra aqui?");
        // NatCamCamera = DeviceCamera.FrontCamera;
        //NatCamCamera.StartPreview(OnStart, OnFrame);
        //   NatCamCamera.StartPreview(OnStart);
        //  }


        Debug.Log("Kauel: StartCamera()");

        singleton = this;

        Mode = KameraMode.Camera;

        /////////////////////////////////////////////////////   RawImageCamera.texture = previewTexture;
        //RawImageCamera.texture = preview;
        //previewTexture = preview;

#if UNITY_EDITOR
        NatCamCamera = DeviceCamera.Cameras[0];
        ////////////////////////////////////////////////////// CamCreated = true;
#elif UNITY_ANDROID
        Debug.Log("Kauel: Android");

        NatCamCamera = DeviceCamera.RearCamera;


        /*  if (NatCam.HasPermissions) {
         *
         *    Debug.Log("Kauel: NatCam permissions OK :)");
         *
         * } else {
         *
         *    Debug.Log("Kauel: NatCam has NO PERMISSIONS!!!");
         *
         * }
         *
         * NatCamCamera = CameraDevice.GetDevices()[0];
         */

        // NatCamCamera = DeviceCamera.Cameras[0];
        if (!CamCreated)
        {
            //   CamCreated = true;
            //   NatCamCamera = DeviceCamera.Cameras[0];
            //   NatCamCamera = DeviceCamera.RearCamera;
            //   NatCamCamera.PreviewResolution.Set(1920, 1080);
            //   NatCamCamera.PhotoResolution.Set(1920, 1080);
            //   Debug.Log("Kauel: CamCreated");

            // NatCam.Camera = DeviceCamera.RearCamera;
            // var NatCamCamera = CameraDevice.GetDevices()[0];
            //  NatCamCamera = CameraDevice.GetDevices()[0];

            // NatCamCamera = DeviceCamera.RearCamera;

            //  NatCamCamera.SetPreviewResolution(ResolutionPreset.FullHD);
            //  NatCamCamera.SetPhotoResolution(ResolutionPreset.FullHD);
            //  NatCamCamera.SetFramerate(FrameratePreset.Default);

            //  Debug.Log("Kauel: CamCreated");
        }
#elif UNITY_IOS
        Debug.Log("Kauel: iOS");



        if (!CamCreated)
        {
            CamCreated = true;

            //NatCam.Camera = DeviceCamera.RearCamera;
            var NatCam.Camera = CameraDevice.GetDevices()[0];

            NatCam.Camera.SetPreviewResolution(ResolutionPreset.FullHD);

            NatCam.Camera.SetPhotoResolution(ResolutionPreset.FullHD);

            Debug.Log("Kauel: CamCreated");
        }
#endif



        NatCamCamera.StartPreview(OnStart);

        PanelSelector.ShowOnlyThisPanel(0); //Solo el panel de fotos

        Debug.Log("Kauel: StartCamera() ha finalizado");
    }
예제 #25
0
        private void Initiera()
        {
            var tileset = new BildWrapper("Images/tiles.png");

            var inställningar = new SpelfönsterInställningar
            {
                Fullskärm   = true,
                DoldaKanter = true,
                VSync       = true,
                Bredd       = 16 * 32,
                Höjd        = 16 * 32
            };
            var tangentmappning = new Dictionary <Key, Tangent> {
                { Key.Right, Tangent.Höger },
                { Key.Left, Tangent.Vänster },
                { Key.Up, Tangent.Upp },
                { Key.Down, Tangent.Ner },
                { Key.Escape, Tangent.Escape }
            };

            _fönster = new Spelfönster(tangentmappning, inställningar);
            var spelvärld             = new Spelvärld();
            var grafikkommandon       = new GLWrapper();
            var brickstorlek          = new Rektangel(16, 16);
            var kamera                = new Kamera(new Skärmyta(100, 100));
            var positionskonverterare = new Positionskonverterare(new Skärmyta(16, 16));

            var radioaktivInsektBricka = new Bricka(grafikkommandon, new Skärmposition(5 * 16, 0), new Skärmyta(16, 16));
            var tomBricka           = new Bricka(grafikkommandon, new Skärmposition(15 * 16, 15 * 16), new Skärmyta(16, 16));
            var takBricka           = new Bricka(grafikkommandon, new Skärmposition(2 * 16, 1 * 16), new Skärmyta(16, 16));
            var kabel1Bricka        = new Bricka(grafikkommandon, new Skärmposition(3 * 16, 1 * 16), new Skärmyta(16, 16));
            var kabel2Bricka        = new Bricka(grafikkommandon, new Skärmposition(4 * 16, 1 * 16), new Skärmyta(16, 16));
            var takMedRevaBricka    = new Bricka(grafikkommandon, new Skärmposition(1 * 16, 1 * 16), new Skärmyta(16, 16));
            var ammoBricka          = new Bricka(grafikkommandon, new Skärmposition(0 * 16, 1 * 16), new Skärmyta(16, 16));
            var huvudkaraktärBricka = new Bricka(grafikkommandon, new Skärmposition(0 * 16, 0 * 16), new Skärmyta(16, 16));
            var medicinBricka       = new Bricka(grafikkommandon, new Skärmposition(3 * 16, 2 * 16), new Skärmyta(16, 16));
            var paradisBricka       = new Bricka(grafikkommandon, new Skärmposition(3 * 16, 3 * 16), new Skärmyta(16, 16));
            var hälsomätarram       = new Bricka(grafikkommandon, new Skärmposition(80, 32), new Skärmyta(80, 16));
            var hälsomätargrönt     = new Bricka(grafikkommandon, new Skärmposition(80, 48), new Skärmyta(80, 16));

            spelvärld.Huvudkaraktär = new Huvudkaraktär(4)
            {
                Position = new Spelvärldsposition(1, 1),
                Grafik   = huvudkaraktärBricka
            };

            var skärm = new Skärm();

            var ucVisaSpelvärld = new VisaSpelvärld(spelvärld, positionskonverterare);
            var ucVisaStatus    = new VisaStatus(hälsomätarram, hälsomätargrönt, spelvärld.Huvudkaraktär, skärm);

            var karta       = SkapaKarta();
            var hinderlista = new[] { 0 };
            var hinderkarta = karta.SkapaHinderkarta(hinderlista);

            var ucFlyttaVarelser      = new FlyttaVarelser(spelvärld, hinderkarta);
            var ucUtdelaSkada         = new UtdelaSkada(spelvärld);
            var ucDödaKritisktSkadade = new DödaKritisktSkadade(spelvärld);
            var ucUppdateraSpelvärld  = new UppdateraSpelvärld(ucFlyttaVarelser, ucUtdelaSkada, ucDödaKritisktSkadade);
            var openTKHanterare       = new GrafikHändelser(grafikkommandon, tileset, _fönster, ucVisaSpelvärld, kamera, ucVisaStatus, skärm);
            var kontrollhändelser     = new KontrollHändelser(ucUppdateraSpelvärld, _fönster);

            _fönster.Laddare(openTKHanterare);
            _fönster.StorleksÄndrare(openTKHanterare);
            _fönster.Uppdaterare(openTKHanterare);
            _fönster.Visare(openTKHanterare);
            _fönster.Tangentbordsmottagare(kontrollhändelser);

            var omgivningensBrickor = new Bricka[] {
                tomBricka,
                takBricka,
                kabel1Bricka,
                kabel2Bricka,
                takMedRevaBricka,
                paradisBricka
            };

            spelvärld.MiljöGrafik = new Brickfält(omgivningensBrickor, karta.Indexar, karta.Bredd, new Skärmyta(16, 16));

            var slumpgenerator = new Random();
            var väderstrecken  = new List <Spelvärldsposition>
            {
                new Spelvärldsposition(1, 0),
                new Spelvärldsposition(0, 1),
                new Spelvärldsposition(-1, 0),
                new Spelvärldsposition(0, -1)
            };

            var irraRunt = new SekvensFörflyttning(väderstrecken, new SekvensFörflyttning.SlumpmässigIndexgenerator(slumpgenerator));

            spelvärld.Fienden = new List <Fiende>
            {
                new Fiende {
                    Position           = new Spelvärldsposition(5, 5),
                    Grafik             = radioaktivInsektBricka,
                    Riktningsgenerator = irraRunt
                },
                new Fiende {
                    Position           = new Spelvärldsposition(13, 5),
                    Grafik             = radioaktivInsektBricka,
                    Riktningsgenerator = irraRunt
                }
            };
        }
예제 #26
0
파일: Level.cs 프로젝트: koguz/se354_2013
 /* Level File
  * 0 -> empty
  * 1 -> wall
  * 2 -> machine gun spawn point
  * 3 -> repair kit spawn point
  * 4 -> player spawn point
  * 5 -> water
  * 6 -> armour spawn point
  * 7 -> bfg spawn point
  * 8 -> cannon spawn point
  * 9 -> grenade spawn point
  * 10 -> hex damage spawn point
  * 11 -> invulnerability spawn point
  * 12 -> missile spawn point
  */
 // Use this for initialization
 void Start()
 {
     spidx = 0;
     kameraSure = Time.time;
     kameraIdx = 0;
     LoadMap();
     LoadPlayers();
     ps = GameObject.FindGameObjectsWithTag("Player");
     sure = 310;
     kameraScript = kamera.GetComponent<Kamera>();
     kameraScript.tank = ps[kameraIdx].transform;
 }
예제 #27
0
파일: Level.cs 프로젝트: koguz/se354_2014
 /* Level File
  * 0 -> empty
  * 1 -> wall
  * 2 -> machine gun spawn point
  * 3 -> health kit spawn point
  * 4 -> UNUSED - player spawn point
  * 5 -> water
  * 6 -> armour spawn point
  * 7 -> doomsday spawn point
  * 8 -> hex damage spawn point
  * 9 -> grenade spawn point
  * r-> redflag
  * b -> blueflag
  * k -> redplayers
  * m	 -> blueplayers
  */
 // Use this for initialization
 void Start()
 {
     redMaterial = (Material) Resources.Load ("Red", typeof(Material));
     blueMaterial = (Material) Resources.Load ("Blue", typeof(Material));
     redFlag = (GameObject) GameObject.Instantiate(Resources.Load ("Flag"));
     blueFlag = (GameObject) GameObject.Instantiate(Resources.Load ("Flag"));
     redFlag.transform.FindChild("Bez").renderer.material = redMaterial;
     blueFlag.transform.FindChild("Bez").renderer.material = blueMaterial;
     redFlag.GetComponent<Flag>().team = "Red";
     blueFlag.GetComponent<Flag>().team = "Blue";
     spidx = 0;
     kameraSure = Time.time;
     kameraIdx = 0;
     LoadMap();
     LoadPlayers();
     ps = GameObject.FindGameObjectsWithTag("Player");
     sure = 310;
     kameraScript = kamera.GetComponent<Kamera>();
     kameraScript.player = ps[kameraIdx].transform;
 }