Beispiel #1
0
    // Use this for initialization
    public override void Start()
    {
        transitionIn = true;
        InitScript.inGame = false;
        background = new Starfield(InitScript.bg1Pos,false);
        Futile.stage.AddChild(background);

        background2 = new Starfield(InitScript.bg2Pos, false);
        Futile.stage.AddChild(background2);

        menuAnims = new FSprite("MenutoCredits0.png");
        menuAnims.scale = 2.0f;
        menuAnims.x = 0;
        //menuAnims.isVisible = false;
        Futile.stage.AddChild(menuAnims);

        menuBackground = new FSprite("CreditScreen.png");
        menuBackground.scale = 2.0f;
        menuBackground.x = 0;
        menuBackground.isVisible = false;
        Futile.stage.AddChild(menuBackground);

        btnInstructions = new FButton("MenuButton.png");
        btnInstructions.x -= 1;
        btnInstructions.y -= 166;
        btnInstructions.scale = 2.0f;
        btnInstructions.isVisible = false;
        Futile.stage.AddChild(btnInstructions);
        InitScript.blackBar1.MoveToTop();
        InitScript.blackBar2.MoveToTop();

        btnInstructions.SignalRelease += HandleInfoButtonRelease;

        Futile.instance.SignalUpdate += HandleUpdate;
    }
Beispiel #2
0
 protected Screen(float starfieldSpeed = 100)
 {
     this.starfieldSpeed = starfieldSpeed;
     SpriteBatch         = new SpriteBatch(Assets.GraphicsDevice);
     Starfield           = new Starfield(Vector2.Zero, Assets.GraphicsDevice, Assets.Content);
     Starfield.LoadContent();
 }
Beispiel #3
0
 public BrickArena(Arkanoid game)
     : base(game)
 {
     Show      = new TimeSpan(0, 0, 0, 15);
     Starfield = new Starfield(100, new Rectangle(0, 0, (int)Game.Width, (int)Game.Height));
     Bricks    = new Dictionary <BrickTypes, Sprite>
     {
         { BrickTypes.White, Brick.GetBrickTexture(BrickTypes.White) },
         { BrickTypes.Orange, Brick.GetBrickTexture(BrickTypes.Orange) },
         { BrickTypes.SkyBlue, Brick.GetBrickTexture(BrickTypes.SkyBlue) },
         { BrickTypes.Green, Brick.GetBrickTexture(BrickTypes.Green) },
         { BrickTypes.Red, Brick.GetBrickTexture(BrickTypes.Red) },
         { BrickTypes.DarkRed, Brick.GetBrickTexture(BrickTypes.DarkRed) },
         { BrickTypes.Blue, Brick.GetBrickTexture(BrickTypes.Blue) },
         { BrickTypes.DarkBlue, Brick.GetBrickTexture(BrickTypes.DarkBlue) },
         { BrickTypes.Pink, Brick.GetBrickTexture(BrickTypes.Pink) },
         { BrickTypes.Yellow, Brick.GetBrickTexture(BrickTypes.Yellow) },
         { BrickTypes.Silver, Brick.GetBrickTexture(BrickTypes.Silver) },
         { BrickTypes.Black, Brick.GetBrickTexture(BrickTypes.Black) },
         { BrickTypes.Gold, Brick.GetBrickTexture(BrickTypes.Gold) },
         { BrickTypes.Regen, Brick.GetBrickTexture(BrickTypes.Regen) },
         { BrickTypes.BlackRegen, Brick.GetBrickTexture(BrickTypes.BlackRegen) },
         { BrickTypes.SilverSwap, Brick.GetBrickTexture(BrickTypes.SilverSwap) },
         { BrickTypes.GoldSwap, Brick.GetBrickTexture(BrickTypes.GoldSwap) },
         { BrickTypes.BlueSwap, Brick.GetBrickTexture(BrickTypes.BlueSwap) },
         { BrickTypes.Teleport, Brick.GetBrickTexture(BrickTypes.Teleport) },
         { BrickTypes.Transmit, Brick.GetBrickTexture(BrickTypes.Transmit) }
     };
 }
Beispiel #4
0
 public override void Update(GameTime gameTime)
 {
     if (Starfield.Bounds != Game.Bounds)
     {
         Starfield = new Starfield(100, Game.Bounds);
     }
     Starfield.Update(gameTime);
     base.Update(gameTime);
 }
        public IEnumerator StarsAreCreated()
        {
            GameObject     starfieldObject = GameObject.Instantiate(starFieldPrefab);
            ParticleSystem ps        = starfieldObject.GetComponent <ParticleSystem>();
            Starfield      starfield = starfieldObject.GetComponent <Starfield>();

            Assert.AreEqual(starfield.starCount, ps.particleCount);
            yield return(null);
        }
