| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using DynamicShadowProjector; |
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | using DynamicShadowProjector;
|
| | | using Snxxz.UI;
|
| | | using TableConfig;
|
| | |
|
| | | public class ActorShadowCaster : MonoBehaviour
|
| | | { |
| | | [SerializeField] Projector m_Projector; |
| | | [SerializeField] DrawTargetObject m_DrawTargetObject; |
| | | [SerializeField] Transform m_Target; |
| | | |
| | | {
|
| | | [SerializeField] Projector m_Projector;
|
| | | [SerializeField] DrawTargetObject m_DrawTargetObject;
|
| | | [SerializeField] Transform m_Target;
|
| | |
|
| | | public static ActorShadowCaster Cast(Transform _followTarget, Transform _castTarget)
|
| | | {
|
| | | var shadow = ActorShadowCasterPool.Require();
|
| | |
| | | }
|
| | |
|
| | | return shadow;
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | public void Follow(Transform _target)
|
| | | {
|
| | | m_Target = _target;
|
| | |
| | | BossShowModel.Instance.bossShowCompletedEvent -= OnBossShowCompleted;
|
| | | BossShowModel.Instance.bossShowPreparedEvent += OnBeginBossShow;
|
| | | BossShowModel.Instance.bossShowCompletedEvent += OnBossShowCompleted;
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | public void Cast(Transform _target)
|
| | | {
|
| | | m_DrawTargetObject.target = _target;
|
| | | m_DrawTargetObject.followTarget = false;
|
| | | m_DrawTargetObject.SetCommandBufferDirty();
|
| | |
|
| | | var config = Config.Instance.Get<SceneShadowConfig>(StageManager.Instance.stageAssetName);
|
| | | var dataMapId = MapUtility.GetDataMapId();
|
| | | var lineId = MapUtility.GetLineId();
|
| | | var mapResourcesConfig = MapResourcesConfig.GetConfig(dataMapId, lineId);
|
| | | var config = Config.Instance.Get<SceneShadowConfig>(mapResourcesConfig.MapResources);
|
| | | if (config != null)
|
| | | {
|
| | | m_Projector.transform.localEulerAngles = config.Rotation;
|
| | | m_Projector.material.SetFloat("_Alpha", config.Intensity);
|
| | | }
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | public void Stop()
|
| | | {
|
| | | BossShowModel.Instance.bossShowPreparedEvent -= OnBeginBossShow;
|
| | | BossShowModel.Instance.bossShowCompletedEvent -= OnBossShowCompleted;
|
| | | ActorShadowCasterPool.Reycle(this);
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | private void LateUpdate()
|
| | | {
|
| | | if (m_Target == null)
|
| | |
| | | }
|
| | |
|
| | | this.transform.position = m_Target.position;
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | private void OnBeginBossShow()
|
| | | {
|
| | | if (m_Projector != null)
|
| | | {
|
| | | m_Projector.enabled = false;
|
| | | }
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | private void OnBossShowCompleted()
|
| | | {
|
| | | if (m_Projector != null)
|
| | | {
|
| | | m_Projector.enabled = true;
|
| | | }
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | public static class ActorShadowCasterPool
|
| | | {
|
| | | static GameObjectPoolManager.GameObjectPool pool;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | } |
| | | |
| | | |
| | | } |
| | | }
|
| | |
|
| | |
|
| | | }
|