Commit 443bc7d7 authored by wanqing's avatar wanqing

脚本优化

parent 80d276f5
......@@ -103,6 +103,7 @@
<Compile Include="Assets\#A2_Scripts\Manager\PassLevelChecker.cs" />
<Compile Include="Assets\#A2_Scripts\Manager\SurfacePoint.cs" />
<Compile Include="Assets\#A2_Scripts\PlayerPrefs\LocalRecord.cs" />
<Compile Include="Assets\#A2_Scripts\Pool\CacheManager.cs" />
<Compile Include="Assets\#A2_Scripts\Pool\Pool.cs" />
<Compile Include="Assets\#A2_Scripts\Pool\PoolManager.cs" />
<Compile Include="Assets\#A2_Scripts\Projector\SetProjectorToShader.cs" />
......
......@@ -290,6 +290,7 @@ GameObject:
- component: {fileID: 1872965181}
- component: {fileID: 1872965183}
- component: {fileID: 1872965182}
- component: {fileID: 1872965184}
m_Layer: 0
m_Name: GameServices
m_TagString: Untagged
......@@ -336,6 +337,22 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ff376a18ea419e546ba78667f1b5c6b3, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1872965184
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1872965180}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: edb0d13b66926534795d037f8ffc70e4, type: 3}
m_Name:
m_EditorClassIdentifier:
m_bombEffectObj: {fileID: 1700217648693119091, guid: c8e49c3b7567ba44c9434bbb6049f364,
type: 3}
m_rayfireBombObj: {fileID: 7079061562166580387, guid: 6494bd2f9be30d54ab414db21e0d1beb,
type: 3}
--- !u!114 &6598198701804661606 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6064464677632144694, guid: 919382978f5e2684ba83e6daf6491458,
......
......@@ -6,8 +6,6 @@ using RayFire;
public class BombView : MonoBehaviour
{
public GameObject m_bombParticleObj;//炸弹粒子
public GameObject m_bombEffectObj;//炸弹特效
public RayfireBomb m_rayfireBomb;//炸弹预设
private RayfireBomb m_curBomb;//当前的炸弹
private GameObject m_curBombEffect;//当前炸弹特效
......@@ -28,7 +26,7 @@ public class BombView : MonoBehaviour
//开始炸
public void StartBomb()
{
m_curBombEffect = PoolManager.Instance.GetObjectFromPool(m_bombEffectObj);
m_curBombEffect = PoolManager.Instance.GetObjectFromPool(CacheManager.Instance.bombEffectObj);
m_curBombEffect.transform.position = m_curBomb.transform.position;
m_curBomb?.Explode(0);
m_curBomb.gameObject.SetActive(false);
......@@ -72,7 +70,7 @@ public class BombView : MonoBehaviour
{
if (hit.collider.tag == "Target" && m_bCanBePlace)
{
GameObject go = PoolManager.Instance.GetObjectFromPool(m_rayfireBomb.gameObject);
GameObject go = PoolManager.Instance.GetObjectFromPool(CacheManager.Instance.rayfireBombObj);
go.transform.position = hit.point;
SetBomb(go.GetComponent<RayfireBomb>());
BattleCtrl.instance.battleUI.SetBomb();
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CacheManager : MonoBehaviour
{
[SerializeField]
private GameObject m_bombEffectObj;//炸弹特效
[SerializeField]
private GameObject m_rayfireBombObj;//炸弹预设
public GameObject bombEffectObj => m_bombEffectObj;
public GameObject rayfireBombObj => m_rayfireBombObj;
public static CacheManager Instance = null;
void Awake()
{
Instance = this;
}
}
fileFormatVersion: 2
guid: edb0d13b66926534795d037f8ffc70e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment