Пример #1
0
 public Pong(BaseGame game, IGState previous, Color c)
     : base(game, previous)
 {
     DragFrom = Vector2.Zero;
     Game.BackGroundTune.SetVolume(0f);
     if (Message == "Listen to the ball")
     {
         Wait = new Tween(new TimeSpan(0, 0, 0, 1, 500), 0, 1);
     }
     else
     {
         Wait = new Tween(new TimeSpan(0, 0, 0, 7), 0, 1);
     }
     State = 0;
     Game.Audio.Say(Message);
     Message            = "Listen to the ball";
     game.ParticleColor = (c == Color.Black) ? Color.White : Color.Black;
     Color      = c;
     voice1     = new SynthVoice(Game.Audio, AudioChannels.Synth);
     instrument = new SynthInstrument();
     instrument.Oscillators.Add(new SineOscillator());
     instrument.Frequency = 220;
     voice1.LoadInstrument(instrument);
     Restart();
 }
Пример #2
0
        public BugHunt(BaseGame game, IGState previous, Color c)
            : base(game, previous)
        {
            DragFrom = Vector2.Zero;
            Game.BackGroundTune.SetVolume(0f);
            Splats = new List <Splatter>();
            if (Message == "Get That Bug")
            {
                Wait = new Tween(new TimeSpan(0, 0, 0, 1), 0, 1);
            }
            else
            {
                Wait = new Tween(new TimeSpan(0, 0, 0, 5), 0, 1);
            }
            State = 0;
            Game.Audio.Say(Message);
            Message            = "Get That Bug";
            game.ParticleColor = (c == Color.Black) ? Color.White : Color.Black;
            Color        = c;
            LastLocation = new Vector2(-10, -10);
            voice1       = new SynthVoice(Game.Audio, AudioChannels.Synth);
            instrument   = new SynthInstrument();
            //instrument.Oscillators.Add(new SquareOscillator());
            instrument.Oscillators.Add(new SawtoothOscillator());
            instrument.Frequency = 220; // frequence de base
            voice1.LoadInstrument(instrument);
            Difficulty = 200f;
            enemy      = (Game.UnifiedInput.Location == Vector2.Zero)?enemy:Game.UnifiedInput.Location;

            steeringBehaviour = SB.Flee;
            SBs  = steeringBehaviour;
            cars = new Vehicle[1];
            InitializeCars();
        }
Пример #3
0
 public MenuBugHunt(BaseGame game, IGState previous, Color c)
     : base(game, previous)
 {
     Game.Audio.Say(Message);
     Message            = "Bug Hunt";
     game.ParticleColor = (c == Color.Black) ? Color.White : Color.Black;
     Color = c;
 }
 public MenuScissorsPaperRock(BaseGame game, IGState previous, Color c)
     : base(game, previous)
 {
     Game.Audio.Say(Message);
     Message            = "Scissors Paper Rock";
     game.ParticleColor = (c == Color.Black) ? Color.White : Color.Black;
     Color = c;
 }
Пример #5
0
 public MainMenu(BaseGame game, IGState previous, Color c)
     : base(game, previous)
 {
     Game.Audio.Say(Message);
     Message            = "Select a game, Tap to play.";
     game.ParticleColor = (c == Color.Black) ? Color.White : Color.Black;
     Color = c;
     Game.BackGroundTune.SetVolume(1f);
 }
Пример #6
0
        public MainMenu(BaseGame game, IGState previous)
            : base(game, previous)
        {
            UnifiedInput.DraggedListeners.Add(ChangeMenu);

            _menuItems.Add(new MenuSelection("Swipe left or right to select a game,  Tap the screen to play.", () => { },
                                             _menuItems));
            _menuItems.Reset();
            Game.Audio.Say(_menuItems.Value.Message);
        }
Пример #7
0
 protected GState(BaseGame game, IGState previous)
 {
     _game        = game;
     _spriteBatch = new SpriteBatch(_game.GraphicsDevice);
     _game.KeyboardInput.IsOSKVisable = false;
     if (previous != null)
     {
         previous.NextComponent = null;
     }
     PreviousComponent = previous;
     NextComponent     = null;
 }
