Exemplo n.º 1
0
        public void Load(string sceneName)
        {
            switch (sceneName)
            {
            case "Launcher":
                State = PhotonState.Disconnected;
                break;

            case "Room":
                State = PhotonState.Room;
                Game  = new Game(this);
                break;

            case "Lobby":
                State = PhotonState.Lobby;
                break;

            case "Game":
                State = PhotonState.Game;
                break;
            }

            if (Setting)
            {
                Setting = false;
                return;
            }

            Loading = true;
            SceneManager.LoadScene(sceneName);
        }
Exemplo n.º 2
0
        private Vector2 toPlayer; //vector from Photon pos to player pos

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Create a new instance of a Photon projectile
        /// </summary>
        /// <param name="id">Obj id</param>
        /// <param name="content">A ContentManager to load resources with</param>
        /// <param name="position">The position of the Photon projectile in the game world</param>
        public Photon(uint id, ContentManager content, Vector2 position)
            : base(id)
        {
            this.position = position;
            this.velocity = new Vector2(150);
            this.spriteSheet = content.Load<Texture2D>("Spritesheets/accessories");
            spriteBounds = new Rectangle[10];
            player = ScrollingShooterGame.Game.Player;
            photonStateTimer = 0;
            homing = true;

            spriteBounds[(int)PhotonState.One].X = 108;
            spriteBounds[(int)PhotonState.One].Y = 3;
            spriteBounds[(int)PhotonState.One].Width = 9;
            spriteBounds[(int)PhotonState.One].Height = 7;

            spriteBounds[(int)PhotonState.Two].X = 96;
            spriteBounds[(int)PhotonState.Two].Y = 2;
            spriteBounds[(int)PhotonState.Two].Width = 9;
            spriteBounds[(int)PhotonState.Two].Height = 9;

            spriteBounds[(int)PhotonState.Three].X = 83;
            spriteBounds[(int)PhotonState.Three].Y = 1;
            spriteBounds[(int)PhotonState.Three].Width = 11;
            spriteBounds[(int)PhotonState.Three].Height = 11;

            spriteBounds[(int)PhotonState.Four].X = 71;
            spriteBounds[(int)PhotonState.Four].Y = 1;
            spriteBounds[(int)PhotonState.Four].Width = 11;
            spriteBounds[(int)PhotonState.Four].Height = 11;

            spriteBounds[(int)PhotonState.Five].X = 59;
            spriteBounds[(int)PhotonState.Five].Y = 1;
            spriteBounds[(int)PhotonState.Five].Width = 11;
            spriteBounds[(int)PhotonState.Five].Height = 11;

            spriteBounds[(int)PhotonState.Six].X = 47;
            spriteBounds[(int)PhotonState.Six].Y = 1;
            spriteBounds[(int)PhotonState.Six].Width = 11;
            spriteBounds[(int)PhotonState.Six].Height = 11;

            spriteBounds[(int)PhotonState.Seven].X = 35;
            spriteBounds[(int)PhotonState.Seven].Y = 1;
            spriteBounds[(int)PhotonState.Seven].Width = 11;
            spriteBounds[(int)PhotonState.Seven].Height = 11;

            spriteBounds[(int)PhotonState.Eight].X = 23;
            spriteBounds[(int)PhotonState.Eight].Y = 1;
            spriteBounds[(int)PhotonState.Eight].Width = 11;
            spriteBounds[(int)PhotonState.Eight].Height = 11;

            spriteBounds[(int)PhotonState.Nine].X = 11;
            spriteBounds[(int)PhotonState.Nine].Y = 1;
            spriteBounds[(int)PhotonState.Nine].Width = 11;
            spriteBounds[(int)PhotonState.Nine].Height = 11;

            spriteBounds[(int)PhotonState.Ten].X = 0;
            spriteBounds[(int)PhotonState.Ten].Y = 0;
            spriteBounds[(int)PhotonState.Ten].Width = 10;
            spriteBounds[(int)PhotonState.Ten].Height = 13;

            photonState = PhotonState.One;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create a new instance of a Photon projectile
        /// </summary>
        /// <param name="id">Obj id</param>
        /// <param name="content">A ContentManager to load resources with</param>
        /// <param name="position">The position of the Photon projectile in the game world</param>
        public Photon(uint id, ContentManager content, Vector2 position)
            : base(id)
        {
            this.position    = position;
            this.velocity    = new Vector2(150);
            this.spriteSheet = content.Load <Texture2D>("Spritesheets/accessories");
            spriteBounds     = new Rectangle[10];
            player           = ScrollingShooterGame.Game.Player;
            photonStateTimer = 0;
            homing           = true;

            spriteBounds[(int)PhotonState.One].X      = 108;
            spriteBounds[(int)PhotonState.One].Y      = 3;
            spriteBounds[(int)PhotonState.One].Width  = 9;
            spriteBounds[(int)PhotonState.One].Height = 7;

            spriteBounds[(int)PhotonState.Two].X      = 96;
            spriteBounds[(int)PhotonState.Two].Y      = 2;
            spriteBounds[(int)PhotonState.Two].Width  = 9;
            spriteBounds[(int)PhotonState.Two].Height = 9;

            spriteBounds[(int)PhotonState.Three].X      = 83;
            spriteBounds[(int)PhotonState.Three].Y      = 1;
            spriteBounds[(int)PhotonState.Three].Width  = 11;
            spriteBounds[(int)PhotonState.Three].Height = 11;

            spriteBounds[(int)PhotonState.Four].X      = 71;
            spriteBounds[(int)PhotonState.Four].Y      = 1;
            spriteBounds[(int)PhotonState.Four].Width  = 11;
            spriteBounds[(int)PhotonState.Four].Height = 11;

            spriteBounds[(int)PhotonState.Five].X      = 59;
            spriteBounds[(int)PhotonState.Five].Y      = 1;
            spriteBounds[(int)PhotonState.Five].Width  = 11;
            spriteBounds[(int)PhotonState.Five].Height = 11;

            spriteBounds[(int)PhotonState.Six].X      = 47;
            spriteBounds[(int)PhotonState.Six].Y      = 1;
            spriteBounds[(int)PhotonState.Six].Width  = 11;
            spriteBounds[(int)PhotonState.Six].Height = 11;

            spriteBounds[(int)PhotonState.Seven].X      = 35;
            spriteBounds[(int)PhotonState.Seven].Y      = 1;
            spriteBounds[(int)PhotonState.Seven].Width  = 11;
            spriteBounds[(int)PhotonState.Seven].Height = 11;

            spriteBounds[(int)PhotonState.Eight].X      = 23;
            spriteBounds[(int)PhotonState.Eight].Y      = 1;
            spriteBounds[(int)PhotonState.Eight].Width  = 11;
            spriteBounds[(int)PhotonState.Eight].Height = 11;

            spriteBounds[(int)PhotonState.Nine].X      = 11;
            spriteBounds[(int)PhotonState.Nine].Y      = 1;
            spriteBounds[(int)PhotonState.Nine].Width  = 11;
            spriteBounds[(int)PhotonState.Nine].Height = 11;

            spriteBounds[(int)PhotonState.Ten].X      = 0;
            spriteBounds[(int)PhotonState.Ten].Y      = 0;
            spriteBounds[(int)PhotonState.Ten].Width  = 10;
            spriteBounds[(int)PhotonState.Ten].Height = 13;

            photonState = PhotonState.One;
        }