Commit 650f5e50 authored by 18류지석's avatar 18류지석

LifeStoneManager Singleton으로 개편. 씬에 LifeStoneManager를 넣어야 정상작동하니 머지할때 꼭 넣어야한다.

parent f2b91f41
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_SourcePrefab: {fileID: 0}
m_RootGameObject: {fileID: 1420923890547556}
m_IsPrefabAsset: 1
--- !u!1 &1420923890547556
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 4281661761445894}
- component: {fileID: 114772635349595938}
m_Layer: 0
m_Name: LifeStoneManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4281661761445894
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1420923890547556}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -6.9766555, y: 2.569394, z: 0.0049343775}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114772635349595938
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1420923890547556}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7fe540ec78947fc449eabc76bd87823d, type: 3}
m_Name:
m_EditorClassIdentifier:
lifeStoneLocation: {x: 7, y: 7}
standardImage: {fileID: 1001509239983906, guid: a48de94a6ab80f746aec69a02812f1e3,
type: 2}
lifeStoneRowNum: 6
lifeStoneSize: 40
sprites:
- {fileID: 21300004, guid: eff441d843b9c664e97a81fcb39d8410, type: 3}
- {fileID: 21300002, guid: eff441d843b9c664e97a81fcb39d8410, type: 3}
- {fileID: 21300000, guid: eff441d843b9c664e97a81fcb39d8410, type: 3}
frameSuper: {fileID: 0}
stoneSuper: {fileID: 0}
lifeUnitPrefab: {fileID: 1274079429510600, guid: c1fa87a24452e5745859b739e4a5254b,
type: 2}
goldPotionPrefab: {fileID: 1778675533210814, guid: 57c0f65ad47e39943a69b5b0a6fa0e47,
type: 2}
vibrationVariable: 0.1
droppedLifeStonePrefab: {fileID: 1149595688849768, guid: 8255a117a93935941b32b4aed9b299a0,
type: 2}
frameBorder: 0.2
popoutStrengthMultiplier: 9
popoutTime: 0.1
fileFormatVersion: 2
guid: 7fec52078de87f74abe791494596a804
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
......@@ -50,7 +50,6 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 224402251087470820}
- component: {fileID: 114920782405449110}
m_Layer: 5
m_Name: LifeStoneUI
m_TagString: Untagged
......@@ -69,38 +68,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2674542376dfab04bad27caaa3ffe6a1, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114920782405449110
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1939101680453256}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7fe540ec78947fc449eabc76bd87823d, type: 3}
m_Name:
m_EditorClassIdentifier:
lifeStoneLocation: {x: 7, y: 7}
standardImage: {fileID: 1001509239983906, guid: a48de94a6ab80f746aec69a02812f1e3,
type: 2}
lifeStoneRowNum: 6
lifeStoneSize: 40
sprites:
- {fileID: 21300004, guid: eff441d843b9c664e97a81fcb39d8410, type: 3}
- {fileID: 21300002, guid: eff441d843b9c664e97a81fcb39d8410, type: 3}
- {fileID: 21300000, guid: eff441d843b9c664e97a81fcb39d8410, type: 3}
frameSuper: {fileID: 1820862295034228}
stoneSuper: {fileID: 1874721051176178}
lifeUnitPrefab: {fileID: 1274079429510600, guid: c1fa87a24452e5745859b739e4a5254b,
type: 2}
goldPotionPrefab: {fileID: 1778675533210814, guid: 57c0f65ad47e39943a69b5b0a6fa0e47,
type: 2}
vibrationVariable: 0.1
droppedLifeStonePrefab: {fileID: 1149595688849768, guid: 8255a117a93935941b32b4aed9b299a0,
type: 2}
frameBorder: 0.2
popoutStrengthMultiplier: 9
popoutTime: 0.1
--- !u!224 &224255635903845628
RectTransform:
m_ObjectHideFlags: 1
......
......@@ -50,7 +50,7 @@ public class Enemy : MonoBehaviour {
{
enemyManager = EnemyManager.Instance;
inventoryManager = InventoryManager.Instance;
lifeStoneManager = GameObject.Find("UI Canvas").transform.GetChild(0).GetComponent<LifeStoneManager>();
lifeStoneManager = LifeStoneManager.Instance;
animator = GetComponent<Animator>();
}
......
......@@ -13,7 +13,7 @@ public class Player : MonoBehaviour {
void Start () {
ttx = (int)(transform.position.x / 24f);
tty = (int)(transform.position.y-0.9f / 24f);
lifeStoneManager = GameObject.Find("LifeStoneUI").GetComponent<LifeStoneManager>();
lifeStoneManager = LifeStoneManager.Instance;
}
// Update is called once per frame
......@@ -42,7 +42,7 @@ public class Player : MonoBehaviour {
}
ttx = tx;
tty = ty;
if (lifeStoneManager.CountType(LifeStoneType.Normal) + lifeStoneManager.CountType(LifeStoneType.Gold) + lifeStoneManager.CountType(LifeStoneType.Amethyst) == 0)
if (lifeStoneManager.CountType() == 0)
GameManager.gameState = GameState.GameOver;
}
}
......@@ -16,7 +16,7 @@ public class PlayerAttack : MonoBehaviour {
public AnimatorOverrideController aoc;
public AnimationClip[] normalAttack = new AnimationClip[3];
InventoryManager inventoryManager;
public LifeStoneManager lifeStoneManager;
LifeStoneManager lifeStoneManager;
float comboEndTime;
bool comboTimeOn;
......@@ -26,6 +26,7 @@ public class PlayerAttack : MonoBehaviour {
void Awake ()
{
lifeStoneManager = LifeStoneManager.Instance;
inventoryManager = InventoryManager.Instance;
playerController = GetComponent<PlayerController>();
attackProperty = GetComponentInChildren<AttackProperty>();
......
......@@ -16,7 +16,7 @@ public class Gluttony : Addon
sprite = Resources.Load<Sprite>("Sprites/Addons/parchment piece"); ;
highlight = Resources.Load<Sprite>("Sprites/Addons/parchment piece"); ;
sizeInventory = new Vector2(80, 80);
lifeStoneManager = GameObject.Find("LifeStoneUI").GetComponent<LifeStoneManager>();
lifeStoneManager = LifeStoneManager.Instance;
}
public override void OtherEffect(PlayerAttackInfo attackInfo, Enemy enemyInfo, string combo)
{
......
......@@ -18,7 +18,7 @@ public class JanusCoin : Addon
}
public override float DamageFinalAdder(PlayerAttackInfo attackInfo, Enemy enemyInfo, string combo)
{
LifeStoneManager lifeStoneManager = GameObject.Find("LifeStoneUI").GetComponent<LifeStoneManager>();
LifeStoneManager lifeStoneManager = LifeStoneManager.Instance;
if(Random.Range(0,2) == 0)
{
lifeStoneManager.DestroyStone(2);
......
......@@ -1163,7 +1163,7 @@ public class MapManager : MonoBehaviour {
for (int i = 0; i < roomBackgroundSprite5.Length; i++)
roomBackgroundSpritesDistributed[4].Add(roomBackgroundSprite5[i]);*/
tetriminoSpawner = GameObject.Find("TetriminoSpawner").GetComponent<TetriminoSpawner>();
lifeStoneManager = GameObject.Find("LifeStoneUI").GetComponent<LifeStoneManager>();
lifeStoneManager = LifeStoneManager.Instance;
currentStage = 0;
}
......
......@@ -9,7 +9,7 @@ public class ItemRoomInGame : RoomInGame {
base.RoomEnter();
Room room = transform.parent.GetComponent<Room>();
InventoryManager inventoryManager = InventoryManager.Instance;
LifeStoneManager lifeStoneManager = GameObject.Find("LifeStoneUI").GetComponent<LifeStoneManager>();
LifeStoneManager lifeStoneManager = LifeStoneManager.Instance;
int probability = Random.Range(0, 100);
Vector3 itemPosition = transform.Find("item spot").position;
switch (room.itemRoomType)
......
......@@ -52,7 +52,7 @@ public class DroppedLifeStone : MonoBehaviour, IPlayerInteraction
}
public void Apply()
{
if(GameObject.Find("LifeStoneUI").GetComponent<LifeStoneManager>().PushLifeStone(info))
if(LifeStoneManager.Instance.PushLifeStone(info))
Destroy(gameObject);
}
public void HighlightSwitch(bool enabled)
......
......@@ -8,7 +8,7 @@ public class DroppedPotion : MonoBehaviour, IPlayerInteraction {
public void Apply()
{
GameObject.Find("LifeStoneUI").GetComponent<LifeStoneManager>().ChangeFromNormal(LifeStoneType.Gold, 3);
LifeStoneManager.Instance.ChangeFromNormal(LifeStoneType.Gold, 3);
Destroy(gameObject);
}
......
......@@ -102,7 +102,7 @@ public class LifeStoneFrame : MonoBehaviour {
if (a == 0) break;
yield return null;
}
StartCoroutine(GameObject.Find("LifeStoneUI").GetComponent<LifeStoneManager>().VibrateEnumerator(30));
StartCoroutine(LifeStoneManager.Instance.VibrateEnumerator(30));
}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LifeStoneManager : MonoBehaviour {
public class LifeStoneManager : Singleton<LifeStoneManager> {
/// <summary>
/// Location of lifeStoneFrame on Canvas
/// </summary>
......
......@@ -13,7 +13,7 @@ public class LifeStoneTest : MonoBehaviour {
private void Start()
{
uii = ui.GetComponent<LifeStoneManager>();
uii = LifeStoneManager.Instance;
}
public void push()
......
......@@ -83,7 +83,7 @@ public class LifeUnitInFrame : MonoBehaviour {
transform.localPosition = new Vector2(transform.localPosition.x, zeroPos.y + pos.y * size);
if (vibration != 0)
StartCoroutine(GameObject.Find("LifeStoneUI").GetComponent<LifeStoneManager>().VibrateEnumerator(vibration));
StartCoroutine(LifeStoneManager.Instance.VibrateEnumerator(vibration));
}
}
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