Exemple #1
0
 public RenderWindow(Clyde clyde, ClydeHandle handle) : base(clyde, handle)
 {
 }
Exemple #2
0
 public Buffer(Clyde clyde, BufferTarget type, BufferUsageHint usage, Span <T> initialize, string name = null)
     : base(clyde, type, usage, MemoryMarshal.AsBytes(initialize), name)
 {
 }
Exemple #3
0
 protected RenderTargetBase(Clyde clyde, ClydeHandle handle)
 {
     Clyde  = clyde;
     Handle = handle;
 }
Exemple #4
0
 public RenderTexture(Vector2i size, ClydeTexture texture, Clyde clyde, ClydeHandle handle)
     : base(clyde, handle)
 {
     Size    = size;
     Texture = texture;
 }
Exemple #5
0
    public void ParseLevel()
    {
        foreach (var go in m_objects)
        {
            Destroy(go);
        }

        m_objects   = new List <GameObject>();
        m_text.text = string.Empty;

        string path = m_input.text;

        if (!path.EndsWith(".pac"))
        {
            path = path + ".pac";
        }
        m_input.text = path;

        path = Path.Combine(@"Assets\levels", path);

        if (!File.Exists(path))
        {
            m_text.text += "file not available!" + Environment.NewLine;
            return;
        }

        Tile[,] tiles = new Tile[0, 0];
        //int[] characterPositions = new int[10];
        List <Vector3> charpos;

        m_text.text += "parsing started:" + Environment.NewLine;
        string level, figures;

        if (Parser.IsValidLevel(path, out level, out figures, ref m_text))
        {
            m_text.text += Environment.NewLine + "start building" + Environment.NewLine;
            tiles        = Parser.ParseValidLevel(level, ref m_text);

            //characterPositions = Parser.getCharacterPositions(figures);

            charpos      = Parser.GetCharPositions();
            m_text.text += " got positions" + Environment.NewLine;

            m_text.text += level + Environment.NewLine;
        }
        else
        {
            m_input.text = "level structure not valid" + Environment.NewLine;
            return;
        }

        GameObject[,] objs = new GameObject[tiles.GetLength(0), tiles.GetLength(1)];


        // build prefabs
        for (int r = 0; r < tiles.GetLength(0); r++)
        {
            for (int c = 0; c < tiles.GetLength(1); c++)
            {
                Vector3    pos = new Vector3(c, 0f, -r);
                Quaternion rot = Quaternion.Euler(0f, tiles[r, c].Rotation, 0f);

                GameObject go = null;
                #region switch
                switch (tiles[r, c].Type)
                {
                case Tile.Element.Block:
                    go = Block;
                    break;

                case Tile.Element.Corner:
                    go = Corner;
                    break;

                case Tile.Element.Corridor:
                    go = Corridor;
                    break;

                case Tile.Element.Cross:
                    go = Cross;
                    break;

                case Tile.Element.Deadend:
                    go = DeadEnd;
                    break;

                case Tile.Element.TCross:
                    go = TCross;
                    break;

                default:
                    break;
                }
                #endregion

                var inst = Instantiate(go, pos, rot);
                m_objects.Add(inst);
                objs[r, c] = inst;
            }
        }

        m_text.text += "level building finished w/success" + Environment.NewLine;

        for (int r = 0; r < tiles.GetLength(0); r++)
        {
            for (int c = 0; c < tiles.GetLength(1); c++)
            {
                if (tiles[r, c].ltrb_open[0])
                {
                    objs[r, c].GetComponent <WayPoint>().leftWaypoint = objs[r, c - 1].GetComponent <WayPoint>();
                }

                if (tiles[r, c].ltrb_open[1])
                {
                    objs[r, c].GetComponent <WayPoint>().upWaypoint = objs[r - 1, c].GetComponent <WayPoint>();
                }

                if (tiles[r, c].ltrb_open[2])
                {
                    objs[r, c].GetComponent <WayPoint>().rightWaypoint = objs[r, c + 1].GetComponent <WayPoint>();
                }

                if (tiles[r, c].ltrb_open[3])
                {
                    objs[r, c].GetComponent <WayPoint>().downWaypoint = objs[r + 1, c].GetComponent <WayPoint>();
                }
            }
        }
        m_text.text += "added waypoints to GameObjects" + Environment.NewLine;

        for (int i = 0; i < charpos.Count; i++)
        {
            m_text.text += "  char pos fig " + (i + 1) + ": " + charpos [i].x + " " + charpos [i].y + " " + charpos [i].z + objs[(int)charpos[0].x, -(int)charpos[0].z].GetComponent <WayPoint>() + Environment.NewLine;
        }
        m_text.text += "" + objs.GetLength(0) + " - " + objs.GetLength(1) + " / " + objs.Length;

        transform.position = new Vector3((tiles.GetLength(1) - 1) / 2f, 10, -(tiles.GetLength(0) - 1) / 2f);

        Pacman = Instantiate(Pacman, charpos[0], qempty);
        Blinky = Instantiate(Blinky, charpos[1], qempty);
        Inky   = Instantiate(Inky, charpos[2], qempty);
        Pinky  = Instantiate(Pinky, charpos[3], qempty);
        Clyde  = Instantiate(Clyde, charpos[4], qempty);

        Pacman.transform.position = charpos[0];
        Blinky.transform.position = charpos[1];
        Inky.transform.position   = charpos[2];
        Pinky.transform.position  = charpos[3];
        Clyde.transform.position  = charpos[4];

        m_objects.Add(Pacman);
        m_objects.Add(Blinky);
        m_objects.Add(Inky);
        m_objects.Add(Pinky);
        m_objects.Add(Clyde);

        //Pacman = Instantiate(Pacman, new Vector3(characterPositions[0], 0, -characterPositions[1]),  new Quaternion(0, 0, 0, 0));
        //Blinky = Instantiate(Blinky, new Vector3(characterPositions[2], 0, -characterPositions[3]), new Quaternion(0, 0, 0, 0));
        //Inky = Instantiate(Inky, new Vector3(characterPositions[4], 0, -characterPositions[5]), new Quaternion(0, 0, 0, 0));
        //Pinky = Instantiate(Pinky, new Vector3(characterPositions[6], 0, -characterPositions[7]), new Quaternion(0, 0, 0, 0));
        //Clyde = Instantiate(Clyde, new Vector3(characterPositions[8], 0, -characterPositions[9]), new Quaternion(0, 0, 0, 0));


        //Pacman.GetComponent<PlayerControlScript>().currentWaypoint = m_obj[characterPositions[0], characterPositions[1]].GetComponent<WayPoint>();
        //Blinky.GetComponent<EnemyBehaviourScript>().currentWaypoint = m_obj[characterPositions[2], characterPositions[3]].GetComponent<WayPoint>();
        //Inky.GetComponent<EnemyBehaviourScript>().currentWaypoint = m_obj[characterPositions[4], characterPositions[5]].GetComponent<WayPoint>();
        //Pinky.GetComponent<EnemyBehaviourScript>().currentWaypoint = m_obj[characterPositions[6], characterPositions[7]].GetComponent<WayPoint>();
        //Clyde.GetComponent<EnemyBehaviourScript>().currentWaypoint = m_obj[characterPositions[8], characterPositions[9]].GetComponent<WayPoint>();

        Pacman.GetComponent <PlayerControlScript>().currentWaypoint  = objs[-(int)charpos[0].z, (int)charpos[0].x].GetComponent <WayPoint>();
        Blinky.GetComponent <EnemyBehaviourScript>().currentWaypoint = objs[-(int)charpos[1].z, (int)charpos[1].x].GetComponent <WayPoint>();
        Inky.GetComponent <EnemyBehaviourScript>().currentWaypoint   = objs[-(int)charpos[2].z, (int)charpos[2].x].GetComponent <WayPoint>();
        Pinky.GetComponent <EnemyBehaviourScript>().currentWaypoint  = objs[-(int)charpos[3].z, (int)charpos[3].x].GetComponent <WayPoint>();
        Clyde.GetComponent <EnemyBehaviourScript>().currentWaypoint  = objs[-(int)charpos[4].z, (int)charpos[4].x].GetComponent <WayPoint>();


        m_text.text += "instanziated characters" + Environment.NewLine;
    }
 public ClydeShaderInstance(ClydeHandle handle, Clyde parent)
 {
     Handle = handle;
     Parent = parent;
 }
 public void Apply(Clyde clyde, GLShaderProgram program)
 {
     program.SetUniformMaybe("SCREEN_PIXEL_SIZE", ScreenPixelSize);
     program.SetUniformMaybe("TIME", Time);
 }
 internal ClydeTexture(ClydeHandle id, Vector2i size, Clyde clyde) : base(size)
 {
     TextureId = id;
     _clyde    = clyde;
 }
