Ejemplo n.º 1
0
        public ParticleTestScreen(ScreenContainer container)
            : base(container)
        {
            am = FSGGame.achievementManager;
            pm = new MAOParticleManager(new Rectangle(0, 0, 800, 400), Constants.MaxParticles, Constants.ParticleSize, am.processParticle);

            brushSize = 3;
            rand = new Random(Environment.TickCount);
            //pm.addSource(new Vector2(400, 0), 1, Particle_Type.Sand,true);
            //pm.addSource(new Vector2(450, 0), 2, Particle_Type.Sand,true);
            //pm.addSource(new Vector2(500, 0), 3, Particle_Type.Sand,true);
            pm.addSource(new Vector2(550, 0), 1, Particle_Type.Water, true);
            //pm.addSource(new Vector2(5, 360), 1, Particle_Type.Fire, true);
            //pm.addSource(new Vector2(600, 0), 5, Particle_Type.Sand);
            currentParticle = Particle_Type.Sand;

            selectPositions = new int [7];
            selectPositions[0] = 17;
            selectPositions[1] = 117;
            selectPositions[2] = 217;
            selectPositions[3] = 317;
            selectPositions[4] = 417;
            selectPositions[5] = 517;
            selectPositions[6] = 617;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Screen"/> class.
 /// </summary>
 public Screen(ScreenContainer container)
 {
     this.container = container;
     this.random = new Random();
     this.Disposed = false;
     this.FadingOut = false;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TitleScreen"/> class.
        /// </summary>
        public TitleScreen(ScreenContainer container)
            : base(container)
        {
            pm = new MAOParticleManager(new Rectangle(0, 0, 900, 500), Constants.MaxParticles, Constants.ParticleSize, p => { return; });
            pm.addSource(new Vector2(900 *3/4 , 0), 1, Particle_Type.Water, true);
            pm.addSource(new Vector2(5,200),1,Particle_Type.Fire,true);
            int radius = 175;
            int xo = 0;
            int yo = 100;
            for(int x = xo-radius; x < xo+radius; x++)
            {
                for(int y = yo-radius; y < yo+radius; y++)
                {
                    if(Math.Sqrt(Math.Pow((double)(x-xo),2)+Math.Pow((double)(y-yo),2)) < (float)radius)
                        pm.addParticle(new Vector2(x, y), Vector2.Zero, Particle_Type.Plant, true, false);
                }
            }
            for (int x = 200, y = 200; x < 600 && y < 400; x+=2, y++)
            {
                pm.addParticle(new Vector2(x, y), Vector2.Zero, Particle_Type.Wall, true, true);
                pm.addParticle(new Vector2(x+1, y), Vector2.Zero, Particle_Type.Wall, true, true);
                pm.addParticle(new Vector2(x, y+1), Vector2.Zero, Particle_Type.Wall, true, true);
                pm.addParticle(new Vector2(x + 1, y+1), Vector2.Zero, Particle_Type.Wall, true, true);
            }

            //Game1.screens.IsTitle = true;
            //Game1.screens.IsPaused = false;
            // Note: Do not use GameClock, it will be paused!
            this.initialTime = DateTime.Now.Ticks;
            this.menu = new TitleMenu(new Vector2(100, 175), 50);

            this.textDrawPosition = new Vector2(50, 100);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TitleScreen"/> class.
 /// </summary>
 public AchievementScreen(ScreenContainer container)
     : base(container)
 {
     //Game1.screens.IsTitle = true;
     //Game1.screens.IsPaused = false;
     // Note: Do not use GameClock, it will be paused!
     this.initialTime = DateTime.Now.Ticks;
     this.menu = new AchievementMenu(new Vector2(50, 175), 50);
     xSpacing = 200;
     ySpacing = 50;
     this.textDrawPosition = new Vector2(50, 50);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GameWorld"/> class.
 /// </summary>
 public GameWorld()
     : base()
 {
     GraphicsDeviceManager manager = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     manager.PreferredBackBufferWidth
         = (int)(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width * 0.75f);
     manager.PreferredBackBufferHeight
         = (int)(0.5625f * manager.PreferredBackBufferWidth);
     controller = new Controller(PlayerIndex.One);
     screens = new ScreenContainer();
     exitStatus = false;
 }
Ejemplo n.º 6
0
 public Game1()
 {
     audio = new AudioManager(this);
     SumTime = new TimeSpan();
     content = Content;
     graphics = new GraphicsDeviceManager(this);
     graphics.PreferredBackBufferWidth = 600;
     graphics.PreferredBackBufferHeight = 480;
     Content.RootDirectory = "Content";
     CurrentLevel = new Level();
     rand = new Random();
     ExitStatus = false;
     GamePaused = false;
     screens = new ScreenContainer();
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameWorld"/> class.
        /// </summary>
        public GameWorld()
            : base()
        {
            GraphicsDeviceManager manager = new GraphicsDeviceManager(this);

            Content.RootDirectory = "Content";
            manager.PreferredBackBufferWidth
                = (int)(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width);
            manager.PreferredBackBufferHeight
                       = (int)(0.5625f * manager.PreferredBackBufferWidth);
            controller = new Controller(PlayerIndex.One);
            screens    = new ScreenContainer();
            exitStatus = false;

            this.Components.Add(new GamerServicesComponent(this));
        }
Ejemplo n.º 8
0
 public FSGGame()
 {
     achievementManager = new AchievementManager(new List<AchievementBase>()
         { //new DemoAchievement(),
         new PyroAchievement(),
         new TypeOnScreenAchievement(30000, Particle_Type.Plant, "Home Tree", "Have 30,000 plants on the screen"),
         new TypeOnScreenAchievement(20000, Particle_Type.Water, "20,000 Leagues Under the Sea", "Have 20,000 water particles on the screen"),
         new TypeOnScreenAchievement(2000, Particle_Type.Fire, "Up in Flames", "Have 2,000 fire particles on the screen")});
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     screens = new ScreenContainer();
     //partMan = new ParticleManager(graphics.GraphicsDevice, 10000, 1f);
     controller = new Controller(PlayerIndex.One);
     #if XBOX
     this.Components.Add(new GamerServicesComponent(this));
     #endif
 }
Ejemplo n.º 9
0
        ///// <summary>
        ///// The background display.
        ///// </summary>
        //private static BackgroundScreen background;
        /// <summary>
        /// Initializes a new instance of the <see cref="GameWorld"/> class.
        /// </summary>
        public GameWorldREFERENCE()
            : base()
        {
            GraphicsDeviceManager manager = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            manager.PreferredBackBufferWidth
                = (int)(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width);
            manager.PreferredBackBufferHeight
                = (int)(0.5625f * manager.PreferredBackBufferWidth);
            //controller = new Controller(PlayerIndex.One);
            screens = new ScreenContainer();
            exitStatus = false;

            this.Components.Add(new GamerServicesComponent(this));

            //ParticleManager pm = new ParticleManager(
        }
Ejemplo n.º 10
0
 void Awake()
 {
     instance      = this;
     activeScreens = new List <BaseScreen>();
 }
Ejemplo n.º 11
0
    void Awake()
    {
        _TriggerSound = false;

        _SFX = GameObject.Find("SFXPlayer").GetComponent<AudioSource>();

        #if UNITY_IPHONE
        Application.targetFrameRate = 60;
        #endif
        _Instance = this;
        _Camera = this.GetComponent<Camera>();
        _CameraTrans = _Camera.transform;
        _CameraPos = _CameraTrans.position;
        Sprite.Initialise(1000);
        Bullet.Initialise(400);
        Particle.Initialise(1000);
        AI.Initialise(500);

        _MouseDown = false;
        _MousePosition = new Vector3(0.0f,0.0f,0.0f);

        _Screens = new Dictionary<string,ScreenContainer>();
        _CurrentScreen = null;
        _CameraAngles = new Vector3(0.0f,0.0f,0.0f);
        _XAngle = 40.0f;
        _ZAngle = 30.0f;
        _CurrentStage = 0;

        _LocalHiScore = PlayerPrefs.GetInt("HISCORE");
        _CurrentLockState = PlayerPrefs.GetInt("LOCK");
        Scores._Name = PlayerPrefs.GetString("NAME");

        _SFXVolume = 1.0f;

        _MusicVolume = 1.0f;

        if(_CurrentLockState == 0)
        {
            _CurrentLockState = 1;
        }

        Debug.Log("Aspect ratio = " + _Camera.aspect);

        if(Application.platform == RuntimePlatform.IPhonePlayer)
        {

         #if UNITY_IPHONE
            if(iPhone.generation == iPhoneGeneration.iPhone5 || iPhone.generation == iPhoneGeneration.iPodTouch5Gen)
            {
                if(_Camera.aspect > 1.0f)
                {
                    _Aspect = _Camera.aspect;
                }

                _CameraPos = new Vector3(0.0f,25.0f,0.0f);
            }
            else
            {
                _Aspect = 1.0f;
                _CameraPos = new Vector3(0.0f,20.0f,0.0f);
            }
        #endif
        }
        else
        {
            _Aspect = 1.0f;
            _CameraPos = new Vector3(0.0f,20.0f,0.0f);
        }

        _WayPointDatabase = GameObject.Find("WayPointDatabase").GetComponent<WayPointDatabase>();
        _YAdjust = 0.0f;

        _GLLines = new List<Vector3>();

        _MusicIndex = Random.Range(0,5);

        _Audio = this.GetComponent<AudioSource>();
        _Audio.clip = _Music[_MusicIndex];
        _Audio.Play();
        _TimeMusicPlaying = 0.0f;
    }
Ejemplo n.º 12
0
    public void SetScreen(string pName)
    {
        if(_CurrentScreen != null)
        {
            _CurrentScreen.TransitionOut();
        }

        if(_Screens.ContainsKey(pName))
        {
            _CurrentScreen = _Screens[pName];
            _CurrentScreen.TransitionIn();
        }
    }
Ejemplo n.º 13
0
 public void AddScreen(string pName, ScreenContainer pScreen)
 {
     _Screens.Add(pName,pScreen);
 }
Ejemplo n.º 14
0
 public NetworkDispatch(StarlightClient networkClient, ScreenContainer screenContainer) : base(typeof(NetworkDispatch).Assembly)
 {
     this.networkClient   = networkClient;
     this.screenContainer = screenContainer;
 }
Ejemplo n.º 15
0
 public RequestContext(int connectionId, StarlightClient networkClient, ScreenContainer screenContainer)
 {
     this.ConnectionId    = connectionId;
     this.NetworkClient   = networkClient;
     this.ScreenContainer = screenContainer;
 }
Ejemplo n.º 16
0
        void InitContainers()
        {
            var controllers_factoryset =
                new FactorySet <ITrackController>(
                    SheetMusicEditor.CreateFactory()
                    );

            var controllers_viewerset =
                new ViewerSet <ITrackController>(
                    SheetMusicEditorView.Viewer.Instance
                    );

            var tracks_factoryset =
                new FactorySet <ITrack>(
                    MusicTrackFactory.Instance
                    );

            var tracks_viewerset =
                new ViewerSet <ITrack>();

            containerfactoryset.Factories.Add(
                TrackControllerContainer.CreateFactory(
                    tracks_factoryset,
                    tracks_viewerset,
                    controllers_factoryset,
                    controllers_viewerset
                    )
                );

            containerfactoryset.Factories.Add(
                PolylineContainer.CreateFactory(
                    new FactorySet <PolylineData>(
                        PolylineData.FactoryInstance
                        ),
                    new ViewerSet <PolylineData>(
                        )
                    )
                );

            containerfactoryset.Factories.Add(
                FunctionContainer.CreateFactory(
                    new FunctionCodeTools(
                        SquareFunction.FactoryClass.Instance,
                        PolylineFunction.FactoryClass.Instance,
                        PolynomialFunction.FactoryClass.Instance,
                        PulseWidthModulatedFunction.FactoryClass.Instance,

                        LocalPerspectiveFunction.FactoryClass.Instance,
                        GlobalPerspectiveFunction.FactoryClass.Instance
                        ),
                    new FactorySet <FunctionSource>(
                        FunctionSource.FactoryInstance
                        ),
                    new ViewerSet <FunctionSource>(
                        )
                    )
                );

            containerfactoryset.Factories.Add(
                ScreenContainer.CreateFactory(
                    new FactorySet <IScreen>(
                        TrackControllerScreen.FactoryInstance
                        ),
                    new ViewerSet <IScreen>(
                        TrackControllerScreenView.Viewer.Instance
                        )
                    )
                );
        }
Ejemplo n.º 17
0
Archivo: OsuGame.cs Proyecto: bdach/osu
 private void updateBlockingOverlayFade() =>
 ScreenContainer.FadeColour(visibleBlockingOverlays.Any() ? OsuColour.Gray(0.5f) : Color4.White, 500, Easing.OutQuint);
Ejemplo n.º 18
0
    // Use this for initialization
    void Start()
    {
        // Get all the stuff necessary for player movement
        _PlayerObject = GameObject.Find("Player");
        _Player = _PlayerObject.GetComponent<Player>();
        _CameraTransform = this.transform;
        _CameraTransform.position = _CameraPos;

        // Find the UI
        _PlayButton = GameObject.Find("PlayButton").GetComponent<Button>();
        _CreditsBackButton = GameObject.Find("CreditsBackButton").GetComponent<Button>();
        _Title = GameObject.Find("Title").GetComponent<Image>();
        _Credits = GameObject.Find("Credits").GetComponent<Image>();
        _LevelInfo = GameObject.Find("LevelInfo").GetComponent<Image>();

        // Build the screens
        ScreenContainer pTitleScreen = new ScreenContainer();

        pTitleScreen.AddButton("PlayButton");
        pTitleScreen.AddButton("CloseButton");
        pTitleScreen.AddButton("WhoMadeThisButton");
        pTitleScreen.AddButton("HighScoreTableButton");
        pTitleScreen.AddButton("TwitterButton");
        pTitleScreen.AddButton("SettingsButton");

        pTitleScreen.AddCompound("LogoContainer");

        _Screens.Add("TITLE",pTitleScreen);

        ScreenContainer pCredits = new ScreenContainer();
        pCredits.AddButton("CreditsBackButton");

        pCredits.AddUIGO("CreditsByron");
        pCredits.AddUIGO("CreditsGavin");
        pCredits.AddUIGO("CreditsNatalie");
        pCredits.AddUIGO("CreditsSusan");
        pCredits.AddUIGO("CreditsWill");
        pCredits.AddUIGO("CreditsDes");
        pCredits.AddUIGO("CreditsDugan");
        pCredits.AddUIGO("CreditsDan");
        pCredits.AddUIGO("CreditsThanks");

        _Screens.Add("CREDITS",pCredits);

        ScreenContainer pHowTo = new ScreenContainer();
        pHowTo.AddButton("CreditsBackButton");
        pHowTo.AddImage("HowToPlay");
        _Screens.Add("HOW_TO_PLAY",pHowTo);

        ScreenContainer pPlay = new ScreenContainer();
        pPlay.AddUIGO("Land");
        pPlay.AddUIGO("Land2");
        _Screens.Add("PLAY",pPlay);

        ScreenContainer pPathEditor = new ScreenContainer();
        _Screens.Add("PATH",pPathEditor);

        ScreenContainer pScores = new ScreenContainer();
        pScores.AddButton("HighScoreBackButton");
        pScores.AddButton("HSUpButton");
        pScores.AddButton("HSDownButton");
        _Screens.Add("SCORES",pScores);

        ScreenContainer pName = new ScreenContainer();
        pName.AddButton("CreditsBackButton");
        pName.AddButton("OneUpButton");
        pName.AddButton("OneDownButton");
        pName.AddButton("TwoUpButton");
        pName.AddButton("TwoDownButton");
        pName.AddButton("ThreeUpButton");
        pName.AddButton("ThreeDownButton");
        pName.AddButton("FourUpButton");
        pName.AddButton("FourDownButton");
        pName.AddButton("FiveUpButton");
        pName.AddButton("FiveDownButton");
        pName.AddButton("SixUpButton");
        pName.AddButton("SixDownButton");
        pName.AddButton("SevenUpButton");
        pName.AddButton("SevenDownButton");
        pName.AddButton("EightUpButton");
        pName.AddButton("EightDownButton");
        pName.AddButton("NineUpButton");
        pName.AddButton("NineDownButton");
        pName.AddButton("TenUpButton");
        pName.AddButton("TenDownButton");

        pName.AddButton("MusicVolumeUpButton");
        pName.AddButton("MusicVolumeDownButton");
        pName.AddButton("SFXVolumeUpButton");
        pName.AddButton("SFXVolumeDownButton");
        pName.AddCompound("MusicVolumeContainer");
        pName.AddCompound("SFXVolumeContainer");
        pName.AddCompound("MusicVolumeNameContainer");
        pName.AddCompound("SFXNameContainer");
        pName.AddCompound("NameContainer");

        _Screens.Add("NAME",pName);

        ScreenContainer pNewVersion = new ScreenContainer();
        pNewVersion.AddButton("GoGetButton");
        pNewVersion.AddButton("GoGetBackButton");
        pNewVersion.AddUIGO("NewVersion");
        _Screens.Add("NEW_VERSION",pNewVersion);

        ScreenContainer pCompany = new ScreenContainer();
        pCompany.AddUIGO("Company");
        _Screens.Add("COMPANY",pCompany);

        _Number = new Number();
        _Number._Z = 10.0f;
        _Number.Disable();

        // Setup the initial game state
        //_CurrentState = eGameState.GAMESTATE_SETUP_COMPANY;
        _CurrentState = eGameState.GAMESTATE_SETUP_TITLE;

        _Camera = GetComponent<Camera>();

        // Disable components to start
        _Player.Disable();

        _Samples = new Dictionary<string,AudioClip>();
        _SamplesTimeStamp = new Dictionary<string, float>();
        _SamplePlayAlways = new Dictionary<string, bool>();
        _AudioSource = this.GetComponent<AudioSource>();

        // Add samples
        AddSample("ALIEN_SHOT","SFX/Enemy");
        AddSample("PLAYER_SHOT","SFX/PlayerShot2");
        AddSample("EXPLOSION","SFX/Explosion");
        AddSample("COIN","SFX/Coin");
        AddSample("POWERUP","SFX/PowerUp");
        AddSample("PLAYERDEATH","SFX/PlayerDeath",true);
        AddSample("RAPIDFIRE","SFX/RapidFire",true);
        AddSample("GAMEON","SFX/GameOn",true);
        AddSample("WIPEOUT","SFX/WipeOut",true);
        AddSample("CLICK","SFX/Click",true);
        AddSample("PRESS","SFX/Press",true);
        AddSample("THREEWAY","SFX/ThreeWay",true);
        AddSample("MAGNET","SFX/Magnatism",true);

        // Create lives sprites
        _LivesSprites = new List<Sprite>();

        float fLX = Ground._Instance._HigherX + 2.0f;
        float fLZ = Ground._Instance._LowerZ - 2.0f;

        for(int i = 0; i < 20; ++i)
        {
            Sprite pSprite = Sprite.Spawn(1);

            pSprite.AddFrame("Life.png");
            pSprite._Width = 0.5f;
            pSprite._Height = 0.5f;
            pSprite._Animate = false;;
            pSprite._Y = 1.0f;
            pSprite._X = fLX;
            pSprite._Z = fLZ;
            pSprite._Alive = false;
            _LivesSprites.Add(pSprite);

            fLX += 0.6f;
        }

        _Starfield = GameObject.Find("Starfield").GetComponent<Renderer>().sharedMaterial;
        _Warp = 0.0f;
        _Speed = 1.0f;

        _PatheEditor = false;
        _Generator = new Generator();

        _Scores = GameObject.Find("Scores").GetComponent<Scores>();

        // Load HUD indicators
        _BulletSpeedUp = Sprite.Spawn(1);
        _BulletSpeedUp.AddFrame("FasterShot1.png");
        _BulletSpeedUp.AddFrame("FasterShot2.png");
        _BulletSpeedUp.AddFrame("FasterShot3.png");
        _BulletSpeedUp.AddFrame("FasterShot4.png");
        _BulletSpeedUp.AddFrame("FasterShot5.png");
        _BulletSpeedUp.AddFrame("FasterShot6.png");
        _BulletSpeedUp.AddFrame("FasterShot7.png");
        _BulletSpeedUp.AddFrame("FasterShot8.png");
        _BulletSpeedUp.AddFrame("FasterShot9.png");
        _BulletSpeedUp.AddFrame("FasterShot10.png");
        _BulletSpeedUp._X = -10.0f;
        _BulletSpeedUp._Z = 10.0f;
        _BulletSpeedUp._Height = 1.2f;
        _BulletSpeedUp._Width = 1.2f;
        _BulletSpeedUp._Animate = false;
        _BulletSpeedUp._Y = 0.1f;
        _BulletSpeedUp._Alive = false;
    }