Пример #8
0
 public ScissorsPaperRock(BaseGame game, IGState previous, Color c)
     : base(game, previous)
 {
     Game.BackGroundTune.SetVolume(0f);
     DragFrom = Vector2.Zero;
     Game.Audio.Say(Message);
     Message            = "Touch to start";
     game.ParticleColor = (c == Color.Black) ? Color.White : Color.Black;
     Color          = c;
     LastLocation   = new Vector2(-10, -10);
     ChoicePlayer   = -1;
     ChoiceComputer = -1;
     State          = 0;
     SPRWait        = new Tween(new TimeSpan(0, 0, 0, 1, 500), 0, 1);
 }
Пример #9
0
 public MarcoPolo(BaseGame game, IGState previous, Color c)
     : base(game, previous)
 {
     DragFrom = Vector2.Zero;
     Game.BackGroundTune.SetVolume(0f);
     woosh = new Tween(new TimeSpan(0, 0, 0, 5), 0, 1);
     Game.Audio.Say(Message);
     Message            = "Let's go";
     game.ParticleColor = (c == Color.Black) ? Color.White : Color.Black;
     Color    = c;
     Location = new Vector2(-10, -10);
     Tap      = Location;
     Timer    = new Tween(new TimeSpan(0, 0, 0, (Message == "Let's go")?3:10), 0, 1);
     Wait     = new Tween(new TimeSpan(0, 0, 0, 1), 0, 1);
     Marco    = true;
     TapTimer = new Tween(new TimeSpan(0, 0, 0, 5), 0, 1);
 }
Пример #10
0
        protected override void Initialize()
        {
            Audio          = new AudioFx(this);
            _currentTarget = new RenderTarget2D(Graphics.GraphicsDevice, Graphics.PreferredBackBufferWidth,
                                                Graphics.PreferredBackBufferHeight, false,
                                                SurfaceFormat.Color,
                                                DepthFormat.Depth24,
                                                0,
                                                RenderTargetUsage.PreserveContents);
            _previousTarget = new RenderTarget2D(Graphics.GraphicsDevice, Graphics.PreferredBackBufferWidth,
                                                 Graphics.PreferredBackBufferHeight, false,
                                                 SurfaceFormat.Color,
                                                 DepthFormat.Depth24,
                                                 0,
                                                 RenderTargetUsage.PreserveContents);
            _currentComponent = this;
            FadeX1            = 1f;
            FadeX2            = 1f;
            _fade1Xin         = false;
            _fade2Xin         = false;

            base.Initialize();
        }
Пример #11
0
 public void OnTimedEvent(object source, ElapsedEventArgs e)
 {
     if(((DateTime.UtcNow.Ticks - m_nHearthbeatTime) / 10000) > HC.HEARTHBEAT_LOCAL_TIMEOUT_NOTRESPONDING)
     {
         if (((DateTime.UtcNow.Ticks - m_nHearthbeatTime) / 10000) > HC.HEARTHBEAT_LOCAL_TIMEOUT_DISCONNECTING)
         {
             m_timer.Enabled = false;
             if ((m_sUser != null) &&
                 (m_eStatus != IGState.IGSMSTATUS_DISCONNECTING) &&
                 m_serverMgr.IsLocalServer())
             {
                 m_eStatus = IGState.IGSMSTATUS_DISCONNECTING;
                 m_serverMgr.AppendError("Hearthbeat TIMEOUT, disconnecting user " + m_sUser);
                 IGConnection connection = null;
                 IGServerManagerLocal.LocalInstance.GetConnection(m_sUser, out connection, true);
                 IGConnectionLocal userConnection = (IGConnectionLocal)connection;
                 if (userConnection != null)
                     userConnection.Reset(null);
             }
             m_eStatus = IGState.IGSMSTATUS_DISCONNECTING;
         }
         else
             m_eStatus = IGState.IGSMSTATUS_NOTRESPONDING;
     }
     else
     {
         if (IGRequestProcessing.IsBusy(m_sUser))
             m_eStatus = IGState.IGSMSTATUS_WORKING;
         else
             m_eStatus = IGState.IGSMSTATUS_READY;
     }
 }