Exemple #9
0
 public AudioSource(Clyde master, int sourceHandle, AudioStream sourceStream)
 {
     _master       = master;
     SourceHandle  = sourceHandle;
     _sourceStream = sourceStream;
 }
Exemple #10
0
    void Init(bool reset)
    {
        lives = pacMan.GetComponent <Controller>().life;
        if (reset)
        {
            for (int i = 0; i < ghosts.Length; i++)
            {
                if (ghosts[i].GetComponent <Pinky>() != null)
                {
                    Pinky pinky = ghosts[i].GetComponent <Pinky>();
                    pinky.resetLevel  = true;
                    pinky.currentNode = null;
                    ghosts[i].GetComponent <Pinky>().Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
                else if (ghosts[i].GetComponent <Blinky>() != null)
                {
                    Blinky blinky = ghosts[i].GetComponent <Blinky>();
                    blinky.currentNode = null;
                    blinky.resetLevel  = true;
                    blinky.Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
                else if (ghosts[i].GetComponent <Inky>() != null)
                {
                    Inky inky = ghosts[i].GetComponent <Inky>();
                    inky.currentNode = null;
                    inky.resetLevel  = true;
                    inky.Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
                else if (ghosts[i].GetComponent <Clyde>() != null)
                {
                    Clyde clyde = ghosts[i].GetComponent <Clyde>();
                    clyde.resetLevel  = true;
                    clyde.currentNode = null;
                    clyde.Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
            }
        }
        else
        {
            for (int i = 0; i < ghosts.Length; i++)
            {
                if (ghosts[i].GetComponent <Pinky>() != null)
                {
                    Pinky pinky = ghosts[i].GetComponent <Pinky>();
                    pinky.resetLevel = false;
                    ghosts[i].GetComponent <Pinky>().Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
                else if (ghosts[i].GetComponent <Blinky>() != null)
                {
                    Blinky blinky = ghosts[i].GetComponent <Blinky>();
                    blinky.resetLevel = false;
                    blinky.Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
                else if (ghosts[i].GetComponent <Inky>() != null)
                {
                    Inky inky = ghosts[i].GetComponent <Inky>();
                    inky.resetLevel = false;
                    inky.release    = inkyReleaseCounter;
                    inky.Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
                else if (ghosts[i].GetComponent <Clyde>() != null)
                {
                    Clyde clyde = ghosts[i].GetComponent <Clyde>();
                    clyde.resetLevel = false;
                    clyde.release    = clydeReleaseCounter;
                    clyde.Init(ghostSpeed, ghostFrightSpeed, ghostTunnelSpeed, frightDuration);
                }
            }

            foreach (GameObject o in objects)
            {
                if (!pacManLost)
                {
                    if (o.tag == "Pellets" || o.tag == "PelletsInner" || o.tag == "PelletsSpecial")
                    {
                        Tile tile = o.GetComponent <Tile>();
                        if (tile != null)
                        {
                            if (tile.isPellet || tile.isSuperPellet)
                            {
                                tile.GetComponent <SpriteRenderer>().enabled = true;
                                tile.isConsumed = false;
                            }
                        }
                    }
                }
            }
        }

        pacMan.Init(pacManSpeed, frightPacManSpeed, pacManDotsSpeed, frightDuration);
    }
Exemple #11
0
 public WindowHandle(Clyde clyde, WindowReg reg)
 {
     _clyde = clyde;
     _reg   = reg;
 }
Exemple #12
0
 internal ClydeTexture(ClydeHandle id, Vector2i size, bool srgb, Clyde clyde) : base(size)
 {
     TextureId = id;
     IsSrgb    = srgb;
     _clyde    = clyde;
 }
 public unsafe CursorImpl(Clyde clyde, Cursor *pointer, bool standard)
 {
     _standard = standard;
     Owner     = clyde;
     Cursor    = pointer;
 }
Exemple #14
0
        public void move_Ghosts()
        {
            Blinky.find_target(ai_state);
            Pinky.find_target(ai_state);
            Inky.find_target(ai_state);
            Clyde.find_target(ai_state);

            //from one side to the other***********************************************************************
            //*************************************BLINKY******************************************************
            if (Blinky.x == 0 && Blinky.y == 17 && Blinky.direction == 0)
            {
                Blinky.x = 28;
            }
            if (Blinky.x == 27 && Blinky.y == 17 && Blinky.direction == 2)
            {
                Blinky.x = 0;
            }

            if (Map.intersections[Blinky.x, Blinky.y])
            {
                Blinky.direction = check_intersections(Blinky.x, Blinky.y, Blinky.target_x, Blinky.target_y, Blinky.direction);
            }
            else
            {
                Blinky.direction = check_walls(Blinky.x, Blinky.y, Blinky.target_x, Blinky.target_y, Blinky.direction);
            }


            /***********************************************************************************************
             * *******************************PINKY***************************************************/
            if (Pinky.x == 0 && Pinky.y == 17 && Pinky.direction == 0)
            {
                Pinky.x = 28;
            }
            if (Pinky.x == 27 && Pinky.y == 17 && Pinky.direction == 2)
            {
                Pinky.x = 0;
            }

            if (Map.intersections[Pinky.x, Pinky.y])
            {
                Pinky.direction = check_intersections(Pinky.x, Pinky.y, Pinky.target_x, Pinky.target_y, Pinky.direction);
            }
            else
            {
                Pinky.direction = check_walls(Pinky.x, Pinky.y, Pinky.target_x, Pinky.target_y, Pinky.direction);
            }

            //from one side to the other***********************************************************************
            //*************************************INKY******************************************************
            if (Inky.x == 0 && Inky.y == 17 && Inky.direction == 0)
            {
                Inky.x = 28;
            }
            if (Inky.x == 27 && Inky.y == 17 && Inky.direction == 2)
            {
                Inky.x = 0;
            }

            if (Map.intersections[Inky.x, Inky.y])
            {
                Inky.direction = check_intersections(Inky.x, Inky.y, Inky.target_x, Inky.target_y, Inky.direction);
            }
            else
            {
                Inky.direction = check_walls(Inky.x, Inky.y, Inky.target_x, Inky.target_y, Inky.direction);
            }


            //from one side to the other***********************************************************************
            //*************************************CLYDE******************************************************
            if (Clyde.x == 0 && Clyde.y == 17 && Clyde.direction == 0)
            {
                Clyde.x = 28;
            }
            if (Clyde.x == 27 && Clyde.y == 17 && Clyde.direction == 2)
            {
                Clyde.x = 0;
            }

            if (Map.intersections[Clyde.x, Clyde.y])
            {
                Clyde.direction = check_intersections(Clyde.x, Clyde.y, Clyde.target_x, Clyde.target_y, Clyde.direction);
            }
            else
            {
                Clyde.direction = check_walls(Clyde.x, Clyde.y, Clyde.target_x, Clyde.target_y, Clyde.direction);
            }

            Blinky.move(Blinky.direction);
            Pinky.move(Pinky.direction);
            Inky.move(Inky.direction);
            Clyde.move(Clyde.direction);
        }
Exemple #15
0
        protected override void Update(GameTime gameTime)
        {
            Time.Update(gameTime);
            InputManager.Update();

            currentScene.Update();
            background = (currentScene == scenes["Play"] ? Color.Black : Color.Black);

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            if (gameTime.ElapsedGameTime.TotalSeconds == 60)
            {
                Exit();
            }

            //if (InputManager.IsKeyDown(Keys.Up)) camera.Transform.Rotate(Vector3.Right, Time.ElapsedGameTime);
            //if (InputManager.IsKeyDown(Keys.Down)) camera.Transform.Rotate(Vector3.Left, Time.ElapsedGameTime);

            if (Inky.CheckCollision(pacman))
            {
                hits++;
            }
            if (Blinky.CheckCollision(pacman))
            {
                hits++;
            }
            if (Pinky.CheckCollision(pacman))
            {
                hits++;
            }
            if (Clyde.CheckCollision(pacman))
            {
                hits++;
            }
            if (Blue.CheckCollision(pacman))
            {
                hits++;
            }

            pacman.Update();
            Inky.Update();
            Blinky.Update();
            Pinky.Update();
            Clyde.Update();
            Blue.Update();
            powerUp.Update();

            Vector3 normal;

            if (pacman.Get <Collider>().Collides(powerUp.Get <Collider>(), out normal))
            {
                Console.WriteLine("HitBox");
                (powerUp.Get <Renderer>().ObjectModel.Meshes[0].Effects[0] as BasicEffect).DiffuseColor = Color.Red.ToVector3();
                pacmanHealth--;
            }
            else
            {
                Console.WriteLine("NotHitBox");
                (powerUp.Get <Renderer>().ObjectModel.Meshes[0].Effects[0] as BasicEffect).DiffuseColor = Color.Blue.ToVector3();
                pacmanHealth--;
            }

            base.Update(gameTime);
        }