Beispiel #6
0
    // Use this for initialization
    public override void Start()
    {
        transitionIn = InitScript.shouldPlayMenuTransition;
        InitScript.inGame = false;

        background = new Starfield(InitScript.bg1Pos,false);
        Futile.stage.AddChild(background);

        background2 = new Starfield(InitScript.bg2Pos, false);
        Futile.stage.AddChild(background2);

        menuBackground = new FSprite("MenuStatic.png");
        menuBackground.scale = 2.0f;
        menuBackground.x = 0;
        if (InitScript.shouldPlayMenuTransition == true)
            menuBackground.isVisible = false;
        Futile.stage.AddChild(menuBackground);

        menuAnims = new FSprite("Menutoplay6.png");
        if (InitScript.shouldPlayMenuTransition == false)
            menuAnims.SetElementByName("MenuAnim0.png");
        menuAnims.scale = 2.0f;
        menuAnims.x = 0;
        //menuAnims.isVisible = false;
        Futile.stage.AddChild(menuAnims);

        btnInstructions = new FButton("InfoButton.png");
        btnInstructions.x -= 1;
        btnInstructions.y -= 126;
        btnInstructions.scale = 2.0f;
        if (InitScript.shouldPlayMenuTransition == true)
            btnInstructions.isVisible = false;
        Futile.stage.AddChild(btnInstructions);

        btnCredits = new FButton("CreditsButton.png");
        btnCredits.x -= 1;
        btnCredits.y -= 166;
        btnCredits.scale = 2.0f;
        if (InitScript.shouldPlayMenuTransition == true)
            btnCredits.isVisible = false;
        Futile.stage.AddChild(btnCredits);

        btnPlay = new FButton("PlayButton.png");
        btnPlay.x = 0;
        btnPlay.y = 0;
        btnPlay.scale = 2.0f;
        Futile.stage.AddChild(btnPlay);

        InitScript.blackBar1.MoveToTop();
        InitScript.blackBar2.MoveToTop();

        btnInstructions.SignalRelease += HandleInfoButtonRelease;
        btnCredits.SignalRelease += HandleCreditButtonRelease;
        btnPlay.SignalRelease += HandlePlayButtonRelease;

        Futile.instance.SignalUpdate += HandleUpdate;
    }
 public override void UnloadContent()
 {
     if (starfield != null)
     {
         starfield.UnloadContent();
         starfield = null;
     }
     base.UnloadContent();
 }
 public override void LoadContent(ContentManager Content)
 {
     base.LoadContent(Content);
     puntajeTextura = content.Load <Texture2D>("Screens/reportesScreen/puntaje_form");
     fuente         = content.Load <SpriteFont>("Fuentes/fuenteMsg");
     texturaBtnOk   = content.Load <Texture2D>("Screens/btn_ok_1");
     rectBtnOk      = new Rectangle(-texturaBtnOk.Width, 209, texturaBtnOk.Width, texturaBtnOk.Height);
     rectPuntaje    = new Rectangle((graphics.GraphicsDevice.Viewport.Width - puntajeTextura.Width) / 2, -puntajeTextura.Height, puntajeTextura.Width, puntajeTextura.Height);
     starfield      = new Starfield(Vector2.Multiply(new Vector2((float)Math.Cos(movement / starsParallaxPeriod), (float)Math.Sin(movement / starsParallaxPeriod)), starsParallaxAmplitude), graphics.GraphicsDevice, content);
     starfield.LoadContent();
 }
Beispiel #9
0
        public Level()
        {
            var graphicsDevice = GameServices.GetService <GraphicsDevice>();

            QuadTree               = new QuadTree(0, new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height));
            Spawners               = new List <Spawner>();
            SafeToIterate          = new List <GameObject>();
            AllDrawableGameObjects = new List <GameObject>();

            StarField = new Starfield();
        }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Starfield myScript = (Starfield)target;

        if (GUILayout.Button("Setup star field"))
        {
            myScript.CreateStarfield();
        }
    }
Beispiel #11
0
 public PowerUpArena(Arkanoid game) : base(game)
 {
     Show      = new TimeSpan(0, 0, 0, 15);
     Starfield = new Starfield(100, new Rectangle(0, 0, (int)Game.Width, (int)Game.Height));
     Capsules  = new Dictionary <CapsuleTypes, Sprite>();
     foreach (var c in Enum.GetValues(typeof(CapsuleTypes)).Cast <CapsuleTypes>())
     {
         Capsules.Add(c, Capsule.GetCapTexture(c));
     }
     LastTouch = new TimeSpan(0, 0, 0, 0, 200);
 }
Beispiel #12
0
    void Start()
    {
        this._starfield = GetComponent <Starfield>();
        if (this._material == null)
        {
            _material = GetComponent <Renderer>().sharedMaterial;
        }

        MeshFilter mf = GetComponent <MeshFilter>();

        mf.sharedMesh = IcoSphereCreator.Create(numberOfSides, 1);
    }
