void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "Main" && this.tag == "Up(Idle)") { PlayerPrefs.SetInt("SpawnCheck",1); if((PlayerPrefs.GetInt("StageLevel")+1)%2==0){ PlayerPrefs.SetInt("Spawn",2); PlayerPrefs.SetInt("StageLevel",PlayerPrefs.GetInt("StageLevel")+1); Stage.GetComponent<UILabel> ().text = "Stage : "+PlayerPrefs.GetInt("StageLevel"); other.gameObject.GetComponent<Transform> ().localPosition = new Vector3 (260,70,other.gameObject.GetComponent<Transform> ().position.z); LStair.tag = "Up(Idle)"; RStair.tag = "Up(Close)"; Debug.Log("위로 이동"); } else if((PlayerPrefs.GetInt("StageLevel")+1)%2!=0) { PlayerPrefs.SetInt("Spawn",1); PlayerPrefs.SetInt("StageLevel",PlayerPrefs.GetInt("StageLevel")+1); Stage.GetComponent<UILabel> ().text = "Stage : "+PlayerPrefs.GetInt("StageLevel"); other.gameObject.GetComponent<Transform> ().localPosition = new Vector3 (-260,70,other.gameObject.GetComponent<Transform> ().position.z); LStair.tag = "Up(Close)"; RStair.tag = "Up(Idle)"; Debug.Log("위로 이동"); } } else if (other.gameObject.tag == "Main" &&this.tag == "Up(Close)") { SystemMessage.GetComponent<UILabel> ().text = "계단이 잠겨있습니다.(반대 계단으로 이동)"; FadeOut = TweenAlpha.Begin(SystemMessage,2f,1f); FadeOut.enabled = true; FadeOut.from = 1f; FadeOut.to = 0f; FadeOut.Reset(); } }
public override void OnActivate() { base.OnActivate(); ActivityManager.Instance.ToggleHud(false); ActivityManager.Instance.PullCurtain(); ToyBox.GetPandora().TimePaused = true; StartTween.Reset(); //AudioPlayer.GetPlayer().pop ActivityManager.Instance.PopAudio(); //Pull curtain on open? ActivityManager.Instance.DrawCurtain(); //Set the bg intro animation BGIntro.Reset(); BGIntro.Play(true); //Local hack to disable the intial OnClick call on activate. started = false; }
void SetTweenAlphaOneToZero() { //开始播八个阵的显示动画 foreach (var item in gObjItems) { Transform TransMask = item.transform.FindChild("Mask"); TweenAlpha tweenAlpha = TransMask.GetComponent <TweenAlpha>(); if ((curChooseObj != null && curChooseObj == TransMask.gameObject) || checkTouchIfAreadlyGetPrize(item.transform.FindChild("Mask").gameObject)) { continue; } if (tweenAlpha != null) { tweenAlpha.Reset(); tweenAlpha.enabled = true; tweenAlpha.alpha = 1f; tweenAlpha.from = 1f; tweenAlpha.to = 0f; tweenAlpha.callWhenFinished = "OnTweenAlpahFinished"; } } }
private void showCard() { float timeCount = 0; int countLotteryRet = Obj_MyselfPlayer.GetMe().lotteryTempletIDs.Count; if (countLotteryRet == 1) //单次抽奖 { cardOne.SetActive(true); if (GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.LOTTERY) { GuideLottery.Instance.NextStep(); Debug.LogWarning("*** LOTTERY *** Animation Nextstep"); } //UITexture cardSprite = cardOne.transform.FindChild("Panel/Texture").GetComponent<UITexture>(); //AtlasManager.Instance.setBodyByTempletID(cardSprite,Obj_MyselfPlayer.GetMe().lotteryTempletIDs[0]); cardOne.name = Obj_MyselfPlayer.GetMe().lotteryTempletIDs[0].ToString(); cardOne.GetComponent <CardLarge>().SetCardTemplateID(Obj_MyselfPlayer.GetMe().lotteryTempletIDs[0]); showTime = 2.0f; } else if (countLotteryRet == 10) //抽10张 { for (int i = 0; i < 10; i++) { GameObject cardObj = cardTen[i]; cardObj.SetActive(true); UISprite sprite = cardObj.transform.FindChild("Sprite").GetComponent <UISprite>(); AtlasManager.Instance.setHeadByTempletID(sprite, Obj_MyselfPlayer.GetMe().lotteryTempletIDs[i]); sprite.MakePixelPerfect(); //------------------------卡牌背景及外框-------------------------------- //2013-10-12 Jack Wen UISprite icon_bg = cardObj.transform.FindChild("BG").GetComponent <UISprite>(); UISprite icon_border = cardObj.transform.FindChild("topfram").GetComponent <UISprite>(); int icon_star = TableManager.GetCardByID(Obj_MyselfPlayer.GetMe().lotteryTempletIDs[i]).Star; icon_bg.spriteName = UserCardItem.littleCardFrameName[icon_star]; icon_border.spriteName = UserCardItem.littleCardBorderName[icon_star]; //-------------------------------------------------------------------- cardObj.name = Obj_MyselfPlayer.GetMe().lotteryTempletIDs[i].ToString(); timeCount += 0.2f; for (int subi = 0; subi < cardObj.transform.childCount; subi++) { GameObject subObj = cardObj.transform.GetChild(subi).gameObject; TweenAlpha ta = subObj.GetComponent <TweenAlpha>(); if (ta == null) { ta = subObj.AddComponent <TweenAlpha>(); } ta.Reset(); ta.method = UITweener.Method.Linear; ta.style = UITweener.Style.Once; ta.duration = 1; ta.from = 0; ta.to = 1; addNewPlayer(ta, timeCount); } } showTime = 5.0f; } else { //BoxManager.showMessage("服务器返回抽奖卡牌数有问题"); Debug.LogError("服务器返回抽奖卡牌数有问题"); } layer6_3.SetActive(true); StartCoroutine("showFinalButton"); }
// Update is called once per frame void LateUpdate() { if (MyTarget == null) { // if I dont have a target, remove me from the scene GameObject.Destroy(this.gameObject); return; } // make sure to follow the target transform.localPosition = MyTarget.transform.position; if (myTempBot == null) { Debug.LogError("HeatbarObject: Target host, is not a Bot object"); return; } curHeat = myTempBot.Temperature; if (curHeat > maxHeat) { curHeat = maxHeat; } if (curHeat <= 0) { curHeat = 0.0009f; } Vector3 heatscale = new Vector3(Slider.foreground.localScale.x, curHeat, Slider.foreground.localScale.z); //Slider.foreground.localScale = heatscale; Slider.sliderValue = myTempBot.HeatPercent; //Play the cannon animation if we attached a cannon. if (myTempBot.VisibleTemp && !botcannon) { TheometerWindowPanel.alpha = 1.0f; //Set image. Animal.spriteName = myTempBot.GetCannon().CannonTextureName; //Play animation and set bool Animal.enabled = true; //Animal.alpha = 1.0f; AnimalAnimation.Reset(); AnimalAnimation.Play(true); AnimalAlphaA.Reset(); AnimalAlphaA.Play(true); botcannon = true; ThermometerAnimation.Reset(); } if (!myTempBot.VisibleTemp) { botcannon = false; Animal.enabled = false; // no cannon attached, pulling away the thermometer // WarningAnimation.Reset(); // WarningAnimation.Play(false); WarningIcon.spriteName = NeedCannonSprite; QuestionMark.alpha = 1.0f; highTemp.alpha = 0.0f; lowTemp.alpha = 0.0f; curTemp.alpha = 0.0f; Pointer.alpha = 0.0f; ThermometerAnimation.Play(false); TheometerWindowPanel.alpha = 0.0f; // temp = false; } else { WarningIcon.alpha = 0.0f; WarningIcon.spriteName = WarningSprite; QuestionMark.alpha = 0.0f; } //Set the labels if we are shielded. if (myTempBot.IsShieldActive() || myTempBot.Warning) { //Turn on highTemp.alpha = 1.0f; lowTemp.alpha = 1.0f; curTemp.alpha = 1.0f; Pointer.alpha = 1.0f; //Update variables. curTemp.text = myTempBot.CurrentTemp.ToString(); Vector3 pos = Vector3.zero; pos.y = myTempBot.HeatPercent; //curTemp.transform.localPosition = pos; Current.localPosition = pos; ThermometerAnimation.Play(true); SetHeatLampIntensity(8); SetHeatLampRange(15); } else { highTemp.alpha = 0.0f; lowTemp.alpha = 0.0f; curTemp.alpha = 0.0f; Pointer.alpha = 0.0f; ThermometerAnimation.Play(false); SetHeatLampIntensity(1); SetHeatLampRange(10); } //Handle warning info if (!myTempBot.Warning) { //WarningAnimation.Reset(); WarningAnimation.Play(false); WarningLabel.alpha = 0.0f; temp = false; //WarningLabel.gameObject.SetActive(false); } if (!temp && myTempBot.Warning) { //WarningLabel.gameObject.SetActive(true); //WarningAnimation.Reset(); WarningAnimation.Play(true); WarningLabel.alpha = 1.0f; temp = true; } }
//void TruelyAddBattleBillboardSing() //{ // if (m_signImg != null) // { // UISprite sp = NGUITools.AddWidget<UISprite>(m_goBillboard); // sp.name = "BattleBillboardSign"; // sp.atlas = m_atlas; // sp.spriteName = m_signImg; // sp.transform.parent = m_goBillboardList.transform; // sp.MakePixelPerfect(); // sp.pivot = UIWidget.Pivot.Left; // sp.transform.localPosition = new Vector3(m_fBillboardLength, 0, 0); // sp.transform.localEulerAngles = new Vector3(0, 0, 0); // sp.transform.localScale = new Vector3(sp.transform.localScale.x * m_signScale, sp.transform.localScale.y * m_signScale, 1); // m_listSprite.Add(sp); // m_fBillboardLength += sp.cachedTransform.localScale.x; // TweenAlpha ta = sp.gameObject.AddComponent<TweenAlpha>(); // ta.from = 1; // ta.to = 0; // ta.callWhenFinished = "FadeFinished"; // ta.eventReceiver = m_goBillboard; // ta.delay = 0.2f; // TweenScale ts = sp.gameObject.AddComponent<TweenScale>(); // ts.from = new Vector3(sp.transform.localScale.x * 0.7f, sp.transform.localScale.y * 0.7f, 1); // ts.to = new Vector3(sp.transform.localScale.x, sp.transform.localScale.y, 1); // ts.duration = 0.5f; // ta.enabled = false; // ts.enabled = false; // } //} protected void AddBattleBillboadSign(string imgName, float scale = 1) { if (m_bIsLoaded) { GetBillboardSpriteList(); if (imgName != null) { if (m_spSign == null) { UISprite sp = NGUITools.AddWidget <UISprite>(m_goBillboard); sp.name = "BattleBillboardSign"; sp.atlas = m_atlas; sp.spriteName = imgName; sp.transform.parent = m_goBillboardList.transform; //sp.MakePixelPerfect(); sp.transform.localScale = new Vector3(120, 44, 1); sp.pivot = UIWidget.Pivot.Left; sp.transform.localPosition = new Vector3(m_fBillboardLength, 0, 0); sp.transform.localEulerAngles = new Vector3(0, 0, 0); sp.transform.localScale = new Vector3(sp.transform.localScale.x * scale, sp.transform.localScale.y * scale, 1); m_fBillboardLength += sp.transform.localScale.x; TweenAlpha ta = sp.gameObject.AddComponent <TweenAlpha>(); ta.from = 1; ta.to = 0; ta.callWhenFinished = "FadeFinished"; ta.eventReceiver = m_goBillboard; ta.duration = 0.3f; TweenScale ts = sp.gameObject.AddComponent <TweenScale>(); ts.from = new Vector3(sp.transform.localScale.x, sp.transform.localScale.y, 1); ts.to = new Vector3(sp.transform.localScale.x * 0.5f, sp.transform.localScale.y * 0.5f, 1); ts.duration = 0.3f; ts.enabled = false; ta.enabled = false; sp.gameObject.SetActive(true); m_spSign = sp; ReCalculateBillboardCenter(); } else { TweenAlpha ta = m_spSign.gameObject.GetComponentsInChildren <TweenAlpha>(true)[0]; ta.Reset(); ta.enabled = false; TweenScale ts = m_spSign.gameObject.GetComponentsInChildren <TweenScale>(true)[0]; ts.from = new Vector3(m_spSign.transform.localScale.x, m_spSign.transform.localScale.y, 1); ts.Reset(); ta.enabled = false; m_spSign.gameObject.SetActive(true); ReCalculateBillboardCenter(); } } else { if (m_spSign != null) { m_spSign.gameObject.SetActive(false); } } } else { m_signImg = imgName; m_signScale = scale; } }
//在创建或者复用完成后,调用该接口,显示伤害信息 public bool ActiveDamageBoard(int nType, string strValue, Vector3 pos, bool isPlayerSkill = true) { // bool isCriticalDamage = nType == (int)(Games.GlobeDefine.GameDefine_Globe.DAMAGEBOARD_TYPE.PLAYER_ATTACK_CRITICAL) || // nType == (int)(Games.GlobeDefine.GameDefine_Globe.DAMAGEBOARD_TYPE.PLAYER_ATTACK_CRITICAL_PARTNER) || // nType == (int)(Games.GlobeDefine.GameDefine_Globe.DAMAGEBOARD_TYPE.TARGET_ATTACK_CRITICAL); Tab_DamageBoardType tabDamageBoardType = DamageBoardManager.DamageBoardType[nType][0]; if (tabDamageBoardType == null) { tabDamageBoardType = DamageBoardManager.DamageBoardType[0][0]; } m_run = true; // 读取该类型的表格项 // 初始位置 初速度 加速度 //Vector3 vecOrigin = new Vector3(tabDamageBoardType.OriginX, tabDamageBoardType.OriginY, 0); Vector3 vecVelocity = new Vector3(tabDamageBoardType.VelocityX, tabDamageBoardType.VelocityY, 0); Vector3 vecAcceleration = new Vector3(tabDamageBoardType.AccelerationX, tabDamageBoardType.AccelerationY, 0); float fShowTime = tabDamageBoardType.ShowTime; // 正常显示时间 float fFadeTime = tabDamageBoardType.FadeTime; // 渐变消失时间 m_totalShowTime = fShowTime + fFadeTime; // 总运动时间 string strTextColor = tabDamageBoardType.TextColor; // 字体颜色 //string strOutlineColor = tabDamageBoardType.OutlineColor; // 描边颜色 float fTextSize = tabDamageBoardType.TextSize; // 文字大小 float fScaleDelayTime = tabDamageBoardType.ScaleDelayTime; // 尺寸变化延迟时间 float fTextSizeMax = tabDamageBoardType.TextSizeMax; // 最大尺寸 float fScalePlusTime = tabDamageBoardType.ScalePlusTime; // 放大时间 float fTextSizeOver = tabDamageBoardType.TextSizeOver; // 结束尺寸 float fScaleMinusTime = tabDamageBoardType.ScaleMinusTime; // 缩小时间 if (null == m_DamageBoardRootTransform) { m_DamageBoardRootTransform = gameObject.transform; } if (null == m_DamageBoardLabel) { m_DamageBoardLabel = gameObject.GetComponent <UILabel>(); if (null != m_DamageBoardLabel) { m_DamageBoardLabel.effectStyle = UILabel.Effect.None; m_DamageBoardLabel.color = Color.white; } } if (null == m_UAMotion) { m_UAMotion = gameObject.AddComponent <UniformAcceleratedMotion>(); } if (null == m_TweenScalePlus) { m_TweenScalePlus = gameObject.AddComponent <TweenScale>(); } if (null == m_TweenScaleMinus) { m_TweenScaleMinus = gameObject.AddComponent <TweenScale>(); } if (m_TweenAlpha == null) { m_TweenAlpha = gameObject.AddComponent <TweenAlpha>(); } // 使用旧的TweenAlpha需要Reset m_TweenAlpha.Reset(); m_TweenScalePlus.Reset(); m_TweenScaleMinus.Reset(); //LogModule.ErrorLog(fFadeTime+"_" + fShowTime); if (fFadeTime > 0) { m_TweenAlpha.from = 1; m_TweenAlpha.to = 0.001f; m_TweenAlpha.delay = fShowTime; m_TweenAlpha.duration = fFadeTime; m_TweenAlpha.Play(); } // 设置Label控件 // string strText = "[" + strTextColor + "]"; // strText += strValue; // m_DamageBoardLabel.text = strText; m_DamageBoardLabel.text = StrDictionary.GetClientDictionaryString("#{10003}", strTextColor, strValue); if (isPlayerSkill) { m_DamageBoardLabel.font = m_PlayerSkillDamageFont; } else { m_DamageBoardLabel.font = m_OtherSkillDamageFont; } //damageBoardLabel.effectColor = Utils.GetColorByString(strOutlineColor); // 匀变速运动 传入初速度 加速度 运动时间 m_UAMotion.Init(vecVelocity, vecAcceleration, m_totalShowTime); // TweenScale动画 m_TweenScalePlus.from = fTextSize * Vector3.one; m_TweenScalePlus.to = fTextSizeMax * Vector3.one; m_TweenScalePlus.delay = fScaleDelayTime; m_TweenScalePlus.duration = fScalePlusTime; m_TweenScaleMinus.from = fTextSizeMax * Vector3.one; m_TweenScaleMinus.to = fTextSizeOver * Vector3.one; m_TweenScaleMinus.delay = fScalePlusTime; m_TweenScaleMinus.duration = fScaleMinusTime; // 两个动作开始播放 m_UAMotion.Go(); if (fScaleDelayTime >= 0 && fTextSizeMax > 0 && fScalePlusTime >= 0 && fTextSizeOver > 0 && fScaleMinusTime >= 0) { m_TweenScalePlus.enabled = true; m_TweenScaleMinus.enabled = true; m_TweenScalePlus.Play(); m_TweenScaleMinus.Play(); } else { m_TweenScalePlus.enabled = false; m_TweenScaleMinus.enabled = false; } // 最后设置位置 大小 //Add by Lijia,伤害数字高度统一进行2.0的修正,如果以后发现有非2.0的情况,可以找我协商 pos.y += 2.0f; m_DamageBoardRootTransform.position = pos; m_DamageBoardRootTransform.localScale = fTextSize * Vector3.one; m_DamageBoardRootTransform.localRotation = Quaternion.LookRotation(Vector3.forward, Vector3.up); //伤害板面向当前摄像机 Vector3 vecUp = Camera.main.transform.rotation * Vector3.up; m_DamageBoardRootTransform.LookAt(m_DamageBoardRootTransform.position + Camera.main.transform.rotation * Vector3.back, vecUp); m_DamageBoardRootTransform.Rotate(Vector3.up * 180); ShowTime = Time.time; m_DamageBoardLabel.color = Color.white; return(true); }
// Update is called once per frame void Update() { points = GameObjectTracker.GetGOT().GetCurrentPoints(); //Trigger point adding animation. if (points > prevPoints) { //myLabelText = "" + points + ""; myLabelText = string.Format("{0:#,#,#}", points); myLabel.text = myLabelText; //Set the label of the point to add. //Lets set the label to the difference between prev point and current... uhh yeah. int dif = points - prevPoints; PointsAdd.text = "+ " + dif.ToString(); PointsAdd.alpha = 1.0f; PointsAddBG.alpha = 1.0f; //Trigger animation. PointsAddAnimation.Reset(); PointsAddAnimation.Play(true); prevPoints = points; } //Trigger point subtraction here. if (points < prevPoints) { //myLabelText = "" + points + ""; myLabelText = string.Format("{0:#,#,#}", points); myLabel.text = myLabelText; //Create the label as the difference between the points int dif = prevPoints - points; PointsSubtract.text = "- " + dif.ToString(); //PointsSubtract.alpha = 1.0f; //Trigger animation. PointsSubtractAnimation.Reset(); PointsSubtractAnimation.Play(true); PointsSubtractAlphaAnimation.Reset(); PointsSubtractAlphaAnimation.Play(true); prevPoints = points; } if (points == 0) { myLabel.text = "0"; prevPoints = 0; } int newGems = GameObjectTracker.instance.GetGemsCollected(); //Apply gems label here to draw it anyway. if (newGems > prevGemCount) { //Set the bank amount. float gemcount = (float)newGems; gemcount = gemcount / 100.0f; string gemFormat = string.Format("{0:C}", gemcount); Bank.text = gemFormat; //Get the multiplier to set as the adding amount int multiplier = GameObjectTracker.instance.GetMultiplier(); float addrate = (float)multiplier; addrate = addrate / 100.0f; string addFormat = string.Format("{0:C}", addrate); BankAdd.text = addFormat; //Make visible the count label BankAdd.alpha = 1.0f; //Trigger Animation BankAddAnimation.Reset(); BankAddAnimation.Play(true); prevGemCount = newGems; } if (newGems == 0) { //Draw gems at 0 here. only called when gems are 0. //Set the bank amount. float gemcount = (float)newGems; gemcount = gemcount / 100.0f; string gemFormat = string.Format("{0:C}", gemcount); Bank.text = gemFormat; prevGemCount = 0; } }
public override void OnActivate() { //Prepare the grid. if (!prepredPhaseGrid) { PreparePhaseGrid(); } if (presented) { //Toggle back on the game over window. PhasesCountWindow.ToggleWindowOn(); BG.ToggleWindowOn(); ActivityManager.Instance.ToggleHud(false); return; } //Fill up the list. int index = 0; foreach (BasePhase.PhaseData phase in GameObjectTracker.instance._PlayerData.Breathless.PhaseList) { _resultList[index].PhaseData = phase; index++; } GameOverWindow.SetWindowAlpha(1.0f); //Set the information GameOverWindow.ToggleWindowOn(); //Reset the game over window animations for bring in. GOAlpha.Reset(); GOAlpha.Play(true); GOPosition.Reset(); GOPosition.Play(true); GOBringIN.Reset(); GOBringIN.Play(true); //Set the timer to game over duration upon activate. ResetTimer(GameOverDuration); curState = state.GameOver; //Grab the games statistics. By now the game stats should be of a completed game. Statistics gameStats = GameObjectTracker.instance.RunStatistics; if (gameStats == null) { return; } //Set the score. ScoreLabel.text = string.Format("{0:#,#,#}", gameStats.Score); //Set the time. //TimeLabel.text = FormatSeconds(gameStats.TimeAmount); //Set the bonus amount BonusLabel.text = "N/A"; //Set the coins collected. //MoneyLabel.text = string.Format("{0:C}",gameStats.Money); //MoneyLabel.text = gameStats.Money.ToString(); //Set the PPS label //PPSLabel.text = gameStats.PPS.ToString() + " PPS"; PPSText = string.Format("{0:#,#,#} PPS", gameStats.PPS); ScoreText = string.Format("{0:#,#,#}", gameStats.Score); CoinsText = string.Format("{0:C}", gameStats.Money); PPSLabel.text = ScoreText; viewPPS = false; MoneyLabel.text = CoinsText; //Set the animal. //Grab player data. BaseItemCard card = GameObjectTracker.instance._PlayerData.FindCardByCannonType(gameStats.CompletionCannon); //Check if its a valid card theng grab the icon name. if (card == null || gameStats.CompletionCannon == EntityFactory.CannonTypes.NULL || gameStats.CompletionCannon == EntityFactory.CannonTypes.Empty) { Animal.spriteName = "phaseunknown"; return; } Animal.spriteName = card.DisplayInfo.IconName; }
void CollectFinish() { AlphaAni.Reset(); }