/// <summary> /// パネル移動のTweenを作成 /// </summary> /// <param name="panelOperator"></param> /// <param name="endPos"></param> /// <returns></returns> private Tween CreatePanelMoveTween(BattleMapStatusPanelOperator panelOperator, Vector2 endPos) { // パネルを取得 BattleMapStatusPanelObject panelObject = panelOperator.GetStatusPanelObject(); // 閉じるボタンを非活性 panelObject.CancelButton.SetActive(false); RectTransform rect = panelObject.GameObject.GetComponent <RectTransform>(); // アンカー変更で位置がずれるので戻す用 Vector2 old = rect.position; // アンカーを変更 rect.anchorMin = new Vector2(0.5f, 0); rect.anchorMax = new Vector2(0.5f, 0); // アンカー変更でずれた位置を戻す rect.position = old; // アンカーポジションを指定位置へだんだん移動 Tween tween = DOTween.To( () => rect.anchoredPosition, v => { rect.anchoredPosition = v; }, endPos, GetPrepareDuration()); tween.SetEase(Ease.OutQuart); return(tween); }
private Tween CreatePanelMoveTween(BattleMapStatusPanelOperator panelOperator, Vector2 endPos) { BattleMapStatusPanelObject panelObject = panelOperator.GetStatusPanelObject(); RectTransform rect = panelObject.GameObject.GetComponent <RectTransform>(); Vector2 old = rect.position; rect.anchorMin = new Vector2(0.5f, 0); rect.anchorMax = new Vector2(0.5f, 0); rect.position = old; Tween tween = DOTween.To( () => rect.anchoredPosition, v => { rect.anchoredPosition = v; }, endPos, 1.0f); tween.SetEase(Ease.OutQuart); return(tween); }
/// <summary> /// ステータスを表示する /// </summary> /// <param name="monster"></param> /// <param name="panelType"></param> private void ShowStatus( BattleMapStatusPanelOperator panelOperator, BattleMapMonster monster, BattleMapStatusPanelType panelType, BattleMapStatusPanelPositionType positionType = BattleMapStatusPanelPositionType.NORMAL) { panelOperator.ShowStatus(monster, panelType, positionType); // アイコンを削除 mapIconGenerator.UninstallSelectionMarker(); // アイコンの表示 mapIconGenerator.InstallSelectionMarker(monster); }
private void Initialize() { if (panelOperator == null) { GameObject statusGo = statusPrefabHolder.InstantiateStatusMini(); panelOperator = new BattleMapStatusPanelOperator(statusGo, actionController.CloseSelectSkill); } if (panelOperatorReserve == null) { GameObject statusGo = statusPrefabHolder.InstantiateStatusMini(); panelOperatorReserve = new BattleMapStatusPanelOperator(statusGo, actionController.CancelOpponentSelect); } }
/// <summary> /// パネルオペレーターを取得 /// </summary> /// <param name="battleResultSet"></param> /// <param name="battleResult"></param> /// <returns></returns> private BattleMapStatusPanelObject GetPanelObject(BattleResultSet battleResultSet, BattleResult battleResult) { // パネルを取得 BattleMapStatusPanelOperator panelOperator = null; if (IsLeftMonster(battleResultSet, battleResult.ToMonster)) { panelOperator = bc.statusGenerator.GetStatusPanelOperator(); } else { panelOperator = bc.statusGenerator.GetStatusPanelOperatorReserve(); } return(panelOperator.GetStatusPanelObject()); }
private void ShakePanel() { BattleMapStatusPanelOperator panelOperator = statusGenerator.GetStatusPanelOperator(); RectTransform rect = panelOperator.GetStatusPanelObject().GameObject.GetComponent <RectTransform>(); BattleMapMonster monster = holder.BattleMapMonsters.MonsterList[0]; RectTransform monsterRect = monster.GameObject.GetComponent <RectTransform>(); DOTween.Init(); DOTween.defaultAutoPlay = AutoPlay.None; Sequence baseSeq = DOTween.Sequence(); Tweener shakePanel = rect.DOShakeAnchorPos(1.0f, 10.0f); Tweener shakeMonster = monsterRect.DOShakePosition(1.0f, 0.5f); baseSeq.Append(shakePanel); baseSeq.Append(shakeMonster); baseSeq.Play(); }
private void MinusStatus() { BattleMapStatusPanelOperator panelOperator = statusGenerator.GetStatusPanelOperator(); BattleMapStatusPanelObject panelObject = panelOperator.GetStatusPanelObject(); DOTween.Init(); DOTween.defaultAutoPlay = AutoPlay.None; int hp = 40; Tween tween = DOTween.To( () => hp, (v) => { hp = v; panelObject.HpText.text = "" + v; }, 0, 1.0f); tween.SetEase(Ease.Linear); tween.Play(); }