void ChangeState(ChildState newState) { // Changes the state the child is in and runs one time code for that state state = newState; // print(newState); switch (newState) { case ChildState.WANDERING: timer = wanderTime; targetRef.SetActive(true); animator.SetBool("crawling", true); animator.SetBool("carried", false); break; case ChildState.CARRIED: agent.ResetPath(); agent.enabled = false; // disable navmeshagent to keep the child from walking away while being carried animator.SetBool("crawling", false); animator.SetBool("carried", true); break; case ChildState.RUNNING: FindDirectionFromEnemy(); // foreach(Collider c in nearbyEnemies) // { // } break; case ChildState.HIDDEN: case ChildState.SAFE: timer = 0f; targetRef.SetActive(false); animator.SetBool("carried", false); break; default: timer = 0f; break; } }
void PlayerInteraction() { if (!isTriggeable) { return; } Debug.Log("Grandma found me, " + ID); childState = ChildState.Carried; // Don't allow duplicate action isTriggeable = false; GrandmaMovement.Instance.Properties.carriedChildren.Add(this); FindObjectOfType <SpeechArea>().ShowText(messageWhenFound); var audioSource = FindObjectOfType <SpeechArea>().GetComponent <AudioSource>(); audioSource.clip = kidCollectingSounds[(int)Random.Range(0, kidCollectingSounds.Length - 1)]; audioSource.Play(); }
public ChildItemViewModel(string someIdentifier, string title, ChildState state) { SomeIdentifier = someIdentifier; State = state; Title = title; }
internal void BeginGrandchildAnimation( FrameworkElement grandchild, Rect currentRect, Rect placementRect ) { bool isDone = true; object placementArgs; ChildState state = new ChildState( currentRect ); AnimationPanel.SetChildState( grandchild, state ); state.Type = AnimationType.Switch; state.BeginTimeStamp = DateTime.Now; state.TargetPlacement = placementRect; state.Animator = this.GetEffectiveAnimator( AnimationType.Template ); if( state.Animator != null && !state.TargetPlacement.IsEmpty ) { AnimationRate rate = this.GetEffectiveAnimationRate( AnimationType.Template ); state.CurrentPlacement = state.Animator.GetInitialChildPlacement( grandchild, state.CurrentPlacement, state.TargetPlacement, this, ref rate, out placementArgs, out isDone ); state.AnimationRate = rate; state.PlacementArgs = placementArgs; } state.IsAnimating = !isDone; grandchild.Arrange( state.IsAnimating ? state.CurrentPlacement : state.TargetPlacement ); if( state.IsAnimating ) { _animatingGrandchildren.Add( grandchild ); this.AnimatingChildCount++; } else { state.CurrentPlacement = state.TargetPlacement; } }
private void UpdateTrueArrange( UIElement child, ChildState state ) { if( !state.TargetPlacement.IsEmpty ) { child.Arrange( state.IsAnimating && state.Animator != null ? state.CurrentPlacement : state.TargetPlacement ); } // if the child is done entering, complete the enter routine if( !state.IsAnimating && !state.HasEnterCompleted ) { this.EndChildEnter( child, state ); } // if the child is done exiting, complete the exit routine if( !state.IsAnimating && state.HasExitBegun ) { this.EndChildExit( child, state ); } }
private ChildState EnsureChildState( UIElement child, Rect placementRect, out bool newStateCreated ) { newStateCreated = false; ChildState state = AnimationPanel.GetChildState( child ); if( state == null ) { // if this is null, it's because this is the first time that // the object has been arranged state = new ChildState( placementRect ); AnimationPanel.SetChildState( child, state ); this.BeginChildEnter( child, state ); newStateCreated = true; } return state; }
private void EndChildExit( UIElement child, ChildState state ) { // raise the ChildExited event state.HasExitCompleted = true; AnimationPanel.RaiseChildExitedEvent( child, child ); // remove the visual child relationship if( this.ExitingChildren.Contains( child ) ) { this.IsRemovingInternalChild = true; try { if( _switchParent != null ) { _switchParent.RemoveVisualChildInternal( child ); } else { this.RemoveVisualChild( child ); } } finally { this.IsRemovingInternalChild = false; } this.ExitingChildren.Remove( child ); } child.ClearValue( AnimationPanel.ChildStatePropertyKey ); }
private void EndChildEnter( UIElement child, ChildState state ) { // raise the ChildExited event state.HasEnterCompleted = true; AnimationPanel.RaiseChildEnteredEvent( child, child, state.TargetPlacement ); }
public override void Initialize() { m_audioManager = AudioManager.GetInstance(); m_audioManager.LoadSong( "SongOfMainMenuGameState", DataReader.Load<Song>( "MusicAndSoundEffect/Song/MusicOfMenuState" ) ); //m_audioManager.PlaySong( "SongOfMainMenuGameState", true ); //m_audioManager.LoadSound("def", DataReader.Load<SoundEffect>("")); //m_audioManager.PlaySong( "SongOfMainMenuGameState", true ); //m_audioManager.StopSong(); //m_audioManager.FadeSong(1,new TimeSpan(0,0,1)); m_curChildState = ChildState.BeginState; m_beginStateCollection = new List<ISprite>(); m_gameLogoDisappearStateCollection = new List<ISprite>(); m_startMenuShowStateCollection = new List<ISprite>(); m_zoomInBackgroundStateCollection = new List<ISprite>(); m_capsuleOnTargetStateCollection = new List<ISprite>(); m_distortionStateCollection = new List<ISprite>(); m_effect = GraphicsManager.GetInstance(); m_stateManager = StateManager.GetInstance(); #region Initialize the tv pictures m_tvPicture_1 = new DButton( DButton.DButtonState.Idle, "Texture/Menu/TVPicture/TVPicture_1", SpriteManager.SpriteBatch, "TVPicture_1" ); m_tvPicture_2 = new DButton( DButton.DButtonState.Idle, "Texture/Menu/TVPicture/TVMessy _3", SpriteManager.SpriteBatch, "TVPicture_2" ); m_tvPicture_3 = new DButton( DButton.DButtonState.Idle, "Texture/Menu/TVPicture/TVPicture_3", SpriteManager.SpriteBatch, "TVPicture_3" ); m_tvPicture_4 = new DButton( DButton.DButtonState.Idle, "Texture/Menu/TVPicture/TVMessy _2", SpriteManager.SpriteBatch, "TVPicture_4" ); m_tvPicture_5 = new DButton( DButton.DButtonState.Idle, "Texture/Menu/TVPicture/TVMessy _1", SpriteManager.SpriteBatch, "TVPicture_5" ); m_tvPicture_6 = new DButton( DButton.DButtonState.Idle, "Texture/Menu/TVPicture/TVPicture_6", SpriteManager.SpriteBatch, "TVPicture_6" ); m_tvPicture_7 = new DButton( DButton.DButtonState.Idle, "Texture/Menu/TVPicture/TVPicture_7", SpriteManager.SpriteBatch, "TVPicture_7" ); m_tvMessey_1 = new DButton( DButton.DButtonState.Idle, "Texture/Menu/TVPicture/TVMessy _1", SpriteManager.SpriteBatch, "TVMessy _1" ); m_tvMessey_2 = new DButton( DButton.DButtonState.Idle, "Texture/Menu/TVPicture/TVMessy _2", SpriteManager.SpriteBatch, "TVMessy _2" ); m_tvMessey_3 = new DButton( DButton.DButtonState.Idle, "Texture/Menu/TVPicture/TVMessy _3", SpriteManager.SpriteBatch, "TVMessy _3" ); m_tvPictureList = new List<DButton>(); //m_tvMesseyList = new List<DButton>(); m_tvPictureList.Add( m_tvPicture_1 ); m_tvPictureList.Add( m_tvPicture_2 ); m_tvPictureList.Add( m_tvPicture_3 ); m_tvPictureList.Add( m_tvPicture_4 ); m_tvPictureList.Add( m_tvPicture_5 ); m_tvPictureList.Add( m_tvPicture_6 ); m_tvPictureList.Add( m_tvPicture_7 ); m_tvPictureList.Add( m_tvMessey_1 ); m_tvPictureList.Add( m_tvMessey_2 ); m_tvPictureList.Add( m_tvMessey_3 ); #endregion m_logo = new ScenceSprite(); m_logo.TextureImage = DataReader.Load<Texture2D>( "Texture/Menu/CommonScene/GameLogo" ); m_startString = new ScenceSprite(); m_startString.TextureImage = DataReader.Load<Texture2D>( "Texture/Menu/CommonScene/press_0" ); m_buttonPackaging = new MainMenuButtonPackaging( SpriteManager.SpriteBatch ); m_background = new ScenceSprite(); m_background.TextureImage = DataReader.Load<Texture2D>( "Texture/Menu/CommonScene/Background" ); m_foreground = new ScenceSprite(); m_foreground.TextureImage = DataReader.Load<Texture2D>( "Texture/Menu/CommonScene/Foreground" ); m_backgroundMist = new ScenceSprite(); m_backgroundMist.TextureImage = DataReader.Load<Texture2D>( "Texture/Menu/CommonScene/Mist" ); m_ufoLight = new ScenceSprite(); m_ufoLight.TextureImage = DataReader.Load<Texture2D>( "Texture/Menu/CommonScene/UFOLight" ); #region Initialize the statics player m_staticsDarkPlayer = new ScenceSprite(); m_staticsDarkPlayer.TextureImage = DataReader.Load<Texture2D>( "Texture/Menu/CommonScene/DarkPlayer" ); #region Initial the glowing player m_staticsGlowingPlayer = new ScenceSprite() { TextureImage = DataReader.Load<Texture2D>( "Texture/Menu/CommonScene/GlowingPlayer" ), TargetOffset = new Vector2( 2000, 3000 ), DestRect = new Rectangle( 0, 0, HealGame.Game.GraphicsDevice.Viewport.Width, HealGame.Game.GraphicsDevice.Viewport.Height ), Visible = true, TColor = Color.White }; m_staticsGlowingPlayer.SourceRect = new Rectangle( 0, 0, m_staticsGlowingPlayer.TextureImage.Width, m_staticsGlowingPlayer.TextureImage.Height ); #endregion #endregion #region Initialize the tips button "Enter" m_tipsButton = new ScenceSprite() { TextureImage = DataReader.Load<Texture2D>( "Texture/Menu/CommonScene/press_1" ), Position = new Vector2( 420, 125 ), Visible = true, TColor = Color.White }; m_tipsButton.DestRect = new Rectangle( (int)m_tipsButton.Position.X, (int)m_tipsButton.Position.Y, (int)( m_tipsButton.TextureImage.Width * 0.25 ), (int)( m_tipsButton.TextureImage.Height * 0.25 ) ); m_tipsButton.SourceRect = new Rectangle( 0, 0, m_tipsButton.TextureImage.Width, m_tipsButton.TextureImage.Height ); #endregion InitLogic(); #region Add the components to the m_beginStateCollection m_beginStateCollection.Add( m_background ); m_beginStateCollection.Add( m_foreground ); m_beginStateCollection.Add( m_backgroundMist ); m_beginStateCollection.Add( m_staticsDarkPlayer ); m_beginStateCollection.Add( m_logo ); m_beginStateCollection.Add( m_startString ); #endregion #region Add the components to the m_gameLogoDisappearStateCollection m_gameLogoDisappearStateCollection.Add( m_background ); m_gameLogoDisappearStateCollection.Add( m_foreground ); m_gameLogoDisappearStateCollection.Add( m_staticsDarkPlayer ); m_gameLogoDisappearStateCollection.Add( m_backgroundMist ); #endregion #region Add the components to the m_startMenuShowStateCollection m_startMenuShowStateCollection.Add( m_background ); m_startMenuShowStateCollection.Add( m_foreground ); m_startMenuShowStateCollection.Add( m_buttonPackaging ); m_startMenuShowStateCollection.Add( m_ufoLight ); m_startMenuShowStateCollection.Add( m_staticsDarkPlayer ); m_startMenuShowStateCollection.Add( m_backgroundMist ); #endregion #region Add the components to the m_zoomInBackgroundStateCollection m_zoomInBackgroundStateCollection.Add( m_background ); m_zoomInBackgroundStateCollection.Add( m_foreground ); m_zoomInBackgroundStateCollection.Add( m_ufoLight ); m_zoomInBackgroundStateCollection.Add( m_staticsDarkPlayer ); m_zoomInBackgroundStateCollection.Add( m_backgroundMist ); #endregion #region Add the components to the m_capsuleOnTargetStateCollection m_capsuleOnTargetStateCollection.Add( m_background ); foreach( var a in m_tvPictureList ) { m_capsuleOnTargetStateCollection.Add( a ); } m_capsuleOnTargetStateCollection.Add( m_foreground ); m_capsuleOnTargetStateCollection.Add( m_tipsButton ); m_capsuleOnTargetStateCollection.Add( m_ufoLight ); m_capsuleOnTargetStateCollection.Add( m_staticsGlowingPlayer ); m_capsuleOnTargetStateCollection.Add( m_backgroundMist ); #endregion #region Add the components to the m_distortionStateCollection m_distortionStateCollection.Add( m_background ); foreach( var a in m_tvPictureList ) { m_distortionStateCollection.Add( a ); } m_distortionStateCollection.Add( m_foreground ); m_distortionStateCollection.Add( m_backgroundMist ); m_distortionStateCollection.Add( m_staticsGlowingPlayer ); #endregion this.GameStateChanged += new GameStateEventHandler( MainMenuGameState_GameStateChanged ); }
private static void SetChildState( DependencyObject d, ChildState value ) { d.SetValue( AnimationPanel.ChildStatePropertyKey, value ); }
private void Awake() { childState = ChildState.Hiding; }
void MainMenuGameState_GameStateChanged( object sender, GameState.GameStateEventArgs args ) { m_curChildState = ChildState.BeginState; }
public override void Update( GameTime gameTime ) { m_audioManager.PlaySong( "SongOfMainMenuGameState", true ); m_drawingChildState = m_curChildState; Twinkle( m_backgroundMist ); Twinkle( m_ufoLight ); switch( m_curChildState ) { #region Case ChildState.BeginState case ChildState.BeginState: { m_background.CurAlpha += m_background.FlashInterval; m_background.TColor = new Color( 1, 1, 1, (float)m_background.CurAlpha ); m_foreground.CurAlpha += m_foreground.FlashInterval; m_foreground.TColor = new Color( 1, 1, 1, (float)m_foreground.CurAlpha ); m_staticsDarkPlayer.CurAlpha += m_staticsDarkPlayer.FlashInterval; m_staticsDarkPlayer.TColor = new Color( 1, 1, 1, (float)m_staticsDarkPlayer.CurAlpha ); if( m_background.CurAlpha >= ScenceSprite.MaxAlpha ) { m_background.TColor = Color.White; m_logo.CurAlpha += m_logo.FlashInterval; m_logo.TColor = new Color( 1, 1, 1, (float)m_logo.CurAlpha ); if( m_logo.CurAlpha >= ScenceSprite.MaxAlpha ) { m_startString.TColor = new Color( 1, 1, 1, (float)Math.Sin( m_startString.CurAlpha * Math.PI ) ); m_startString.CurAlpha += m_startString.FlashInterval; if( m_startString.CurAlpha >= ScenceSprite.MaxAlpha ) m_startString.CurAlpha = 0.0f; } if( Input.IsConfirmKeyDown() ) { m_curChildState = ChildState.GameLogoDisappearState; } } } break; #endregion #region Case ChildState.GameLogoDisappearState case ChildState.GameLogoDisappearState: { m_startString.CurAlpha = Math.Abs( m_startString.FlashInterval ); m_logo.CurAlpha = Math.Abs( m_logo.FlashInterval ); m_startString.CurAlpha = 0.0f; m_logo.TColor = new Color( new Vector4( 255, 255, 255, m_logo.CurAlpha ) ); m_startString.TColor = new Color( new Vector4( 255, 255, 255, m_startString.CurAlpha ) ); if( m_logo.CurAlpha <= 0.02 ) { m_curChildState = ChildState.StartMenuShowState; } } break; #endregion #region Case ChildState.StartMenuShowState case ChildState.StartMenuShowState: { float count = (float)gameTime.ElapsedGameTime.TotalSeconds; m_timer += count; if( m_timer >= 0.5f ) { m_buttonPackaging.Update( gameTime ); if( !m_isSpacePressed && Input.IsConfirmKeyDown() ) { switch( MainMenuButtonPackaging.MateButtonName ) { case "NewGameButton": { m_curChildState = ChildState.ZoomInBackgroundState; } break; case "ContinueButton": { m_curChildState = ChildState.DistortionState; //逻辑需要完善,需要读取前一记录的地图位置,人物状态 } break; case "OptionButton": { m_stateManager.GotoState( StateManager.States.OptionMenuGameState, null ); } break; case "HowToPlay": { m_stateManager.GotoState( StateManager.States.HelpGameState, null ); } break; case "AchievementsButton": { m_stateManager.GotoState( StateManager.States.AchievementMenuState, null ); } break; case "CreditButton": { m_stateManager.GotoState( StateManager.States.CreditShowMenuState, null ); } break; case "ExitButton": { HealGame.Game.Exit(); } break; } } } m_isSpacePressed = Input.IsConfirmKeyDown(); } break; #endregion #region Case ChildState.ZoomInBackgroundState case ChildState.ZoomInBackgroundState: { float runningTime = m_count + (float)gameTime.ElapsedGameTime.TotalSeconds; m_count = runningTime; // % 10; m_scaleCount += ( runningTime ) / 10; if( m_count > 8 ) { m_count = 8; } m_scale = ( 1f - m_count / 8f ) * .5f + .5f; var locate = new Point( (int)( m_count * 190f * 0.5f ), (int)( m_count * 90f * 3f / 4f ) ); m_background.SourceRect = new Rectangle( locate.X, locate.Y, (int)( m_background.TextureImage.Width * m_scale ), (int)( m_background.TextureImage.Height * m_scale ) ); m_foreground.SourceRect = new Rectangle( locate.X, locate.Y, (int)( m_foreground.TextureImage.Width * m_scale ), (int)( m_foreground.TextureImage.Height * m_scale ) ); m_backgroundMist.SourceRect = new Rectangle( locate.X, locate.Y, (int)( m_backgroundMist.TextureImage.Width * m_scale ), (int)( m_backgroundMist.TextureImage.Height * m_scale ) ); m_ufoLight.SourceRect = new Rectangle( locate.X, locate.Y, (int)( m_ufoLight.TextureImage.Width * m_scale ), (int)( m_ufoLight.TextureImage.Height * m_scale ) ); m_staticsDarkPlayer.SourceRect = new Rectangle( locate.X, locate.Y, (int) ( m_staticsDarkPlayer.TextureImage.Width * m_scale ), (int) ( m_staticsDarkPlayer.TextureImage.Height * m_scale ) ); m_staticsGlowingPlayer.SourceRect = new Rectangle( locate.X, locate.Y, (int) ( m_staticsGlowingPlayer.TextureImage.Width * m_scale ), (int) ( m_staticsGlowingPlayer.TextureImage.Height * m_scale ) ); if( m_scaleCount >= 300 ) { m_curChildState = ChildState.CapsuleOnTargetState; m_scaleCount = 0; } } break; #endregion #region Case ChildState.CapsuleOnTargetState case ChildState.CapsuleOnTargetState: { float a = (float)gameTime.TotalGameTime.TotalMilliseconds/10; if( Input.IsConfirmKeyDown() == false ) { if( a % 2 == 0 ) { ResetTVPictureState(); m_picNum = MathTools.RandomGenerate(m_tvPictureList.Count - 1); m_tvPictureList[m_picNum].Visible = true; } } else { ResetTVPictureState(); m_curChildState = ChildState.DistortionState; } break; } #endregion #region Case ChildState.DistortionState case ChildState.DistortionState: { float runningTime = m_count + gameTime.ElapsedGameTime.Milliseconds; m_count = (int)runningTime % 10; m_scaleCount += (int)( runningTime ) / 10; if( m_scaleCount > 800 ) { m_scaleCount = 800; AIControler.IsDead = false; GameItemState.Reset(); MapManager.GetInstance().Goto("Map0"); m_stateManager.GotoState( StateManager.States.RunningGameState, null ); } var scale = ( 1f - m_scaleCount / 800f ); m_effect.Parameters( "Screw", "Intensity" ).SetValue( (float)Math.Pow( scale, .3 ) ); } break; #endregion } }
public override void Update( GameTime gameTime ) { m_drawingChildState = m_curChildState; switch( m_curChildState ) { #region Case ChildState.ShowTeamlogoState case ChildState.ShowTeamlogoState: { m_teamlogo.TColor = new Color(1, 1, 1, (float) Math.Sin(0.3*m_teamlogo.CurAlpha*Math.PI)); m_teamlogo.CurAlpha += m_teamlogo.FlashInterval; if (m_teamlogo.TColor.A <= 0.01) m_curChildState = ChildState.ShowRespectState; } break; #endregion #region Case ChildState.ShowRespectState case ChildState.ShowRespectState: { if (Input.IsPauseKeyDown()) m_stateManager.GotoState(StateManager.States.MainMenuState, null); //m_audioManager.LoadSong( "MusicAndSoundEffect/Music/MusicInRespectShowState", ); float count = (float) gameTime.ElapsedGameTime.TotalSeconds; m_timerInRespect += count; m_respectBackground.TColor = new Color(1, 1, 1, (float) Math.Sin(0.18*m_respectBackground.CurAlpha*Math.PI)); m_respectBackground.CurAlpha += m_respectBackground.FlashInterval; m_word_1.TColor = new Color(1, 1, 1, (float) Math.Sin(0.36*m_word_1.CurAlpha*Math.PI)); m_word_1.CurAlpha += m_word_1.FlashInterval; if (m_word_1.TColor.A <= 0.05f) { m_word_1.CurAlpha = 0; if (m_timerInRespect >= 2.0f) { m_word_2.TColor = new Color(1, 1, 1, (float) Math.Sin(0.36*m_word_2.CurAlpha*Math.PI)); m_word_2.CurAlpha += m_word_2.FlashInterval; if (m_word_2.TColor.A <= 0.01f) { m_curChildState = ChildState.ShowStoryState; } } } } break; #endregion #region Case ChildState.ShowStoryState case ChildState.ShowStoryState: if (m_showStoryTexPackaging.IsFinished || Input.IsPauseKeyDown()) m_stateManager.GotoState( StateManager.States.MainMenuState, null ); m_showStoryTexPackaging.Update(); break; #endregion } }
private void BeginChildEnter( UIElement child, ChildState state ) { state.Type = AnimationType.Enter; // raise the ChildEntering event ChildEnteringEventArgs ceea = AnimationPanel.RaiseChildEnteringEvent( child, child, GetEnterFrom( child ), state.CurrentPlacement ); // begin the enter animation, if necessary state.Animator = this.GetEffectiveAnimator( AnimationType.Enter ); if( state.Animator != null && ceea.EnterFrom.HasValue ) { state.CurrentPlacement = ceea.EnterFrom.Value; state.BeginTimeStamp = DateTime.Now; } }
public override void Initialize() { m_curChildState = ChildState.ShowTeamlogoState; m_stateManager = StateManager.GetInstance(); m_showStoryTexPackaging = new ShowStoryTexPackaging(); m_showStoryTexPackaging.Initialize(); #region Initialize ScenceSprites #region Initialize the teamlogo m_teamlogo = new ScenceSprite() { TextureImage = DataReader.Load<Texture2D>( "Texture/Menu/Teamlogo/teamlogo" ), DestRect = new Rectangle( 0, 0, HealGame.Game.GraphicsDevice.Viewport.Width, HealGame.Game.GraphicsDevice.Viewport.Height ), CurAlpha = 0.1f, FlashInterval = 0.008f, Visible = true, }; m_teamlogo.TColor = new Color( new Vector4( 255, 255, 255, m_teamlogo.CurAlpha ) ); m_teamlogo.SourceRect = new Rectangle( 0, 0, m_teamlogo.TextureImage.Width, m_teamlogo.TextureImage.Height ); #endregion #region Initialize the respectBackground m_respectBackground = new ScenceSprite() { TextureImage = DataReader.Load<Texture2D>( "Texture/Menu/RespectShow/b_0" ), DestRect = new Rectangle( 0, 0, HealGame.Game.GraphicsDevice.Viewport.Width, HealGame.Game.GraphicsDevice.Viewport.Height ), CurAlpha = 0.0f, FlashInterval = 0.005f, Visible = true, }; m_respectBackground.TColor = new Color( new Vector4( 255, 255, 255, m_respectBackground.CurAlpha ) ); m_respectBackground.SourceRect = new Rectangle( 0, 0, m_respectBackground.TextureImage.Width, m_respectBackground.TextureImage.Height ); #endregion #region Initialize the respect word_1 m_word_1 = new ScenceSprite() { TextureImage = DataReader.Load<Texture2D>( "Texture/Menu/RespectShow/b_1" ), DestRect = new Rectangle( 0, 0, HealGame.Game.GraphicsDevice.Viewport.Width, HealGame.Game.GraphicsDevice.Viewport.Height ), CurAlpha = 0.2f, FlashInterval = 0.005f, Visible = true, }; m_word_1.TColor = new Color( new Vector4( 255, 255, 255, m_word_1.CurAlpha ) ); m_word_1.SourceRect = new Rectangle( 0, 0, m_word_1.TextureImage.Width, m_word_1.TextureImage.Height ); #endregion #region Initialize the respect word_2 m_word_2 = new ScenceSprite() { TextureImage = DataReader.Load<Texture2D>( "Texture/Menu/RespectShow/b_2" ), DestRect = new Rectangle( 0, 0, HealGame.Game.GraphicsDevice.Viewport.Width, HealGame.Game.GraphicsDevice.Viewport.Height ), CurAlpha = 0.005f, FlashInterval = 0.005f, Visible = true, }; m_word_2.TColor = new Color( new Vector4( 255, 255, 255, m_word_2.CurAlpha ) ); m_word_2.SourceRect = new Rectangle( 0, 0, m_word_2.TextureImage.Width, m_word_2.TextureImage.Height ); #endregion m_showTeamlogoCollection = new List<ISprite>(); m_showRespectCollection = new List<ISprite>(); #region Add the components to the m_showTeamlogoCollection m_showTeamlogoCollection.Add(m_teamlogo); #endregion #region Add the components to the m_showRespectCollection m_showRespectCollection.Add( m_respectBackground ); m_showRespectCollection.Add( m_word_1); m_showRespectCollection.Add( m_word_2 ); #endregion #endregion }
public void InitState(ChildState aState) { m_ChildState = aState; //Debug.Log("Initiation " + m_ChildState); switch (m_ChildState) { case ChildState.Free: //Locate a Destination Vector3 target = Vector3.zero; int counter = 0; while (target == Vector3.zero) { target = (AIUtils.ReturnRandomLocation(transform.position, TRAVEL_RANGE)); counter++; if (counter > 5000) { Debug.LogError("Stuck in While Loop"); break; } } m_Agent.SetDestination(target); //Randomize a Speed m_Agent.speed = Random.Range(MIN_RANGE_OF_NEUTRAL_SPEEDS, MAX_RANGE_OF_NEUTRAL_SPEEDS); break; case ChildState.Interacting: //Set Desitnation to be Distraction Object m_Agent.SetDestination(m_InteractionObject.transform.position); //Sit in a Position m_Agent.speed = 0; //Reset the Timer m_Timer.CancalTime(); break; case ChildState.Chase: //Set Fast Speed m_Agent.speed = CHASE_SPEED; break; case ChildState.Search: m_ResetTimer.CancalTime(); m_Agent.speed = MIN_RANGE_OF_NEUTRAL_SPEEDS; m_Agent.SetDestination(m_Cat.transform.position); break; case ChildState.Ritual: Ritual.Action(m_Agent); break; default: Debug.LogError("Unimplemented State"); break; } }