private void Update() { switch (this._step) { case AnimStep.StepOne: this._step = AnimStep.StepTwo; break; case AnimStep.StepTwo: base.transform.GetComponent <ContentSizeFitter>().enabled = false; this._step = AnimStep.StepThree; break; case AnimStep.StepThree: base.transform.GetComponent <HorizontalLayoutGroup>().enabled = false; this._step = AnimStep.StepFour; break; case AnimStep.StepFour: { Singleton <WwiseAudioManager> .Instance.Post("UI_Upgrade_Mat_Drop", null, null, null); Animation component = base.transform.GetComponent <Animation>(); string animation = "PowerUpMaterialMove_" + this._materialList.Count; component.Play(animation, PlayMode.StopAll); this._step = AnimStep.StepNone; break; } } }
public bool AnimTick() { switch (m_animstep) { case AnimStep.StepMove: m_dx += m_animmovex; m_dy += m_animmovey; m_dz += m_animmovez; MoveForward(m_animzoom, 1); RotateUp(m_animdown); RotateRightFlat(m_animrot, 1); m_animcnt--; if (m_animcnt == 0) { m_animstep = AnimStep.StepNone; return false; } return true; case AnimStep.StepRotate: RotateRightFlat(m_animrot); m_animcnt--; if (m_animcnt == 0) { m_animstep = AnimStep.StepNone; return false; } return true; } return false; }
public bool AnimTick() { switch (m_animstep) { case AnimStep.StepMove: m_dx += m_animmovex; m_dy += m_animmovey; m_dz += m_animmovez; MoveForward(m_animzoom, 1); RotateUp(m_animdown); RotateRightFlat(m_animrot, 1); m_animcnt--; if (m_animcnt == 0) { m_animstep = AnimStep.StepNone; return(false); } return(true); case AnimStep.StepRotate: RotateRightFlat(m_animrot); m_animcnt--; if (m_animcnt == 0) { m_animstep = AnimStep.StepNone; return(false); } return(true); } return(false); }
private void AnimWait() { m_timerWait.Update(Time.deltaTime); if (m_timerWait.IsTimeOver()) { m_animStep = AnimStep.ANIM_DOWN; m_timerWait.Reset(); } }
// Use this for initialization void Start() { m_isActive = true; m_timerWait.Reset(); m_animStep = AnimStep.ANIM_UPPER; m_time = 0; m_startPosition = transform.position; transform.position = m_startPosition + new Vector3(0, m_lowPosition, 0); }
void NextAnimStep() { int nextStep = (int)m_AnimStep + 1; m_AnimStep = (AnimStep)nextStep; switch (m_AnimStep) { case AnimStep.YourTime: m_Time.Hidden = false; m_Game.SoundManager.PlaySound(SoundManager.SEInst.GameLoad); break; case AnimStep.BaseExp: m_ExpBase.Hidden = false; m_Game.SoundManager.PlaySound(SoundManager.SEInst.GameLoad); break; case AnimStep.BonusExp: m_ExpBonus.Hidden = false; m_Game.SoundManager.PlaySound(SoundManager.SEInst.GameLoad); break; case AnimStep.TotalExp: m_ExpTotal.Hidden = false; bool showVipExp = !m_Game.ExpSlowdown && m_Game.TheGameInfo.VipData.ExpBonus > 1; m_VipBonusExp.Hidden = !showVipExp; m_Game.SoundManager.PlaySound(SoundManager.SEInst.GameLoad); break; case AnimStep.LevelUp: break; case AnimStep.Finish: if (m_bLevelUnlocked) { m_Unlock.Hidden = false; } m_Buttons[0].Enabled = m_bSuccess; m_Buttons[1].Enabled = true; m_Buttons[2].Enabled = true; break; } m_AnimTimeRemaining = 0.5f; }
private void AnimUp() { Vector3 start = m_startPosition + new Vector3(0, m_lowPosition, 0); Vector3 end = m_startPosition + new Vector3(0, m_highPosition, 0); m_time += Time.deltaTime; float t = m_time / m_fUpTime; t = Mathf.Min(t, 1); transform.position = Vector3.Lerp(start, end, t); if (t >= 1) { m_animStep = AnimStep.ANIM_WAIT; m_time = 0; } }
private void AnimDown() { Vector3 start = m_startPosition + new Vector3(0, m_highPosition, 0); Vector3 end = m_startPosition + new Vector3(0, m_lowPosition, 0); m_time += Time.deltaTime; float t = m_time / m_fDownTime; t = Mathf.Min(t, 1); transform.position = Vector3.Lerp(start, end, t); if (t >= 1) { m_animStep = AnimStep.ANIM_UPPER; Destroy(gameObject); } }
public void ResetViewAnim(float x, float y, float z, float updeg, float lookz) { m_animcnt = 10; // move m_animstep = AnimStep.StepMove; m_animmovex = -m_dx / m_animcnt; m_animmovey = -m_dy / m_animcnt; m_animmovez = (lookz - m_dz) / m_animcnt; // zoom Vector3d diff = (m_eye - m_lookat); float len = Vector3d.length(diff) - Vector3d.length(new Vector3d(x, y, z)); m_animzoom = len / m_animcnt; // down len = (float)Math.Sqrt(m_eye.x * m_eye.x + m_eye.y * m_eye.y); float deg = (float)Math.Atan2(m_eye.z, len) / deg2rad; if (m_up.z < 0) { deg = 180 - deg; } if (((deg > 85) && (deg < 95)) || ((deg < -85) && (deg > -95))) { RotateUp(-deg / 10); deg -= deg / 10; } m_animdown = (updeg - deg) / m_animcnt; // rotate deg = (float)Math.Atan2(m_eye.x, -m_eye.y) / deg2rad; if (m_up.z < 0) { deg += 180; } if (deg > 360) { deg -= 360; } m_animrot = deg / m_animcnt; }
public void SetupView(List <StorageDataItemBase> materialList) { this._materialList = materialList; base.transform.GetComponent <Animation>().Stop(); this._step = AnimStep.StepNone; for (int i = 0; i < base.transform.childCount; i++) { Transform child = base.transform.GetChild(i); if (i >= this._materialList.Count) { child.gameObject.SetActive(false); continue; } StorageDataItemBase item = this._materialList[i]; int num2 = 1; switch (item.rarity) { case 1: case 2: num2 = 1; break; case 3: num2 = 2; break; case 4: case 5: num2 = 3; break; } string prefabPath = "SpriteOutput/MaterialRarityIcons/Metial" + num2.ToString(); child.Find("Image").GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(prefabPath); child.GetComponent <MonoItemIconButton>().SetupView(item, MonoItemIconButton.SelectMode.None, false, false, false); } this._step = AnimStep.StepOne; }
public void ResetViewAnim(float x, float y, float z, float updeg, float lookz) { m_animcnt = 10; // move m_animstep = AnimStep.StepMove; m_animmovex = -m_dx / m_animcnt; m_animmovey = -m_dy / m_animcnt; m_animmovez = (lookz - m_dz) / m_animcnt; // zoom Vector3d diff = (m_eye - m_lookat); float len = Vector3d.length(diff) - Vector3d.length(new Vector3d(x, y, z)); m_animzoom = len / m_animcnt; // down len = (float)Math.Sqrt(m_eye.x * m_eye.x + m_eye.y * m_eye.y); float deg = (float)Math.Atan2(m_eye.z, len) / deg2rad; if (m_up.z < 0) deg = 180 - deg; if (((deg > 85) && (deg < 95)) || ((deg < -85) && (deg > -95))) { RotateUp(-deg / 10); deg -= deg / 10; } m_animdown = (updeg - deg) / m_animcnt; // rotate deg = (float)Math.Atan2(m_eye.x, -m_eye.y) / deg2rad; if (m_up.z < 0) deg += 180; if (deg > 360) deg -= 360; m_animrot = deg / m_animcnt; }
public EndPuzzleScreen(bool success, int puzzleSize, double seconds, int screenWidth, int screenHeight, Happiness game) { m_bLevelUnlocked = false; m_bSuccess = success; m_Game = game; m_bLevelUpPlayed = false; m_iCenterX = screenWidth >> 1; int width = (int)(Constants.EndScreen_Width * screenWidth); int height = (int)(Constants.EndScreen_Height * screenHeight); int margin = (int)(Constants.EndScreen_MarginTopBottom * screenHeight); // rectangle m_Rect = new Rectangle(m_iCenterX - (width >> 1), (screenHeight >> 1) - (height >> 1), width, height); // Title int iTitleY = m_Rect.Top + margin; m_Title = new UILabel("Puzzle Complete!", m_iCenterX, iTitleY, Color.Goldenrod, Assets.DialogFont, UILabel.XMode.Center); // Success int iSuccessY = iTitleY + (int)(Constants.EndScreen_SuccessGap * screenHeight); m_Success = new UILabel(success ? "SUCCESS!" : "INCORRECT", m_iCenterX, iSuccessY, success ? Color.Green : Color.Red, Assets.MenuFont, UILabel.XMode.Center); // Buttons int buttonWidth = (int)(Constants.EndScreen_ButtonWidth * screenWidth); int buttonHeight = (int)(Constants.EndScreen_ButtonHeight * screenHeight); int buttonSpace = (int)(Constants.EndScreen_ButtonSpace * screenWidth); int buttonY = m_Rect.Bottom - (margin + buttonHeight); int halfButtonWidth = (buttonWidth >> 1); m_Buttons = new UIButton[3]; m_Buttons[0] = new UIButton(0, "Next Puzzle", Assets.HelpFont, new Rectangle(m_iCenterX + halfButtonWidth + buttonSpace, buttonY, buttonWidth, buttonHeight), Assets.ScrollBar); m_Buttons[1] = new UIButton(1, "Main Menu", Assets.HelpFont, new Rectangle(m_iCenterX - halfButtonWidth, buttonY, buttonWidth, buttonHeight), Assets.ScrollBar); m_Buttons[2] = new UIButton(2, "Restart Puzzle", Assets.HelpFont, new Rectangle(m_iCenterX - (halfButtonWidth + buttonSpace + buttonWidth), buttonY, buttonWidth, buttonHeight), Assets.ScrollBar); m_Buttons[0].Enabled = false; m_Buttons[1].Enabled = false; m_Buttons[2].Enabled = false; // Your time m_iTower = puzzleSize - 3; double parSeconds = Balance.ParTime(m_iTower); int quarterWidth = (width >> 2); int leftTimeX = m_iCenterX - quarterWidth; int rightTimeX = m_iCenterX + quarterWidth; int timeGap = (int)(Constants.EndScreen_TimeGap * screenHeight); int timeLabelY = iSuccessY + (int)(Constants.EndScreen_TimeLabelGap * screenHeight); m_TimeLabel = new UILabel("Your Time", leftTimeX, timeLabelY, Color.Goldenrod, Assets.DialogFont, UILabel.XMode.Center); m_Time = new UILabel(Happiness.TimeString(seconds), leftTimeX, timeLabelY + timeGap, (success && ((int)seconds <= parSeconds)) ? Color.Green : Color.Red, Assets.HelpFont, UILabel.XMode.Center); m_ParLabel = new UILabel("Par Time", rightTimeX, timeLabelY, Color.Goldenrod, Assets.DialogFont, UILabel.XMode.Center); m_Par = new UILabel(Happiness.TimeString(parSeconds), rightTimeX, timeLabelY + timeGap, Color.LightGray, Assets.HelpFont, UILabel.XMode.Center); m_Time.Hidden = true; // Scores float vipBonus = m_Game.ExpSlowdown ? 1.0f : m_Game.TheGameInfo.VipData.ExpBonus; double baseExp = success ? Balance.BaseExp(m_iTower) : 0; double bonusExp = success ? Balance.BonusExp(m_iTower, seconds) : 0; double totalExp = (baseExp + bonusExp) * vipBonus; m_iTotalExp = (int)totalExp; m_iExpStep = (int)((float)m_iTotalExp * 0.05f); int scoreCenterGap = (int)(Constants.EndScreen_ScoreCenterGap * screenWidth); int scoreSpace = (int)(Constants.EndScreen_ScoreSpace * screenHeight); int scoreBarWidth = (int)(Constants.EndScreen_ScoreBarWidth * screenWidth); int scoreBarHeight = (int)(Constants.EndScreen_ScoreBarHeight * screenHeight); int scoreL = m_iCenterX - scoreCenterGap; int scoreR = m_iCenterX + (scoreCenterGap * 3); int iScoreY = timeLabelY + timeGap + (int)(Constants.EndScreen_TimeScoreGap * screenHeight); m_ExpBaseLabel = new UILabel("Completion Exp:", scoreL, iScoreY, Color.Goldenrod, Assets.HelpFont, UILabel.XMode.Right); m_ExpBase = new UILabel(((int)baseExp).ToString(), scoreR, iScoreY, (baseExp > 0) ? Color.Green : Color.Gray, Assets.HelpFont, UILabel.XMode.Right); iScoreY += scoreSpace; m_ExpBonusLabel = new UILabel("Bonus Exp:", scoreL, iScoreY, Color.Goldenrod, Assets.HelpFont, UILabel.XMode.Right); m_ExpBonus = new UILabel(((int)bonusExp).ToString(), scoreR, iScoreY, (bonusExp > 0) ? Color.Green : Color.Gray, Assets.HelpFont, UILabel.XMode.Right); m_ScoreTotalBar = new Rectangle(m_iCenterX, iScoreY + scoreSpace, scoreBarWidth, scoreBarHeight); iScoreY += scoreSpace + scoreBarHeight + scoreBarHeight; m_ExpTotalLabel = new UILabel("Total Exp:", scoreL, iScoreY, Color.Goldenrod, Assets.HelpFont, UILabel.XMode.Right); m_ExpTotal = new UILabel(((int)totalExp).ToString(), scoreR, iScoreY, (totalExp > 0) ? Color.Green : Color.Gray, Assets.HelpFont, UILabel.XMode.Right); m_VipBonusExp = new UILabel(string.Format("x{0} VIP Bonus", vipBonus), scoreR + scoreSpace, iScoreY, Color.LightGreen, Assets.HelpFont, UILabel.XMode.Left); m_ExpBase.Hidden = true; m_ExpBonus.Hidden = true; m_ExpTotal.Hidden = true; m_VipBonusExp.Hidden = true; // Level up int expBarWidth = (int)(Constants.EndScreen_ExpBarWidth * screenWidth); int expBarHeight = (int)(Constants.EndScreen_ExpBarHeight * screenHeight); int expBarLeft = m_iCenterX - (expBarWidth >> 1); int levelY = iScoreY + scoreSpace + (int)(Constants.EndScreen_ScoreLevelGap * screenHeight); m_LevelLabel = new UILabel("Level: ", expBarLeft, levelY, Color.Goldenrod, Assets.HelpFont, UILabel.XMode.Left); m_Level = new UILabel(game.TheGameInfo.GameData.Level.ToString(), expBarLeft + m_LevelLabel.Width, levelY, Color.White, Assets.HelpFont, UILabel.XMode.Left); m_ExpBar = new UIProgressBar(new Rectangle(expBarLeft, levelY + m_Level.Height, expBarWidth, expBarHeight)); m_ExpBar.ProgressColor = Color.Yellow; m_iOriginalLevel = m_Game.TheGameInfo.GameData.Level; m_iOriginalExp = m_Game.TheGameInfo.GameData.Exp; SetupExpDisplay(); // Unlock int iUnlockY = m_ExpBar.Rect.Bottom + (int)(Constants.EndScreen_LevelUnlockGap * screenHeight); m_Unlock = new UILabel(string.Format("Tower {0} Unlocked!", m_iTower + 2), m_iCenterX, iUnlockY, Color.Yellow, Assets.MenuFont, UILabel.XMode.Center); m_Unlock.Hidden = true; int waitIconSize = (int)(Constants.EndScreen_WaitIconSize * game.ScreenWidth); m_WaitRect = new Rectangle((game.ScreenWidth / 2) - (waitIconSize / 2), (game.ScreenHeight / 2) - (waitIconSize / 2), waitIconSize, waitIconSize); m_AnimStep = success ? AnimStep.WaitForServerData : AnimStep.Start; m_AnimTimeRemaining = 1.0f; if (!game.Tutorial.IsPieceSetup(TutorialSystem.TutorialPiece.EndScreen1)) { int instRW = (screenWidth - 20) - (m_ScoreTotalBar.Right + 30); Rectangle instRect = new Rectangle(m_ScoreTotalBar.Right + 30, m_ExpBonus.PositionY + game.Tutorial.ArrowHeight, instRW, 0); game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.EndScreen1, new Vector2(m_ScoreTotalBar.Right + 10, m_ExpBonus.PositionY), Constants.ArrowLeft, instRect, "When you complete a puzzle you gain a set amount of experience points based on the puzzle difficulty.\n\nYou also get a bonus amount of experience points that varies depending on the amount of time it took you to finish the puzzle.", TutorialSystem.TutorialPiece.EndScreen2, Rectangle.Empty, true); game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.EndScreen2, new Vector2(m_iCenterX, m_ExpBar.Rect.Top - 5), Constants.ArrowDown, instRect, "As you gain experience, you will increase in levels.\n\nAs you increase in levels, you will unlock the larger towers for harder puzzles.", TutorialSystem.TutorialPiece.EndScreen3, Rectangle.Empty, true); instRect.Y -= 10; game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.EndScreen3, new Vector2(m_Buttons[0].Rect.Center.X, m_Buttons[0].Rect.Top - 5), Constants.ArrowDown, instRect, "Tap the Next Puzzle button to move on to the second puzzle.", TutorialSystem.TutorialPiece.Puzzle2, m_Buttons[0].Rect); game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.EndScreen4, new Vector2(m_Buttons[0].Rect.Center.X, m_Buttons[0].Rect.Top - 5), Constants.ArrowDown, instRect, "Tap the Next Puzzle button to move on to the next puzzle.", TutorialSystem.TutorialPiece.Horizontal_NextTo, m_Buttons[0].Rect); game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.EndScreen4b, new Vector2(m_Buttons[1].Rect.Center.X, m_Buttons[1].Rect.Top - 5), Constants.ArrowDown, instRect, "Pay closer attention to the tutorial text. If you dont read it, you won't understand how to solve the puzzles.", TutorialSystem.TutorialPiece.None, m_Buttons[1].Rect); } game.Tutorial.FinishPiece(TutorialSystem.TutorialPiece.Puzzle2, TutorialSystem.TutorialPiece.EndScreen4b, success); }
public void OnServerDataComplete(string info) { m_AnimStep = AnimStep.Start; m_AnimTimeRemaining = 1.0f; }