void Moving() { MoveTimer += Time.deltaTime * 5.0f; Vector3 pos = SwitchWindow.GetComponent <RectTransform>().anchoredPosition; pos.x = Mathf.Lerp(pos.x, TargetX, MoveTimer); SwitchWindow.GetComponent <RectTransform>().anchoredPosition = pos; if (MoveTimer <= 0.5f) { InfoArea.SetAlpha(1.0f - MoveTimer * 2.0f); EquipArea.SetAlpha(1.0f - MoveTimer * 2.0f); ReinforceArea.SetAlpha(1.0f - MoveTimer * 2.0f); } else if (MoveTimer <= 1.0f) { InfoArea.SetAlpha(MoveTimer * 2.0f - 1.0f); EquipArea.SetAlpha(MoveTimer * 2.0f - 1.0f); ReinforceArea.SetAlpha(MoveTimer * 2.0f - 1.0f); } if (MoveTimer - 0.5f <= 0.001f) { ShowInfoArea(); EquipArea.ShowEquipInfo(CurBulletType); ReinforceArea.Show(); } WeaponCellScroll.MoveToSelected(CurBulletType); if (MoveTimer >= 1.0f) { IsMoving = false; MoveTimer = 0.0f; InfoArea.SetAlpha(1.0f); EquipArea.SetAlpha(1.0f); ReinforceArea.SetAlpha(1.0f); for (int i = 0; i < 4; i++) { ArrowButtons[i].interactable = true; } InfoArea.SetWeaponName(SlotIndices[ShowBulletType]); InfoArea.ShowDetail(SlotIndices[ShowBulletType]); if (GameManager.Inst().UpgManager.BData[CurBulletType].GetEquipIndex() != -1) { int index = GameManager.Inst().UpgManager.BData[CurBulletType].GetEquipIndex(); CurEquip = GameManager.Inst().Player.GetItem(index); SetWeaponUI(); } else { for (int i = 0; i < 2; i++) { EquipImage[i].sprite = DefaultEquipImg; EquipName[i].text = ""; EquipDetail[i].text = ""; } } for (int i = 0; i < 3; i++) { if (SwitchWindows[i].transform.position.x > 6.0f) { Vector2 newPos = SwitchWindows[i].GetComponent <RectTransform>().anchoredPosition; newPos.x -= 720.0f * 3; SwitchWindows[i].GetComponent <RectTransform>().anchoredPosition = newPos; SlotIndices[i] += (Constants.MAXBULLETS - 3); if (SlotIndices[i] >= Constants.MAXBULLETS) { SlotIndices[i] -= Constants.MAXBULLETS; } SwitchWindows[i].Skin.SetCategoryAndLabel("Skin", GameManager.Inst().Player.Types[SlotIndices[i]]); if (SlotIndices[i] == GameManager.Inst().Player.GetBulletType()) { SwitchWindows[i].Anim.SetInteger("Color", GameManager.Inst().ShtManager.GetColorSelection(2) + 1); } else { SwitchWindows[i].Anim.SetInteger("Color", GameManager.Inst().ShtManager.BaseColor[SlotIndices[i]] + 1); } } if (SwitchWindows[i].transform.position.x < -6.0f) { Vector2 newPos = SwitchWindows[i].GetComponent <RectTransform>().anchoredPosition; newPos.x += 720.0f * 3; SwitchWindows[i].GetComponent <RectTransform>().anchoredPosition = newPos; SlotIndices[i] -= (Constants.MAXBULLETS - 3); if (SlotIndices[i] < 0) { SlotIndices[i] += Constants.MAXBULLETS; } SwitchWindows[i].Skin.SetCategoryAndLabel("Skin", GameManager.Inst().Player.Types[SlotIndices[i]]); if (SlotIndices[i] == GameManager.Inst().Player.GetBulletType()) { SwitchWindows[i].Anim.SetInteger("Color", GameManager.Inst().ShtManager.GetColorSelection(2) + 1); } else { SwitchWindows[i].Anim.SetInteger("Color", GameManager.Inst().ShtManager.BaseColor[SlotIndices[i]] + 1); } } } } }
void Moving() { MoveTimer += Time.deltaTime * 5.0f; Vector3 pos = SwitchWindows.GetComponent <RectTransform>().anchoredPosition; pos.x = Mathf.Lerp(pos.x, TargetX, MoveTimer); SwitchWindows.GetComponent <RectTransform>().anchoredPosition = pos; if (MoveTimer <= 0.5f) { InfoArea.SetAlpha(1.0f - MoveTimer * 2.0f); } else if (MoveTimer <= 1.0f) { InfoArea.SetAlpha(MoveTimer * 2.0f - 1.0f); } if (MoveTimer - 0.5f <= 0.001f) { ShowInfoArea(); } if (MoveTimer >= 1.0f) { IsMoving = false; MoveTimer = 0.0f; for (int i = 0; i < 2; i++) { ArrowButtons.transform.GetChild(i).GetComponent <Button>().interactable = true; } InfoArea.SetWeaponName(SlotIndices[ShowBulletType]); InfoArea.ShowDetail(SlotIndices[ShowBulletType]); for (int i = 0; i < 3; i++) { if (SwitchWindows.transform.GetChild(i).position.x > 6.0f) { Vector2 newPos = SwitchWindows.transform.GetChild(i).GetComponent <RectTransform>().anchoredPosition; newPos.x -= 720.0f * 3; SwitchWindows.transform.GetChild(i).GetComponent <RectTransform>().anchoredPosition = newPos; SlotIndices[i] += 4; if (SlotIndices[i] >= Constants.MAXBULLETS) { SlotIndices[i] -= Constants.MAXBULLETS; } Skins[i].SetCategoryAndLabel("Skin", GameManager.Inst().Player.Types[SlotIndices[i]]); InfoArea.Anim[i].SetInteger("Color", InfoArea.DefaultColor[SlotIndices[i]]); Show(SlotIndices[i], i); } if (SwitchWindows.transform.GetChild(i).position.x < -6.0f) { Vector2 newPos = SwitchWindows.transform.GetChild(i).GetComponent <RectTransform>().anchoredPosition; newPos.x += 720.0f * 3; SwitchWindows.transform.GetChild(i).GetComponent <RectTransform>().anchoredPosition = newPos; SlotIndices[i] -= 4; if (SlotIndices[i] < 0) { SlotIndices[i] += Constants.MAXBULLETS; } Skins[i].SetCategoryAndLabel("Skin", GameManager.Inst().Player.Types[SlotIndices[i]]); InfoArea.Anim[i].SetInteger("Color", InfoArea.DefaultColor[SlotIndices[i]]); Show(SlotIndices[i], i); } } } }