public void setBlack() { state = BWState.Black; blackField.SetActive(true); whiteField.SetActive(false); }
public void SetWhite() { state = BWState.White; blackField.SetActive(false); whiteField.SetActive(true); }
void change() { Debug.Log("change " + state.ToString()); if (state == BWState.White) { state = BWState.MidBlack; changeTimeTem = 0; coverBroad.color = new Color(1f, 1f, 1f, 0f); HOTween.To(coverBroad , changeDuration / 2 , new TweenParms().Prop("color", new Color(1f, 1f, 1f, 1f), false) .OnComplete(setBlack) ); HOTween.To(coverBroad , changeDuration / 2 , new TweenParms().Prop("color", new Color(1f, 1f, 1f, 0f), false) .Delay(changeDuration / 2 + changeStop) ); coverWord.SetSprite("word" + UnityEngine.Random.Range(1, 5).ToString()); if (UnityEngine.Random.Range(0, 1f) < 0.5f) { coverWord.transform.eulerAngles += new Vector3(0, 0, 180f); } coverWord.color = new Color(0f, 0, 0, 0f); HOTween.To(coverWord , changeDuration / 2 , new TweenParms().Prop("color", new Color(0f, 0f, 0f, 1f), false) ); HOTween.To(coverWord , changeDuration / 2 , new TweenParms().Prop("color", new Color(0f, 0f, 0f, 0f), false) .Delay(changeDuration / 2 + changeStop) ); } else if (state == BWState.Black) { state = BWState.MidWhite; changeTimeTem = 0; coverBroad.color = new Color(0f, 0f, 0f, 0f); HOTween.To(coverBroad , changeDuration / 2 , new TweenParms().Prop("color", new Color(0f, 0f, 0f, 1f), false) .OnComplete(SetWhite) ); HOTween.To(coverBroad , changeDuration / 2 , new TweenParms().Prop("color", new Color(0f, 0f, 0f, 0f), false) .Delay(changeDuration / 2 + changeStop) ); coverWord.color = new Color(1f, 1f, 1f, 0f); coverWord.SetSprite("word" + UnityEngine.Random.Range(1, 5).ToString()); if (UnityEngine.Random.Range(0, 1f) < 0.5f) { coverWord.transform.eulerAngles += new Vector3(0, 0, 180f); } HOTween.To(coverWord , changeDuration / 2 , new TweenParms().Prop("color", new Color(1f, 1f, 1f, 1f), false) ); HOTween.To(coverWord , changeDuration / 2 , new TweenParms().Prop("color", new Color(1f, 1f, 1f, 0f), false) .Delay(changeDuration / 2 + changeStop) ); } }
void change () { Debug.Log( "change " + state.ToString() ); if ( state == BWState.White ) { state = BWState.MidBlack; changeTimeTem = 0; coverBroad.color = new Color( 1f , 1f , 1f , 0f ); HOTween.To( coverBroad , changeDuration /2 , new TweenParms().Prop( "color" , new Color( 1f , 1f , 1f , 1f ) , false ) .OnComplete( setBlack ) ); HOTween.To( coverBroad , changeDuration /2 , new TweenParms().Prop( "color" , new Color( 1f , 1f , 1f , 0f ) , false ) .Delay( changeDuration / 2 + changeStop ) ); coverWord.SetSprite( "word" + UnityEngine.Random.Range( 1 , 5).ToString() ); if ( UnityEngine.Random.Range( 0 , 1f ) < 0.5f ) coverWord.transform.eulerAngles += new Vector3( 0 , 0 , 180f ); coverWord.color = new Color( 0f , 0 , 0 , 0f ); HOTween.To( coverWord , changeDuration /2 , new TweenParms().Prop( "color" , new Color( 0f , 0f , 0f , 1f ) , false ) ); HOTween.To( coverWord , changeDuration /2 , new TweenParms().Prop( "color" , new Color( 0f , 0f , 0f , 0f ) , false ) .Delay( changeDuration / 2 + changeStop ) ); }else if ( state == BWState.Black ) { state = BWState.MidWhite; changeTimeTem = 0; coverBroad.color = new Color( 0f , 0f , 0f , 0f ); HOTween.To( coverBroad , changeDuration /2 , new TweenParms().Prop( "color" , new Color( 0f , 0f , 0f , 1f ) , false ) .OnComplete( SetWhite ) ); HOTween.To( coverBroad , changeDuration /2 , new TweenParms().Prop( "color" , new Color( 0f , 0f , 0f , 0f ) , false ) .Delay( changeDuration / 2 + changeStop ) ); coverWord.color = new Color( 1f ,1f ,1f ,0f ); coverWord.SetSprite( "word" + UnityEngine.Random.Range( 1 , 5).ToString() ); if ( UnityEngine.Random.Range( 0 , 1f ) < 0.5f ) coverWord.transform.eulerAngles += new Vector3( 0 , 0 , 180f ); HOTween.To( coverWord , changeDuration /2 , new TweenParms().Prop( "color" , new Color( 1f , 1f , 1f , 1f ) , false ) ); HOTween.To( coverWord , changeDuration /2 , new TweenParms().Prop( "color" , new Color( 1f , 1f , 1f , 0f ) , false ) .Delay( changeDuration / 2 + changeStop ) ); } }