Пример #12
0
 public IGSMStatusUser(string sUser)
     : base(sUser)
 {
     IGConnection userConnection = null;
     IGServerManagerLocal.LocalInstance.GetConnection(sUser, out userConnection);
     if(userConnection == null)
         m_eStatus = IGState.IGSMSTATUS_READY;
     else
         Init((IGConnectionLocal)userConnection);
 }
Пример #13
0
 public IGSMStatusUser()
     : base(null)
 {
     m_nSessionLength = 0;
     m_nIdleTime = 0;
     m_nStartTime = DateTime.UtcNow.Ticks;
     m_nStartIdleTime = DateTime.UtcNow.Ticks;
     m_nHearthbeatTime = DateTime.UtcNow.Ticks;
     m_eStatus = IGState.IGSMSTATUS_READY;
     m_lsImages = new List<string>();
     m_timer = new System.Timers.Timer();
     m_timer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
     m_timer.Interval = IGSMSTATUS_HEARTHBEAT_CHECKTIME;
 }
Пример #14
0
    void Awake()
    {
        st = this ;
        //Rect r =new Rect();
        _stepMoveDistince = 0.166667f/16.0f ;
        _minDistince   =   _stepMoveDistince * 2;

        Vector3 _down  = transform.TransformDirection( Vector3.down ) ;
        Vector3 _up    = transform.TransformDirection( Vector3.up ) ;
        Vector3 _left  = transform.TransformDirection( Vector3.left ) ;
        Vector3 _right = transform.TransformDirection( Vector3.right ) ;

        //Vector3 _down  = transform.TransformDirection( Vector3.down ) ;
        //Vector3 _up    = transform.TransformDirection( Vector3.up ) ;
        _up_down = new Vector3[2];
        _up_down [0] = _up;
        _up_down [1] = _up;

        Vector3Direction vdown = new Vector3Direction(_down, 0.166667f  + _minDistince );
        Vector3Direction vup = new Vector3Direction(_up, 0.166667f  + _minDistince );

        Vector3Direction vleft = new Vector3Direction( _left ,  _minDistince );
        Vector3Direction vright = new Vector3Direction( _right ,  _minDistince );

        _listDirection.Add(vdown) ;
        _listDirection.Add(vright) ;
        //_listDirection.Add(_up) ;
        _listDirection.Add(vleft) ;

        _isGameOver = false ;
        _isEditing  = false  ;
        _status = PlayingStatus.Normal ;
        _gridWidth =( Screen.width /1024.0f) * _gridWidth;

        _layerFlashMask    = 1 << LayerMask.NameToLayer("flash") ;
        _layerFlash = LayerMask.NameToLayer("flash") ;
        _layerNormal =  LayerMask.NameToLayer("normal") ;

        float _width = _gridWidth ;

        // x 21 y 100
        _Maps = new IGMaps[16,108];
        for(int i = 0 ;i <16 ; i++ )
        {
            //_Maps[i] = new ObjectsMap[100] ;
            for(int j = 0 ; j < 108 ; j++ )
            {
                _Maps[i,j] = new IGMaps() ;
                _Maps[i,j].x = i ;
                _Maps[i,j].y = j ;

                //_gameMaps[i][j].ObjectPoint    = new Vector2(  _width * i + _width/2 ,_width*j + _width/2 ) ;

                _Maps[i,j].position = Camera.main.ScreenToWorldPoint ( new Vector3( _width * i + _width/2 , _screenHeigh - (_width*j+_width/2)  ,2.0f ) ) ;
                Vector3 v3=  Camera.main.ScreenToWorldPoint ( new Vector3( _width * i  , _screenHeigh - ( _width*j )  ,2.0f ) ) ;
                _Maps[i,j].rect = new Rect(v3.x,v3.y,0.1666667f,0.1666667f);

                //Camera.main.WorldToScreenPoint
                //_gameMaps[i][j].
                // _gameMaps[i][j].ObjectPosition = Camera.main.ScreenToWorldPoint ( new Vector3( _width * i + _width/2 , 768 - (_width*j+_width/2)  ,2.0f ) ) ;

            }
        }

        /*
        for(int j = 0 ; j < 100 ; j++ )
        {
            Vector3 v3 = Camera.main.ScreenToWorldPoint ( new Vector3( 0 , 0 - (_width*j+_width/2)  ,2.0f ) ) ;
            Rect r =new Rect(0,0,0.166667f,0.166667f);
            Ylist.Add( j ,v3.y );
            print( v3.y ) ;
        }
        */

         // x=-1.166667,y=-0.8333333
         // 64x=-1.166667,64y=0.1666667,0x=-1.333333,0y=0,1024x=1.333333,768y=2
        Vector3 v64 = Camera.main.ScreenToWorldPoint ( new Vector3( 64.0f , 64.0f ,2.0f ) ) ;
        Vector3 v0 = Camera.main.ScreenToWorldPoint ( new Vector3( 0f , 0f ,2.0f ) ) ;
        Vector3 v1024 = Camera.main.ScreenToWorldPoint ( new Vector3( 1024f , 768f ,2.0f ) ) ;

        print( string.Format( "64x={0},64y={1},0x={2},0y={3},1024x={4},768y={5}",v64.x ,v64.y ,v0.x , v0.y  ,v1024.x ,v1024.y  ) ) ;

        StartCoroutine(FlashingOffset());
        //	GameObject _object = (GameObject)Instantiate(_Prefab);
        //	_object.transform.position = _gameMaps[3][8].ObjectPosion ;
    }