Beispiel #13
0
 /// <summary>
 /// Disposes this object.
 /// </summary>
 /// <param name="disposing">
 /// True if this method was called as part of the Dispose method.
 /// </param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         lock (this)
         {
             if (starfield != null)
             {
                 starfield.Dispose();
                 starfield = null;
             }
         }
     }
 }
Beispiel #14
0
        public void Initialize(RenderWindow target)
        {
            _starfield = new Starfield(target.Size.X, target.Size.Y);
            _centerX   = (int)target.Size.X / 2;

            GetMusic().Volume = GameSettings.MusicVolume;
            GetMusic().Loop   = true;
            if (GameSettings.IsMusic)
            {
                GetMusic().Play();
            }

            GameSettings.GameSettingsChanged += GameSettingsChanged;
        }
Beispiel #15
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            // TODO: use this.Content to load your game conte
            FontManager.Init();
            b       = FontManager.UIFont;
            manager = new UIManager();

            GraphicsDevice.SamplerStates[1] = SamplerState.PointWrap;
            Starfield = new Starfield();
            effect    = Content.Load <Effect>("shaders/shader_basic");
            effect.Parameters["Palette"].SetValue(Content.Load <Texture2D>("palette"));
            uiEffect = Content.Load <Effect>("shaders/shader_ui");
            uiEffect.Parameters["Palette"].SetValue(Content.Load <Texture2D>("palette"));
        }
Beispiel #16
0
        public override void _Ready()
        {
            Mesh            = GetNode <Spatial>("Mesh");
            Starfield       = GetNode <Starfield>("Starfield");
            AnimationPlayer = GetNode <AnimationPlayer>("AnimationPlayer");
            EngineParticles = GetNode <CPUParticles>("Mesh/EngineParticles");
            CollisionShape  = GetNode <CollisionShape>("CollisionShape");
            InputHandler    = GetNode <InputHandler>("InputHandler");
            AudioExplosion  = GetNode <AudioStreamPlayer>("AudioExplosion");
            Timer           = GetNode <Timer>("Timer");

            Timer.Connect("timeout", this, nameof(OnTimerTimeout));

            initialForwardSpeed  = ForwardSpeed;
            initialMeshTransform = Mesh.Transform;
        }
        public IEnumerator StarsAreMoving()
        {
            GameObject     starfieldObject = GameObject.Instantiate(starFieldPrefab);
            ParticleSystem ps        = starfieldObject.GetComponent <ParticleSystem>();
            Starfield      starfield = starfieldObject.GetComponent <Starfield>();

            ParticleSystem.Particle[] particles = new ParticleSystem.Particle[starfield.starCount];
            ps.GetParticles(particles);
            List <Vector3> pos = particles.Select(it => it.position * 1).ToList();

            yield return(new WaitForSecondsRealtime(0.2f));

            ps.GetParticles(particles);
            List <Vector3> pos2 = particles.Select(it => it.position * 1).ToList();

            Assert.True(pos.Select((p, i) => new { p, i }).All(it => it.p.magnitude != pos2[it.i].magnitude));
        }
Beispiel #18
0
 public override void LoadContent(ContentManager Content)
 {
     base.LoadContent(Content);
     fuente             = content.Load <SpriteFont>("Fuentes/fuenteMsg");
     texturaBtnJugar    = content.Load <Texture2D>("Screens/menuScreen/btn_jugar_1");
     texturaBtnReportes = content.Load <Texture2D>("Screens/menuScreen/btn_reportes_1");
     texturaBtnSalir    = content.Load <Texture2D>("Screens/menuScreen/btn_salir_1");
     texturaBtnMusic    = content.Load <Texture2D>("Screens/menuScreen/btn_music_1");
     texturaBtnInicio   = content.Load <Texture2D>("Screens/menuScreen/btn_home_1");
     rectBtnJugar       = new Rectangle((graphics.GraphicsDevice.Viewport.Width - texturaBtnJugar.Width) / 2, graphics.GraphicsDevice.Viewport.Height + texturaBtnJugar.Height, texturaBtnJugar.Width, texturaBtnJugar.Height);
     rectBtnReportes    = new Rectangle((graphics.GraphicsDevice.Viewport.Width - texturaBtnReportes.Width) / 2, graphics.GraphicsDevice.Viewport.Height + texturaBtnReportes.Height, texturaBtnReportes.Width, texturaBtnReportes.Height);
     rectBtnSalir       = new Rectangle((graphics.GraphicsDevice.Viewport.Width - texturaBtnSalir.Width) / 2, graphics.GraphicsDevice.Viewport.Height + texturaBtnSalir.Height, texturaBtnSalir.Width, texturaBtnSalir.Height);
     rectBtnMusic       = new Rectangle(-texturaBtnMusic.Width, 278, texturaBtnMusic.Width, texturaBtnMusic.Height);
     rectBtnInicio      = new Rectangle(-texturaBtnInicio.Width, 346, texturaBtnInicio.Width, texturaBtnInicio.Height);
     titleTexture       = content.Load <Texture2D>("Screens/menuScreen/title");
     rectTitle          = new Rectangle((graphics.GraphicsDevice.Viewport.Width - titleTexture.Width) / 2, -titleTexture.Height, titleTexture.Width, titleTexture.Height);
     starfield          = new Starfield(Vector2.Multiply(new Vector2((float)Math.Cos(movement / starsParallaxPeriod), (float)Math.Sin(movement / starsParallaxPeriod)), starsParallaxAmplitude), graphics.GraphicsDevice, content);
     starfield.LoadContent();
 }
