123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- using System;
- using System.Collections.Generic;
- using Common.Utility.CombatEvent;
- using Core.Utility;
- using Excel2Json;
- using Fort23.Core;
- using Fort23.UTool;
- using GameLogic.Combat.CombatTool.SceneTool;
- using GameLogic.CombatScenesTool;
- using UnityEngine;
- using Random = UnityEngine.Random;
- namespace GameLogic.Combat.CombatTool
- {
- public class CombatSenceController : IDisposable
- {
- private static readonly int Ran = Shader.PropertyToID("_ran");
- private static readonly int Pos = Shader.PropertyToID("_pos");
- // public CombatSencePath currBesselPath;
- //
- // public CombatSencePath NextBesselPath;
- private float moveTime;
- private Vector3 lasetPos;
- private float maxD = 100;
- private Vector3 lasetDir;
- public float currTime;
- public Transform moveRoot;
- // private List<CombatSencePath> reclaimSence = new List<CombatSencePath>();
- // protected GameObjectPool ShengShiQiuTi;
- private float shengShiStartSize = 3;
- private float shengShiEndSize = 300;
- // private float _shengShiAddTime;
- private bool _isUpdateShengShi;
- private SceneMonoConfigBasic SceneMonoConfig;
- // private RandomAllMap RandomAllMap;
- private float shengShiRan;
- // private List
- public async CTask InitScenes(string sceneName)
- {
- if (SceneMonoConfig != null)
- {
- SceneMonoConfig.Dispose();
- GameObject.Destroy(moveRoot.gameObject);
- GameObject.Destroy(SceneMonoConfig.gameObject);
- SceneMonoConfig = null;
- }
- shengShiRan = 0;
- _isUpdateShengShi = false;
- GameObject gameObject = new GameObject("mvoeRoot");
- if (string.IsNullOrEmpty(sceneName))
- {
- sceneName= "LevelBattle03";
- }
- // string sceneName = "LevelBattle03";
- // LevelbattleConfig levelbattleConfig = ConfigComponent.Instance.Get<LevelbattleConfig>(levelBattleId);
- // if (levelbattleConfig.ID > 0)
- // {
- // //sceneName= levelbattleConfig.sceneName;
- // }
- #if UNITY_EDITOR
- TestCombatHeroConfig testCombatHeroConfig = GameObject.FindObjectOfType<TestCombatHeroConfig>();
- if (testCombatHeroConfig != null)
- {
- if (!string.IsNullOrEmpty(testCombatHeroConfig.testSenceName))
- {
- sceneName = testCombatHeroConfig.testSenceName;
- }
- }
- #endif
- moveRoot = gameObject.transform;
- CTaskAwaitBuffer cTaskAwaitBuffer = new CTaskAwaitBuffer();
- var task_a = AssetBundleLoadManager.Instance.LoadAssetAsyncTask<GameObject>(sceneName + ".prefab",
- delegate(AssetHandle assetHandle)
- {
- GameObject gameObject = assetHandle.AssetObject<GameObject>();
- SceneMonoConfig = gameObject.GetComponent<SceneMonoConfigBasic>();
- SceneMonoConfig.shengShiMaterial.SetFloat(Ran, 0.1f);
- });
- cTaskAwaitBuffer.AddTask(task_a);
- lasetDir = Vector3.forward;
- lasetPos = new Vector3(0, 20, 0);
- await cTaskAwaitBuffer.WaitAll();
- // currBesselPath = InitBesselPath(lasetPos);
- SceneMonoConfig.Init(Camera.main.transform.parent, moveRoot);
- SceneMonoConfig.UpdateScene();
- }
- private async CTask<SceneDecoration> GetSceneDecoration(SceneObjectConfig sceneObjectConfig)
- {
- GameObjectPool gameObjectPool = await sceneObjectConfig.GetNewPrefab();
- SceneDecoration sceneDecoration = CObjectPool.Instance.Fetch<SceneDecoration>();
- sceneDecoration.Init(gameObjectPool);
- GameObject g = gameObjectPool.own;
- g.SetActive(true);
- return sceneDecoration;
- }
- public void StartPayShengShi(Transform root)
- {
- shengShiRan = 1;
- SceneMonoConfig.shengShiMaterial.SetFloat(Ran, shengShiRan);
- Vector3 pos = CombatController.currActiveCombat.playerHeroEntity.dotPos - CombatController.currActiveCombat
- .CombatCameraControllder.Camera.transform.position;
- pos.z = -30;
- SceneMonoConfig.shengShiMaterial.SetVector(Pos, pos);
- _isUpdateShengShi = true;
- // _shengShiAddTime = 0;
- }
- public void Update(float t)
- {
- moveRoot.transform.position = CombatController.currActiveCombat.CombatHeroController.GetTarget(0);
- SceneMonoConfig?.UpdateScene();
-
- if (_isUpdateShengShi)
- {
- // _shengShiAddTime += t * 1f;
- shengShiRan += t * 150;
- SceneMonoConfig.shengShiMaterial.SetFloat(Ran, shengShiRan);
- // float v = Mathf.Lerp(shengShiStartSize, shengShiEndSize, _shengShiAddTime);
- // ShengShiQiuTi.own.transform.localScale = Vector3.one * v;
- if (shengShiRan >= 200)
- {
- SceneMonoConfig.shengShiMaterial.SetFloat(Ran, 0.1f);
- _isUpdateShengShi = false;
- }
- }
-
- }
- public void Dispose()
- {
- // GObjectPool.Instance.
- }
- }
- }
|