Пример #15
0
        protected async override void Update(GameTime gameTime)
        {
            if (IsPaused)
            {
                return;
            }
            if (NextComponent == null)
            {
                NextComponent = new MainMenu(this, null, Color.White);
            }
            if (_currentComponent.Transition >= 1)
            {
                TouchInput.Update(gameTime);
                MouseInput.Update(gameTime);
                UnifiedInput.Update(gameTime);
                KeyboardInput.Update(gameTime);
            }

            if (_fade1Xin)
            {
                FadeX1 += 0.025f;
                if (FadeX1 >= 1f)
                {
                    _fade1Xin = false;
                }
            }
            else
            {
                FadeX1 -= 0.025f;
                if (FadeX1 <= .5f)
                {
                    _fade1Xin = true;
                }
            }
            if (_fade2Xin)
            {
                FadeX2 += 0.05f;
                if (FadeX2 >= 1f)
                {
                    _fade2Xin = false;
                }
            }
            else
            {
                FadeX2 -= 0.05f;
                if (FadeX2 <= 0.5f)
                {
                    _fade2Xin = true;
                }
            }

            if ((_currentComponent ?? this).Transition >= 1f)
            {
                NextComponent = (_currentComponent ?? this).Update(gameTime, this);
            }

            if (_currentComponent != null)
            {
                _currentComponent.Transition += 0.05f;
                if (EnableGoBack)
                {
                    if (_currentComponent.HasPrevious &&
                        _taps.Any(t => new Rectangle((int)Width - 64, 0, 64, 64).Contains(t)))
                    {
                        //Audio.Play(Cues.Fail);
                        _currentComponent.Back();
                    }


                    if (_currentComponent.HasPrevious && KeyboardInput.TypedKey(Keys.Escape))
                    {
                        //Audio.Play(Cues.Fail);
                        _currentComponent.Back();
                    }
                }
            }
            if (_previousComponent != null)
            {
                _previousComponent.Transition -= 0.05f;
            }

            if (NextComponent != null && NextComponent != _currentComponent)
            {
                GameData.Save();
                _previousComponent = _currentComponent;
                _currentComponent  = NextComponent;
            }

            _taps.Clear();
            base.Update(gameTime);
        }