Beispiel #19
0
    public void MakePlanets()
    {
        int x     = 0;
        int reach = Mathf.Max(60, (15 * saved.Count) / 2);

        foreach (World world in saved)
        {
            GameObject     current = (Instantiate(worldPrefab, worldPrefab.transform.position - new Vector3(x * 15, 0, 0), worldPrefab.transform.rotation) as GameObject);
            SpriteRenderer render  = current.GetComponent <SpriteRenderer>();
            render.sprite = world.sprite;
            render.color  = world.color;
            //print("Color:" + world.color);
            //print("Seen:" + render.color);
            Starfield drift = current.GetComponent <Starfield>();
            drift.beginning = new Vector3(-reach, drift.beginning.y, drift.beginning.z);
            drift.end       = new Vector3(reach, drift.end.y, drift.end.z);
            x++;
        }
    }
Beispiel #20
0
    public static void Inspector(Starfield s)
    {
        GuiTools.DrawTitleChapter("Starfield",12,true,0,Screen.width, Color.white);

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button( new GUIContent( " Random starfield",CosmosInspector.GetIcon(19)))){
            s.RandomStarfield();
        }

        EditorGUILayout.EndHorizontal();

        GuiTools.DrawSeparatorLine();

        // Quality
        GUI.backgroundColor = new Color(33f/255f,180f/255f,252f/255f);
        Starfield.StarfieldQuality tmpQuality = (Starfield.StarfieldQuality)EditorGUILayout.EnumPopup( "Quality",s.Quality);
        if (tmpQuality != s.Quality){
            s.Quality = tmpQuality;

            for(int i=0;i<6;i++){
                s.starfieldTexture[i].Resize( s.GetStarfieldQuality2Int(), s.GetStarfieldQuality2Int());

            }
            SaveSceneTexture.CreateStarfieldTexture();
            s.RandomStarfield();
        }

        GUI.backgroundColor = Color.white;
        GuiTools.DrawSeparatorLine();

        StarboxInspector(s.cosmosStarfield,"Cosmos",0);
        EditorGUILayout.Space();
        StarboxInspector(s.nebulaStarfield,"Nebula",1);

        GuiTools.DrawSeparatorLine();

        if (GUILayout.Button( new GUIContent( " Clear",CosmosInspector.GetIcon(12)))){
            if (EditorUtility.DisplayDialog( "Clear starfield","Are you sure ?","Delete","Cancel")){
                s.Render(true);
            }
        }
    }
    void Start()
    {
        this._starfield = GetComponent <Starfield>();

        this._GPUInstancingArgsBuffer = new ComputeBuffer(1, this._GPUInstancingArgs.Length * sizeof(uint), ComputeBufferType.IndirectArguments);

        _pointMesh = new Mesh();
        switch (meshType)
        {
        case EMeshType.Point:
            _pointMesh.vertices = new Vector3[] {
                new Vector3(0, 0),
            };
            _pointMesh.normals = new Vector3[] {
                new Vector3(0, 1, 0),
            };
            _pointMesh.SetIndices(new int[] { 0 }, MeshTopology.Points, 0);
            break;

        default:
            _pointMesh.vertices = new Vector3[] {
                new Vector3(0, 0),
                new Vector3(0, 1),
                new Vector3(1, 0)
            };
            _pointMesh.normals = new Vector3[] {
                new Vector3(0, 1, 0),
                new Vector3(0, 1, 0),
                new Vector3(0, 1, 0)
            };
            _pointMesh.SetIndices(new int[] { 0, 1, 2 }, MeshTopology.Triangles, 0);
            break;
        }

        Debug.Log(" StarfieldPoints Create _pointMesh ");
    }
Beispiel #22
0
 private void Start()
 {
     sf = FindObjectOfType <Starfield>();
     ls = FindObjectOfType <LetterSpawner>();
 }
