增加boss 互动

This commit is contained in:
2024-10-26 23:30:51 +08:00
parent 71b922fe6b
commit f8e241083e
8 changed files with 1278 additions and 439 deletions

View File

@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using Framework.Timer;
using Game;
using Game.Component;
using UnityEngine;
using UnityEngine.UI;
using IcecreamView;
using Unity.Mathematics;
namespace Views
{
public class BossTouchPanel : IcecreamView.IC_AbstractModule
{
[SerializeField] private Button _clickBtn;
[SerializeField] private GameObject _text;
private AnimatorStateUpdate _animatorStateUpdate;
private float _time = 0;
public override void OnOpenView (IC_ViewData parameters)
{
this._clickBtn.gameObject.SetActive (false);
this._animatorStateUpdate = RoomManager.Instance._BossSceneDirector.transform.GetComponentInChildren<AnimatorStateUpdate> ();
this._clickBtn.onClick.AddListener (OnClickTouch);
GameUpdateMgr.Instance.AddUpdater (DoUpdate);
}
private void OnClickTouch ()
{
this._time += 0.1f;
GameManager.Instance.Vibrator (VibratorScale.Small);
CameraImpulseUtils.Instance.UniformImpulseCamera (0.5f , math.clamp (this._time , 0 , 2));
}
private void DoUpdate ()
{
if (_animatorStateUpdate.state == 2)
{
if (!this._clickBtn.gameObject.activeSelf)
{
this._clickBtn.gameObject.SetActive (true);
}
this._time -= Time.deltaTime;
if (this._time <= 0 && !this._text.activeSelf)
{
this._text.SetActive (true);
}
}
else if(_animatorStateUpdate.state == 3)
{
this.ViewConnector.CloseView ();
}
else
{
if (this._clickBtn.gameObject.activeSelf)
{
this._clickBtn.gameObject.SetActive (false);
}
}
}
public override void OnCloseView ()
{
GameUpdateMgr.Instance.RemoveUpdater (DoUpdate);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cbeb8d53e4926404a9607f566551a20d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -81,11 +81,7 @@ namespace Views{
}
else
{
this.ViewConnector.CloseView ();
Destroy (MapContent.Instance.ScenePart.gameObject);
MapContent.Instance.ScenePart = null;
//播放结尾gc动画
RoomManager.Instance._BossSceneDirector.Play();
}
});
}
@@ -166,10 +162,22 @@ namespace Views{
Shake.ShakeFor (0.25f , 0.75f);
CameraImpulseUtils.Instance.UniformImpulseCamera (0.5f , 4);
GameManager.Instance.Vibrator (VibratorScale.Normal);
ToBossCG ();
return;
}
this.nextBtn.gameObject.SetActive (true);
}
private void ToBossCG ()
{
this.ViewConnector.CloseView ();
Destroy (MapContent.Instance.ScenePart.gameObject);
MapContent.Instance.ScenePart = null;
//播放结尾gc动画
RoomManager.Instance._BossSceneDirector.Play();
UIManager.Instance.OpenView (UIPanel.BossTouchPanel);
}
private async UniTask AnimOpen (UIDissolve[] effects , GameObject point)
{
var taskTracker = GameUpdateMgr.Instance.CreateTask ();

View File

@@ -22,6 +22,7 @@ namespace Views
public const string GamePanel ="GamePanel";
public const string SuccessPanel ="SuccessPanel";
public const string InitTipPanel ="InitTipPanel";
public const string BossTouchPanel ="BossTouchPanel";
//Code end
}
}