Beispiel #23
0
        protected override void OnLoad(EventArgs e)
        {
            _spheres = new List <Sphere> {
                new Sphere(Vector3.Zero, _sRadius, _sDensity)
            };

            _camera        = new SphereCamera(Width, Height, _spheres[0], StandEyeLevel);
            _camera.SkyBox = Starfield.Generate(_sSkySeed, 1024, 4);

            _frameTimer         = new Stopwatch();
            _lastPosUpdateTimer = new Stopwatch();

            _frameTimer.Start();
            _lastPosUpdateTimer.Start();

            _frameCounter = 0;

            Mouse.Move += (sender, me) => {
                if (!Focused || !_captureMouse)
                {
                    return;
                }

                var centre = new Point(Bounds.Left + Width / 2, Bounds.Top + Height / 2);

                if (WFCursor.Position.X == centre.X && WFCursor.Position.Y == centre.Y)
                {
                    return;
                }

                _camera.Yaw   += (WFCursor.Position.X - centre.X) / 360f;
                _camera.Pitch += (WFCursor.Position.Y - centre.Y) / 360f;

                _camera.Pitch = Tools.Clamp(_camera.Pitch, -MathHelper.PiOver2, MathHelper.PiOver2);

                WFCursor.Position = centre;
            };

            Mouse.ButtonUp += (sender, me) => {
                if (_captureMouse)
                {
                    return;
                }

                _captureMouse = true;
                WFCursor.Hide();
            };

            Keyboard.KeyDown += (sender, ke) => {
                switch (ke.Key)
                {
                case Key.Escape:
                    _captureMouse = !_captureMouse;
                    if (_captureMouse)
                    {
                        WFCursor.Hide();
                    }
                    else
                    {
                        WFCursor.Show();
                    }
                    break;

                case Key.Space:
                    if (_camera.Altitude <= _camera.EyeHeight)
                    {
                        _camera.Jump(8f);
                    }
                    break;

                case Key.F11:
                    if (WindowState == WindowState.Fullscreen)
                    {
                        WindowState = WindowState.Normal;
                    }
                    else
                    {
                        WindowState = WindowState.Fullscreen;
                    }
                    break;

                case Key.F12:
                    _takeScreenShot = true;
                    break;
                }
            };
        }
 public void OnEnable()
 {
     myTarget = (Starfield)target;
 }
Beispiel #25
0
    public override void Start()
    {
        InitScript.inGame = true;
        InitScript.totalScore = 0;
        bonusSpeed = 2f;
        score = 0;
        value1 = 0;
        value2 = 0;
        value3 = 0;
        FrameCounter = 120;
        obstacles = new List<Obstacle>();
        powerups = new List<Powerup>();
        bullets = new List<Bullet>();

        background = new Starfield(InitScript.bg1Pos,false);
        Futile.stage.AddChild(background);

        background2 = new Starfield(InitScript.bg2Pos, false);
        Futile.stage.AddChild(background2);

        bar = new EnergyBar();
        Futile.stage.AddChild(bar);

        walls = new FSprite("AwesomeWall.png");
        walls.scale = 2.0f;
        walls.x = 0;
        Futile.stage.AddChild(walls);

        //score stuffffff
        digit1 = new FSprite("0.png");
        digit1.scale = 2.0f;
        digit1.x = -159.7772f + 180;
        digit1.y = Futile.screen.halfHeight - 57;
        Futile.stage.AddChild(digit1);

        digit2 = new FSprite("0.png");
        digit2.scale = 2.0f;
        digit2.x = -159.7772f + 160;
        digit2.y = Futile.screen.halfHeight - 57;
        Futile.stage.AddChild(digit2);

        digit3 = new FSprite("0.png");
        digit3.scale = 2.0f;
        digit3.x = -159.7772f + 140;
        digit3.y = Futile.screen.halfHeight - 57;
        Futile.stage.AddChild(digit3);

        ///////

        testPlayer = new Spaceman();
        Futile.stage.AddChild(testPlayer);
        testPlayer.PlayerAlive();

        victoryFlare = new FSprite("Victory0.png");
        victoryFlare.scale = 2.0f;
        victoryFlare.x = 159.7772f - 30;
        victoryFlare.y = -Futile.screen.halfHeight + 160;
        Futile.stage.AddChild(victoryFlare);

        btnPause = new FButton("PauseButton.png");
        btnPause.x = -159.7772f + 12;
        btnPause.y = Futile.screen.halfHeight - 12;
        btnPause.scale = 2.0f;
        //btnPause.isVisible = false;
        Futile.stage.AddChild(btnPause);

        turret = new Turret();
        Futile.stage.AddChild(turret);

        laser = new LazerTurret();
        Futile.stage.AddChild(laser);

        laserActual = new Lazer();
        Futile.stage.AddChild(laserActual);

        rocket = new RocketTurret();
        Futile.stage.AddChild(rocket);

        pausedScreen = new FSprite("Paused0.png");
        pausedScreen.scale = 2.0f;
        pausedScreen.isVisible = false;
        Futile.stage.AddChild(pausedScreen);

        InitScript.blackBar1.MoveToTop();
        InitScript.blackBar2.MoveToTop();

        btnPause.SignalRelease += HandlePauseButtonRelease;
        Futile.instance.SignalUpdate += HandleUpdate;
    }
Beispiel #26
0
 public PauseArena(Arkanoid game)
     : base(game)
 {
     Starfield = new Starfield(100, new Rectangle(0, 0, (int)Game.Width, (int)Game.Height));
 }
Beispiel #27
0
    // Update is called once per frame
    void Update()
    {
        if (Input.touchCount > 0)
        {
            Touch   touch    = Input.GetTouch(0);
            Vector2 touchPos = camera.ScreenToWorldPoint(touch.position);


            switch (touch.phase)
            {
            case TouchPhase.Began:
                if (GetComponent <Collider2D>() == Physics2D.OverlapPoint(touchPos))
                {
                    x    = touchPos.x - touch.position.x;
                    y    = touchPos.y - touch.position.y;
                    posx = x * Time.deltaTime * HomeSpeed * dir;
                    posy = y * Time.deltaTime * HomeSpeed * dir;
                }
                break;

            case TouchPhase.Moved:
                if (GetComponent <Collider2D>() == Physics2D.OverlapPoint(touchPos))
                {
                }
                break;
            }
        }

        /*  if (Input.touchCount > 0)
         * {
         *    Touch touch= Input.GetTouch(0);
         *    Vector2 touchPos = camera.ScreenToWorldPoint(touch.position);
         *    if (touch.phase == TouchPhase.Began)
         *    {
         *        initouch = touch;
         *    }
         *    else if (touch.phase == TouchPhase.Moved)
         *    {
         *        x = initouch.position.x - touch.position.x;
         *        y = initouch.position.y - touch.position.y;
         *        posx = x * Time.deltaTime * HomeSpeed * dir;
         *        posy = y * Time.deltaTime * HomeSpeed * dir;
         *        Debug.Log("posX: " + posx + " Posy: " + posy);
         *        ClearOrbit();
         *    }
         *    else if (touch.phase == TouchPhase.Ended)
         *    {
         *        initouch = new Touch();
         *        posx = 0;
         *        posy = 0;
         *    }
         *
         * }*/


        Starfield.Rotate(0f, Time.deltaTime, 0f);
        FindObjectOfType <HomeAnim>().updateface(facemode);
        UpdateFace();
        if (!isDead && (life > 0))
        {
            if (Input.GetKeyUp(KeyCode.Space))
            {
                NewPlanet();
            }

            //		if (Input.GetKeyUp(KeyCode.A))
            //		{
            //			NewStaticPlanet();
            //		}

            if (Input.GetMouseButtonDown(1))
            {
                speedUpBy = 0;
            }

            if (Input.GetMouseButton(1))
            {
                speedUpBy += Time.deltaTime / 2f;
                //			if (speedUpBy > 1)
                //			{
                //				speedUpBy = 1f;
                //			}
                SetTime(1 + speedUpBy);
            }

            if (Input.GetMouseButtonUp(1))
            {
                SetTime(1);
            }


            if (!clearedThisMove && ((Input.GetAxis("Mouse X") != 0) || (Input.GetAxis("Mouse Y") != 0)))
            {
                //			isMoving = true;
                ClearOrbit();
                clearedThisMove = true;
                UpdateOrbitUI();
            }

            if (clearedThisMove && ((Input.GetAxis("Mouse X") == 0) || (Input.GetAxis("Mouse Y") == 0)))
            {
                //			isMoving = false;
                clearedThisMove = false;
            }
            if (topCount >= planetCount)
            {
                NewPlanet();
            }
        }
        else
        {
            if ((isDead) && (!ControlledObj.gameObject.activeSelf) && (Input.GetMouseButtonUp(0)))
            {
                Init();
            }
        }
        //
        Vector3 newPoint = ControlTarget.position + new Vector3(posx * Time.deltaTime * speed, 0f, 0f);

        if (controlArea.OverlapPoint(newPoint))
        {
            //remove this if condition (VLX)


            ControlTarget.position += new Vector3(posx * Time.deltaTime * speed, 0f, 0f);
        }
        else
        {
            posx = 0;
        }
        newPoint = ControlTarget.position + new Vector3(0f, posy * Time.deltaTime * speed, 0f);
        if (controlArea.OverlapPoint(newPoint))
        {
            ControlTarget.position += new Vector3(0f, posy * Time.deltaTime * speed, 0);
        }
        else
        {
            posy = 0;
        }
        //		if (controlTargetPrevPos != ControlTarget.position)
        //		{
        //		}
        //		controlTargetPrevPos = controlTargetPrevPos;
    }
Beispiel #28
0
 public virtual void Unload()
 {
     SpriteBatch.Dispose();
     Starfield.Dispose();
 }
Beispiel #29
0
 public virtual void Draw(GameTime gameTime)
 {
     Starfield.Draw(new Vector2(0, -starfieldSpeed * movement));
 }
Beispiel #30
0
    // Use this for initialization
    public override void Start()
    {
        transitionIn = true;
        InitScript.inGame = false;
        background = new Starfield(0,false);
        Futile.stage.AddChild(background);

        background2 = new Starfield(320 + 80, false);
        Futile.stage.AddChild(background2);

        menuBackground = new FSprite("MenuStatic.png");
        menuBackground.scale = 2.0f;
        menuBackground.x = 0;
        menuBackground.isVisible = false;
        Futile.stage.AddChild(menuBackground);

        menuAnims = new FSprite("Menutoplay6.png");
        menuAnims.scale = 2.0f;
        menuAnims.x = 0;
        Futile.stage.AddChild(menuAnims);

        btnInstructions = new FButton("MenuButton.png");
        btnInstructions.x -= 1;
        btnInstructions.y -= 126;
        btnInstructions.scale = 2.0f;
        btnInstructions.isVisible = false;
        Futile.stage.AddChild(btnInstructions);

        btnGameCenter = new FButton("GCButton.png");
        btnGameCenter.x -= 1;
        btnGameCenter.y -= 166;
        btnGameCenter.scale = 2.0f;
        btnGameCenter.isVisible = false;
        Futile.stage.AddChild(btnGameCenter);

        //score stuffffff
        digit1 = new FSprite("0.png");
        digit1.scale = 2.0f;
        digit1.x = -159.7772f + 180;
        digit1.y = Futile.screen.halfHeight - 57;
        Futile.stage.AddChild(digit1);

        digit2 = new FSprite("0.png");
        digit2.scale = 2.0f;
        digit2.x = -159.7772f + 160;
        digit2.y = Futile.screen.halfHeight - 57;
        Futile.stage.AddChild(digit2);

        digit3 = new FSprite("0.png");
        digit3.scale = 2.0f;
        digit3.x = -159.7772f + 140;
        digit3.y = Futile.screen.halfHeight - 57;
        Futile.stage.AddChild(digit3);

        hsDigit1 = new FSprite("0.png");
        hsDigit1.scale = 2.0f;
        hsDigit1.x = -159.7772f + 180;
        hsDigit1.y = Futile.screen.halfHeight - 123;
        hsDigit1.isVisible = false;
        Futile.stage.AddChild(hsDigit1);

        hsDigit2 = new FSprite("0.png");
        hsDigit2.scale = 2.0f;
        hsDigit2.x = -159.7772f + 160;
        hsDigit2.y = Futile.screen.halfHeight - 123;
        hsDigit2.isVisible = false;
        Futile.stage.AddChild(hsDigit2);

        hsDigit3 = new FSprite("0.png");
        hsDigit3.scale = 2.0f;
        hsDigit3.x = -159.7772f + 140;
        hsDigit3.y = Futile.screen.halfHeight - 123;
        hsDigit3.isVisible = false;
        Futile.stage.AddChild(hsDigit3);

        flash = new FSprite("GameOverAnim0.png");
        flash.scale = 2.0f;
        flash.x = 0;
        flash.isVisible = false;
        Futile.stage.AddChild(flash);

        btnPlay = new FButton("PlayButton.png");
        btnPlay.x = 0;
        btnPlay.y = 0;
        btnPlay.scale = 2.0f;
        Futile.stage.AddChild(btnPlay);

        btnInstructions.SignalRelease += HandleInfoButtonRelease;
        btnGameCenter.SignalRelease += HandleGCButtonRelease;
        btnPlay.SignalRelease += HandlePlayButtonRelease;

        Futile.instance.SignalUpdate += HandleUpdate;

        //score things
        if (InitScript.hsD1 == 0)
            hsDigit1.SetElementByName("0.png");
        else if (InitScript.hsD1 == 1)
            hsDigit1.SetElementByName("1.png");
        else if (InitScript.hsD1 == 2)
            hsDigit1.SetElementByName("2.png");
        else if (InitScript.hsD1 == 3)
            hsDigit1.SetElementByName("3.png");
        else if (InitScript.hsD1 == 4)
            hsDigit1.SetElementByName("4.png");
        else if (InitScript.hsD1 == 5)
            hsDigit1.SetElementByName("5.png");
        else if (InitScript.hsD1 == 6)
            hsDigit1.SetElementByName("6.png");
        else if (InitScript.hsD1 == 7)
            hsDigit1.SetElementByName("7.png");
        else if (InitScript.hsD1 == 8)
            hsDigit1.SetElementByName("8.png");
        else if (InitScript.hsD1 == 9)
            hsDigit1.SetElementByName("9.png");

                    //the second value
        if (InitScript.hsD2 == 0)
            hsDigit2.SetElementByName("0.png");
        else if (InitScript.hsD2 == 1)
            hsDigit2.SetElementByName("1.png");
        else if (InitScript.hsD2 == 2)
            hsDigit2.SetElementByName("2.png");
        else if (InitScript.hsD2 == 3)
            hsDigit2.SetElementByName("3.png");
        else if (InitScript.hsD2 == 4)
            hsDigit2.SetElementByName("4.png");
        else if (InitScript.hsD2 == 5)
            hsDigit2.SetElementByName("5.png");
        else if (InitScript.hsD2 == 6)
            hsDigit2.SetElementByName("6.png");
        else if (InitScript.hsD2 == 7)
            hsDigit2.SetElementByName("7.png");
        else if (InitScript.hsD2 == 8)
            hsDigit2.SetElementByName("8.png");
        else if (InitScript.hsD2 == 9)
            hsDigit2.SetElementByName("9.png");

        //the third digit
        if (InitScript.hsD3 == 0)
            hsDigit3.SetElementByName("0.png");
        else if (InitScript.hsD3 == 1)
            hsDigit3.SetElementByName("1.png");
        else if (InitScript.hsD3 == 2)
            hsDigit3.SetElementByName("2.png");
        else if (InitScript.hsD3 == 3)
            hsDigit3.SetElementByName("3.png");
        else if (InitScript.hsD3 == 4)
            hsDigit3.SetElementByName("4.png");
        else if (InitScript.hsD3 == 5)
            hsDigit3.SetElementByName("5.png");
        else if (InitScript.hsD3 == 6)
            hsDigit3.SetElementByName("6.png");
        else if (InitScript.hsD3 == 7)
            hsDigit3.SetElementByName("7.png");
        else if (InitScript.hsD3 == 8)
            hsDigit3.SetElementByName("8.png");
        else if (InitScript.hsD3 == 9)
            hsDigit3.SetElementByName("9.png");

        //non highscores
        if (InitScript.oldD1 == 0)
            digit1.SetElementByName("0.png");
        else if (InitScript.oldD1 == 1)
            digit1.SetElementByName("1.png");
        else if (InitScript.oldD1 == 2)
            digit1.SetElementByName("2.png");
        else if (InitScript.oldD1 == 3)
            digit1.SetElementByName("3.png");
        else if (InitScript.oldD1 == 4)
            digit1.SetElementByName("4.png");
        else if (InitScript.oldD1 == 5)
            digit1.SetElementByName("5.png");
        else if (InitScript.oldD1 == 6)
            digit1.SetElementByName("6.png");
        else if (InitScript.oldD1 == 7)
            digit1.SetElementByName("7.png");
        else if (InitScript.oldD1 == 8)
            digit1.SetElementByName("8.png");
        else if (InitScript.oldD1 == 9)
            digit1.SetElementByName("9.png");

        if (InitScript.oldD2 == 0)
            digit2.SetElementByName("0.png");
        else if (InitScript.oldD2 == 1)
            digit2.SetElementByName("1.png");
        else if (InitScript.oldD2 == 2)
            digit2.SetElementByName("2.png");
        else if (InitScript.oldD2 == 3)
            digit2.SetElementByName("3.png");
        else if (InitScript.oldD2 == 4)
            digit2.SetElementByName("4.png");
        else if (InitScript.oldD2 == 5)
            digit2.SetElementByName("5.png");
        else if (InitScript.oldD2 == 6)
            digit2.SetElementByName("6.png");
        else if (InitScript.oldD2 == 7)
            digit2.SetElementByName("7.png");
        else if (InitScript.oldD2 == 8)
            digit2.SetElementByName("8.png");
        else if (InitScript.oldD2 == 9)
            digit2.SetElementByName("9.png");

        if (InitScript.oldD3 == 0)
            digit3.SetElementByName("0.png");
        else if (InitScript.oldD3 == 1)
            digit3.SetElementByName("1.png");
        else if (InitScript.oldD3 == 2)
            digit3.SetElementByName("2.png");
        else if (InitScript.oldD3 == 3)
            digit3.SetElementByName("3.png");
        else if (InitScript.oldD3 == 4)
            digit3.SetElementByName("4.png");
        else if (InitScript.oldD3 == 5)
            digit3.SetElementByName("5.png");
        else if (InitScript.oldD3 == 6)
            digit3.SetElementByName("6.png");
        else if (InitScript.oldD3 == 7)
            digit3.SetElementByName("7.png");
        else if (InitScript.oldD3 == 8)
            digit3.SetElementByName("8.png");
        else if (InitScript.oldD3 == 9)
            digit3.SetElementByName("9.png");

        InitScript.blackBar1.MoveToTop();
        InitScript.blackBar2.MoveToTop();
    }
Beispiel #31
0
        public override void Initialize(RenderWindow target)
        {
            base.Initialize(target);

            _starfield = new Starfield(target.Size.X, target.Size.Y);
        }