Commit 2a3d3363 authored by 18손재민's avatar 18손재민

이제 player 및 clock과 같이 많이 참조하는 오브젝트들은 GameManager에서 호출하면됨. 상점 완성함.

parent 5b9ffe20
...@@ -431,6 +431,8 @@ MonoBehaviour: ...@@ -431,6 +431,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
ttx: 8 ttx: 8
tty: 0 tty: 0
displayText: {fileID: 114495744039531298, guid: 457100d9937aef244b98ef4f67a0f218,
type: 2}
--- !u!212 &212187280661781960 --- !u!212 &212187280661781960
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
...@@ -464,7 +466,7 @@ SpriteRenderer: ...@@ -464,7 +466,7 @@ SpriteRenderer:
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -2078941185 m_SortingLayerID: -2078941185
m_SortingLayer: 9 m_SortingLayer: 7
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 92d166e0c2a85a14facee45f5a5a8444, type: 3} m_Sprite: {fileID: 21300000, guid: 92d166e0c2a85a14facee45f5a5a8444, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
......
...@@ -51,5 +51,11 @@ MonoBehaviour: ...@@ -51,5 +51,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 97912f0a2214a8a4f8023ed30629bb30, type: 3} m_Script: {fileID: 11500000, guid: 97912f0a2214a8a4f8023ed30629bb30, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
gameOverCanvas: {fileID: 0} isTutorial: 0
inventoryCanvas: {fileID: 0} minimap: {fileID: 0}
gameOverCanvas: {fileID: 223237664237935382, guid: 692aad2449e06054799ea4706578fb23,
type: 2}
inventoryCanvas: {fileID: 223008133952041092, guid: 7c6db9a9ca4150a438bd5114c58a37cf,
type: 2}
textCanvas: {fileID: 223566371550133596, guid: 51286afce3c9c8a4bae74feddf8b13af,
type: 2}
...@@ -268,7 +268,7 @@ Transform: ...@@ -268,7 +268,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1176163474605492} m_GameObject: {fileID: 1176163474605492}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 15, y: 7, z: 0} m_LocalPosition: {x: 13, y: 7, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 4122111573804852} m_Father: {fileID: 4122111573804852}
...@@ -300,7 +300,7 @@ Transform: ...@@ -300,7 +300,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1501914550378012} m_GameObject: {fileID: 1501914550378012}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 11, y: 7, z: 0} m_LocalPosition: {x: 9, y: 7, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 4122111573804852} m_Father: {fileID: 4122111573804852}
...@@ -313,7 +313,7 @@ Transform: ...@@ -313,7 +313,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1365357607970180} m_GameObject: {fileID: 1365357607970180}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 17, y: 7, z: 0} m_LocalPosition: {x: 15, y: 7, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 4122111573804852} m_Father: {fileID: 4122111573804852}
...@@ -326,7 +326,7 @@ Transform: ...@@ -326,7 +326,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1566149986937306} m_GameObject: {fileID: 1566149986937306}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 13, y: 7, z: 0} m_LocalPosition: {x: 11, y: 7, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 4122111573804852} m_Father: {fileID: 4122111573804852}
...@@ -352,7 +352,7 @@ Transform: ...@@ -352,7 +352,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1195436639309608} m_GameObject: {fileID: 1195436639309608}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 7, y: 7, z: 0} m_LocalPosition: {x: 5, y: 7, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 4122111573804852} m_Father: {fileID: 4122111573804852}
...@@ -391,7 +391,7 @@ Transform: ...@@ -391,7 +391,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1144240717194000} m_GameObject: {fileID: 1144240717194000}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 9, y: 7, z: 0} m_LocalPosition: {x: 7, y: 7, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 4122111573804852} m_Father: {fileID: 4122111573804852}
......
...@@ -42,7 +42,7 @@ GameObject: ...@@ -42,7 +42,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!1 &1462807162955286 --- !u!1 &1462807162955286
GameObject: GameObject:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
...@@ -420,7 +420,25 @@ CompositeCollider2D: ...@@ -420,7 +420,25 @@ CompositeCollider2D:
m_GeometryType: 0 m_GeometryType: 0
m_GenerationType: 0 m_GenerationType: 0
m_EdgeRadius: 0 m_EdgeRadius: 0
m_ColliderPaths: [] m_ColliderPaths:
- m_Collider: {fileID: 2113883504865271124}
m_ColliderPaths:
- - X: 480000000
Y: 100000000
- X: 0
Y: 100000000
- X: 0
Y: 0
- X: 480000000
Y: 0
- - X: 10000000
Y: 10000000
- X: 10000000
Y: 90000000
- X: 470000000
Y: 90000000
- X: 470000000
Y: 10000000
m_CompositePaths: m_CompositePaths:
m_Paths: m_Paths:
- - {x: 48, y: 10} - - {x: 48, y: 10}
...@@ -448,7 +466,9 @@ CompositeCollider2D: ...@@ -448,7 +466,9 @@ CompositeCollider2D:
m_GeometryType: 0 m_GeometryType: 0
m_GenerationType: 0 m_GenerationType: 0
m_EdgeRadius: 0 m_EdgeRadius: 0
m_ColliderPaths: [] m_ColliderPaths:
- m_Collider: {fileID: 2113883505577540150}
m_ColliderPaths: []
m_CompositePaths: m_CompositePaths:
m_Paths: [] m_Paths: []
m_VertexDistance: 0.0005 m_VertexDistance: 0.0005
...@@ -468,7 +488,9 @@ CompositeCollider2D: ...@@ -468,7 +488,9 @@ CompositeCollider2D:
m_GeometryType: 0 m_GeometryType: 0
m_GenerationType: 0 m_GenerationType: 0
m_EdgeRadius: 0 m_EdgeRadius: 0
m_ColliderPaths: [] m_ColliderPaths:
- m_Collider: {fileID: 2113883505987626316}
m_ColliderPaths: []
m_CompositePaths: m_CompositePaths:
m_Paths: [] m_Paths: []
m_VertexDistance: 0.0005 m_VertexDistance: 0.0005
...@@ -488,7 +510,9 @@ CompositeCollider2D: ...@@ -488,7 +510,9 @@ CompositeCollider2D:
m_GeometryType: 0 m_GeometryType: 0
m_GenerationType: 0 m_GenerationType: 0
m_EdgeRadius: 0 m_EdgeRadius: 0
m_ColliderPaths: [] m_ColliderPaths:
- m_Collider: {fileID: 2113883505389363492}
m_ColliderPaths: []
m_CompositePaths: m_CompositePaths:
m_Paths: [] m_Paths: []
m_VertexDistance: 0.0005 m_VertexDistance: 0.0005
......
%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: 1590798276927748}
m_IsPrefabAsset: 1
--- !u!1 &1590798276927748
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 224163648038064106}
- component: {fileID: 222537658428060042}
- component: {fileID: 114495744039531298}
m_Layer: 0
m_Name: DisplayText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &114495744039531298
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1590798276927748}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 1
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 100
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:
--- !u!222 &222537658428060042
CanvasRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1590798276927748}
m_CullTransparentMesh: 0
--- !u!224 &224163648038064106
RectTransform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1590798276927748}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -924, y: -528}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
fileFormatVersion: 2
guid: 457100d9937aef244b98ef4f67a0f218
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
...@@ -218,7 +218,8 @@ MonoBehaviour: ...@@ -218,7 +218,8 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 0} - m_Target: {fileID: 114561382838090706, guid: f6ef1c586e7764c41ba8349325635589,
type: 2}
m_MethodName: RestartGame m_MethodName: RestartGame
m_Mode: 1 m_Mode: 1
m_Arguments: m_Arguments:
......
...@@ -55,6 +55,5 @@ MonoBehaviour: ...@@ -55,6 +55,5 @@ MonoBehaviour:
type: 2} type: 2}
popoutStrengthMultiplier: 9 popoutStrengthMultiplier: 9
popoutTime: 0.1 popoutTime: 0.1
priceCanvas: {fileID: 1326064071694500, guid: 51286afce3c9c8a4bae74feddf8b13af, textCanvas: {fileID: 1326064071694500, guid: 51286afce3c9c8a4bae74feddf8b13af, type: 2}
type: 2}
price: {fileID: 114275555228777956, guid: 4ec53eab8ea50de4ea5b9ff658d83ca0, type: 2} price: {fileID: 114275555228777956, guid: 4ec53eab8ea50de4ea5b9ff658d83ca0, type: 2}
...@@ -23,7 +23,7 @@ GameObject: ...@@ -23,7 +23,7 @@ GameObject:
- component: {fileID: 114428697731747914} - component: {fileID: 114428697731747914}
- component: {fileID: 114817208632956030} - component: {fileID: 114817208632956030}
m_Layer: 5 m_Layer: 5
m_Name: PriceCanvas m_Name: TextCanvas
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
......
...@@ -20,13 +20,12 @@ public class CameraController : MonoBehaviour { ...@@ -20,13 +20,12 @@ public class CameraController : MonoBehaviour {
private void Awake() private void Awake()
{ {
player = GameObject.Find("Player");
} }
// Use this for initialization // Use this for initialization
void Start() void Start()
{ {
player = GameManager.Instance.player;
} }
// Update is called once per frame // Update is called once per frame
...@@ -69,7 +68,7 @@ public class CameraController : MonoBehaviour { ...@@ -69,7 +68,7 @@ public class CameraController : MonoBehaviour {
{ {
if(isSceneChanging != true) if(isSceneChanging != true)
{ {
GameObject grid = GameObject.Find("Grid"); GameObject grid = MapManager.Instance.grid.gameObject;
float sizeDestination = 0; float sizeDestination = 0;
isSceneChanging = true; isSceneChanging = true;
if (gameState == GameState.Ingame) if (gameState == GameState.Ingame)
......
 using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
public class Player : MonoBehaviour { public class Player : MonoBehaviour {
LifeStoneManager lifeStoneManager; LifeStoneManager lifeStoneManager;
...@@ -8,9 +9,24 @@ public class Player : MonoBehaviour { ...@@ -8,9 +9,24 @@ public class Player : MonoBehaviour {
public static float X = 0.7f, Y = 1.6f; public static float X = 0.7f, Y = 1.6f;
public int ttx; public int ttx;
public int tty; public int tty;
public Text displayText;
public IEnumerator DisplayText(string _text)
{
displayText.text = _text;
for (int i = 255; i >= 0; i -= 10)
{
yield return null;
displayText.transform.position = transform.position + new Vector3(0, 2, 0);
Debug.Log(i);
displayText.color = new Color(displayText.color.r, displayText.color.g, displayText.color.b, (float)i /255);
}
displayText.text = "";
}
// Use this for initialization // Use this for initialization
void Start () { void Start () {
displayText = Instantiate(displayText, GameManager.Instance.textCanvas.transform);
ttx = (int)(transform.position.x / 24f); ttx = (int)(transform.position.x / 24f);
tty = (int)(transform.position.y-0.9f / 24f); tty = (int)(transform.position.y-0.9f / 24f);
lifeStoneManager = LifeStoneManager.Instance; lifeStoneManager = LifeStoneManager.Instance;
......
...@@ -41,10 +41,13 @@ public class EnemyManager : Singleton<EnemyManager> ...@@ -41,10 +41,13 @@ public class EnemyManager : Singleton<EnemyManager>
// Awake // Awake
private void Awake() private void Awake()
{ {
Player = GameObject.Find("Player");
LoadDropTable(dropTableData); LoadDropTable(dropTableData);
CreateEnemyPool(); CreateEnemyPool();
} }
private void Start()
{
Player = GameManager.Instance.player;
}
// Spawn Enemy to Map // Spawn Enemy to Map
public void SpawnEnemyToMap() public void SpawnEnemyToMap()
......
...@@ -17,9 +17,12 @@ public class GameManager : Singleton<GameManager> { ...@@ -17,9 +17,12 @@ public class GameManager : Singleton<GameManager> {
/// </summary> /// </summary>
Vector3 spawnPosition = new Vector3(2, 1, 0); Vector3 spawnPosition = new Vector3(2, 1, 0);
public GameObject player;
public GameObject minimap; public GameObject minimap;
public Canvas gameOverCanvas; public Canvas gameOverCanvas;
public Canvas inventoryCanvas; public Canvas inventoryCanvas;
public Canvas textCanvas;
public Timer clock;
// method // method
// Constructor - protect calling raw constructor // Constructor - protect calling raw constructor
...@@ -36,8 +39,8 @@ public class GameManager : Singleton<GameManager> { ...@@ -36,8 +39,8 @@ public class GameManager : Singleton<GameManager> {
Destroy(MapManager.currentRoom.gameObject); Destroy(MapManager.currentRoom.gameObject);
minimap.SetActive(true); minimap.SetActive(true);
TetriminoSpawner.Instance.MakeInitialTetrimino(); TetriminoSpawner.Instance.MakeInitialTetrimino();
GameObject.Find("Player").transform.position = MapManager.currentRoom.roomInGame.transform.Find("portal spot").position + spawnPosition; player.transform.position = MapManager.currentRoom.roomInGame.transform.Find("portal spot").position + spawnPosition;
GameObject.Find("Main Camera").transform.position = GameObject.Find("Player").transform.position + new Vector3(0, 0, -1); Camera.main.transform.position = player.transform.position + new Vector3(0, 0, -1);
} }
/// <summary> /// <summary>
...@@ -50,17 +53,26 @@ public class GameManager : Singleton<GameManager> { ...@@ -50,17 +53,26 @@ public class GameManager : Singleton<GameManager> {
void Awake() void Awake()
{ {
inventoryCanvas = Instantiate(inventoryCanvas);
gameOverCanvas = Instantiate(gameOverCanvas);
textCanvas = Instantiate(textCanvas);
InventoryManager.Instance.ui = inventoryCanvas.GetComponent<InventoryUI>();
inventoryCanvas.gameObject.SetActive(false);
gameOverCanvas.gameObject.SetActive(false);
gameState = GameState.Ingame; gameState = GameState.Ingame;
minimap = GameObject.Find("Minimap"); minimap = GameObject.Find("Minimap");
minimap.SetActive(false); minimap.SetActive(false);
player = GameObject.Find("Player");
MapManager.currentRoom = GameObject.Find("Room Tutorial").GetComponent<Room>(); MapManager.currentRoom = GameObject.Find("Room Tutorial").GetComponent<Room>();
GameObject.Find("Player").transform.position = MapManager.currentRoom.roomInGame.transform.Find("player spot").position + spawnPosition; player.transform.position = MapManager.currentRoom.roomInGame.transform.Find("player spot").position + spawnPosition;
GameObject.Find("Main Camera").transform.position = GameObject.Find("Player").transform.position + new Vector3(0, 0, -1); Camera.main.transform.position = player.transform.position + new Vector3(0, 0, -1);
clock = GameObject.Find("Clock").GetComponent<Timer>();
isTutorial = true; isTutorial = true;
} }
// Use this for initialization // Use this for initialization
void Start () { void Start ()
{
} }
...@@ -73,11 +85,11 @@ public class GameManager : Singleton<GameManager> { ...@@ -73,11 +85,11 @@ public class GameManager : Singleton<GameManager> {
{ {
if (gameState == GameState.Ingame) if (gameState == GameState.Ingame)
{ {
StartCoroutine(GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>().ChangeScene(GameState.Tetris)); StartCoroutine(Camera.main.GetComponent<CameraController>().ChangeScene(GameState.Tetris));
} }
else if (gameState == GameState.Tetris) else if (gameState == GameState.Tetris)
{ {
StartCoroutine(GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>().ChangeScene(GameState.Ingame)); StartCoroutine(Camera.main.GetComponent<CameraController>().ChangeScene(GameState.Ingame));
} }
} }
else if(Input.GetKeyDown(KeyCode.I)) else if(Input.GetKeyDown(KeyCode.I))
...@@ -97,11 +109,11 @@ public class GameManager : Singleton<GameManager> { ...@@ -97,11 +109,11 @@ public class GameManager : Singleton<GameManager> {
{ {
if (gameState == GameState.Portal && MapManager.currentRoom != MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y]) if (gameState == GameState.Portal && MapManager.currentRoom != MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y])
{ {
GameObject.Find("Player").transform.position = MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y].portal.transform.position + spawnPosition; player.transform.position = MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y].portal.transform.position + spawnPosition;
MapManager.Instance.ChangeRoom(MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y]); MapManager.Instance.ChangeRoom(MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y]);
MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y].portalSurface.GetComponent<SpriteRenderer>().sprite = MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y].portalSurface.GetComponent<SpriteRenderer>().sprite =
MapManager.Instance.portalExist; MapManager.Instance.portalExist;
StartCoroutine(GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>().ChangeScene(GameState.Ingame)); StartCoroutine(Camera.main.GetComponent<CameraController>().ChangeScene(GameState.Ingame));
} }
} }
else if(Input.GetButtonDown("Cancel")) else if(Input.GetButtonDown("Cancel"))
...@@ -112,7 +124,7 @@ public class GameManager : Singleton<GameManager> { ...@@ -112,7 +124,7 @@ public class GameManager : Singleton<GameManager> {
MapManager.Instance.portalExist; MapManager.Instance.portalExist;
MapManager.mapGrid[(int)MapManager.currentRoom.mapCoord.x, (int)MapManager.currentRoom.mapCoord.y].portalSurface.GetComponent<SpriteRenderer>().sprite = MapManager.mapGrid[(int)MapManager.currentRoom.mapCoord.x, (int)MapManager.currentRoom.mapCoord.y].portalSurface.GetComponent<SpriteRenderer>().sprite =
MapManager.Instance.portalExist; MapManager.Instance.portalExist;
StartCoroutine(GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>().ChangeScene(GameState.Ingame)); StartCoroutine(Camera.main.GetComponent<CameraController>().ChangeScene(GameState.Ingame));
} }
else if(gameState == GameState.Inventory) else if(gameState == GameState.Inventory)
{ {
......
...@@ -14,7 +14,7 @@ public class AddonDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDra ...@@ -14,7 +14,7 @@ public class AddonDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDra
void Start() void Start()
{ {
pointerOn = false; pointerOn = false;
ui = GameObject.Find("InventoryCanvas").GetComponent<InventoryUI>(); ui = InventoryManager.Instance.ui;
manager = InventoryManager.Instance; manager = InventoryManager.Instance;
addonGroup = ui.gameObject.transform.Find("AddonGroup"); addonGroup = ui.gameObject.transform.Find("AddonGroup");
discardBin = ui.gameObject.transform.Find("DiscardBin"); discardBin = ui.gameObject.transform.Find("DiscardBin");
......
...@@ -19,7 +19,7 @@ public class FeatherofRheA : Addon ...@@ -19,7 +19,7 @@ public class FeatherofRheA : Addon
public override float DamageMultiplier(PlayerAttackInfo attackInfo, Enemy enemyInfo, string combo) public override float DamageMultiplier(PlayerAttackInfo attackInfo, Enemy enemyInfo, string combo)
{ {
if (!GameObject.Find("Player").GetComponent<PlayerController>().IsGrounded()) if (!GameManager.Instance.player.GetComponent<PlayerController>().IsGrounded())
return 1.75f; return 1.75f;
else else
return 1f; return 1f;
......
...@@ -18,7 +18,7 @@ public class Sandbag : Addon ...@@ -18,7 +18,7 @@ public class Sandbag : Addon
} }
public override void OtherEffect(string combo) public override void OtherEffect(string combo)
{ {
GameObject.Find("Player").GetComponent<PlayerAttack>().comboTime *= 0.5f; GameManager.Instance.player.GetComponent<PlayerAttack>().comboTime *= 0.5f;
} }
public override float DamageMultiplier(PlayerAttackInfo attackInfo, Enemy enemyInfo, string combo) public override float DamageMultiplier(PlayerAttackInfo attackInfo, Enemy enemyInfo, string combo)
{ {
......
...@@ -19,6 +19,6 @@ public class SmallLens : Addon ...@@ -19,6 +19,6 @@ public class SmallLens : Addon
public override void OtherEffect(string combo) public override void OtherEffect(string combo)
{ {
GameObject.Find("Player").GetComponent<PlayerAttack>().comboTime *= 1.75f; GameManager.Instance.player.GetComponent<PlayerAttack>().comboTime *= 1.75f;
} }
} }
\ No newline at end of file
...@@ -49,10 +49,7 @@ public class DroppedItem : DroppedObject, IPlayerInteraction ...@@ -49,10 +49,7 @@ public class DroppedItem : DroppedObject, IPlayerInteraction
public void Apply() public void Apply()
{ {
if(LifeStoneManager.Instance.CountType(LifeStoneType.Gold) < price) if(LifeStoneManager.Instance.CountType(LifeStoneType.Gold) < price)
{ StartCoroutine(GameManager.Instance.player.GetComponent<Player>().DisplayText("Not enough gold"));
Debug.Log("Not enough gold");
return;
}
else if (!itemAddon && inventoryManager.PushItem(item)) else if (!itemAddon && inventoryManager.PushItem(item))
{ {
LifeStoneManager.Instance.ChangeToNormal(LifeStoneType.Gold, price); LifeStoneManager.Instance.ChangeToNormal(LifeStoneType.Gold, price);
......
...@@ -3,8 +3,7 @@ using System.Collections.Generic; ...@@ -3,8 +3,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public interface IPlayerInteraction { public interface IPlayerInteraction {
void HighlightSwitch(bool enabled); void HighlightSwitch(bool enabled);
void Apply(); void Apply();
} }
...@@ -7,29 +7,23 @@ public class InventoryManager : Singleton<InventoryManager> { ...@@ -7,29 +7,23 @@ public class InventoryManager : Singleton<InventoryManager> {
public List<Item> itemList = new List<Item>(); public List<Item> itemList = new List<Item>();
public List<Addon> addonList = new List<Addon>(); public List<Addon> addonList = new List<Addon>();
InventoryUI ui; public InventoryUI ui;
public List<string>[] itemPool = new List<string>[4]; public List<string>[] itemPool = new List<string>[4];
public List<string>[] addonPool = new List<string>[4]; public List<string>[] addonPool = new List<string>[4];
public GameObject droppedPrefab; public GameObject droppedPrefab;
public float popoutStrengthMultiplier; public float popoutStrengthMultiplier;
public float popoutTime; public float popoutTime;
public GameObject priceCanvas;
public Text price; public Text price;
GameObject player; GameObject player;
private void Start() private void Start()
{ {
ui = GameObject.Find("InventoryCanvas").GetComponent<InventoryUI>(); player = GameManager.Instance.player;
GameObject.Find("InventoryCanvas").SetActive(false);
priceCanvas = Instantiate(priceCanvas);
player = GameObject.Find("Player");
SetPool(); SetPool();
/*ItemInstantiate("Dagger", player.transform.position, 0f); ItemInstantiate("Dagger", player.transform.position, 0f);
AddonInstantiate("ParchmentPiece", player.transform.position, 0f); AddonInstantiate("ParchmentPiece", player.transform.position, 0f);
AddonInstantiate("Gluttony", player.transform.position, 0f); AddonInstantiate("Gluttony", player.transform.position, 0f);
ItemInstantiate("Bow", player.transform.position, 0f);*/ ItemInstantiate("Bow", player.transform.position, 0f);
StartCoroutine(TestCoroutine()); StartCoroutine(TestCoroutine());
} }
...@@ -184,7 +178,7 @@ public class InventoryManager : Singleton<InventoryManager> { ...@@ -184,7 +178,7 @@ public class InventoryManager : Singleton<InventoryManager> {
{ {
GameObject tmpItem = ItemInstantiate(itemPool[(int)quality][0], pos, popoutStrength); GameObject tmpItem = ItemInstantiate(itemPool[(int)quality][0], pos, popoutStrength);
tmpItem.GetComponent<DroppedObject>().price = _price; tmpItem.GetComponent<DroppedObject>().price = _price;
tmpItem.GetComponent<DroppedObject>().priceTag = Instantiate(price, new Vector3(0, 0, 0), Quaternion.identity, priceCanvas.transform); tmpItem.GetComponent<DroppedObject>().priceTag = Instantiate(price, new Vector3(0, 0, 0), Quaternion.identity, GameManager.Instance.textCanvas.transform);
return tmpItem; return tmpItem;
} }
return null; return null;
...@@ -249,7 +243,7 @@ public class InventoryManager : Singleton<InventoryManager> { ...@@ -249,7 +243,7 @@ public class InventoryManager : Singleton<InventoryManager> {
{ {
GameObject tmpItem = AddonInstantiate(addonPool[(int)quality][0], pos, popoutStrength); GameObject tmpItem = AddonInstantiate(addonPool[(int)quality][0], pos, popoutStrength);
tmpItem.GetComponent<DroppedObject>().price = _price; tmpItem.GetComponent<DroppedObject>().price = _price;
tmpItem.GetComponent<DroppedObject>().priceTag = Instantiate(price, new Vector3(0, 0, 0), Quaternion.identity, priceCanvas.transform); tmpItem.GetComponent<DroppedObject>().priceTag = Instantiate(price, new Vector3(0, 0, 0), Quaternion.identity, GameManager.Instance.textCanvas.transform);
return tmpItem; return tmpItem;
} }
return null; return null;
...@@ -375,5 +369,4 @@ public class InventoryManager : Singleton<InventoryManager> { ...@@ -375,5 +369,4 @@ public class InventoryManager : Singleton<InventoryManager> {
} }
ui.SetOnPosition(itemList, addonList); ui.SetOnPosition(itemList, addonList);
} }
} }
...@@ -42,7 +42,6 @@ public class InventoryUI : MonoBehaviour { ...@@ -42,7 +42,6 @@ public class InventoryUI : MonoBehaviour {
InventoryManager inventoryManager; InventoryManager inventoryManager;
void Awake () { void Awake () {
inventoryManager = InventoryManager.Instance;
items = new GameObject[9]; items = new GameObject[9];
addons = new GameObject[9]; addons = new GameObject[9];
...@@ -82,6 +81,11 @@ public class InventoryUI : MonoBehaviour { ...@@ -82,6 +81,11 @@ public class InventoryUI : MonoBehaviour {
addonInfo.SetActive(false); addonInfo.SetActive(false);
} }
private void Start()
{
inventoryManager = InventoryManager.Instance;
}
public void SetAddonInfo() public void SetAddonInfo()
{ {
......
...@@ -11,7 +11,7 @@ public class ItemDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDrag ...@@ -11,7 +11,7 @@ public class ItemDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDrag
Transform discardBin; Transform discardBin;
void Start() void Start()
{ {
ui = GameObject.Find("InventoryCanvas").GetComponent<InventoryUI>(); ui = InventoryManager.Instance.ui;
manager = InventoryManager.Instance; manager = InventoryManager.Instance;
discardBin = ui.gameObject.transform.Find("DiscardBin"); discardBin = ui.gameObject.transform.Find("DiscardBin");
} }
......
...@@ -25,7 +25,7 @@ public class Bow : Item { ...@@ -25,7 +25,7 @@ public class Bow : Item {
itemInfo = "단순한 나무활. 군더더기 없는 깔끔한 모습이지만 금방이라도 부셔질 듯이 조잡한 것을 보니 싸구려 인듯 하다."; itemInfo = "단순한 나무활. 군더더기 없는 깔끔한 모습이지만 금방이라도 부셔질 듯이 조잡한 것을 보니 싸구려 인듯 하다.";
comboName = new string[3] { "쏘기", "위로 쏘기", "" }; comboName = new string[3] { "쏘기", "위로 쏘기", "" };
player = GameObject.Find("Player"); player = GameManager.Instance.player;
arrow = Resources.Load<GameObject>("Prefabs/Projectiles/bow_arrow"); arrow = Resources.Load<GameObject>("Prefabs/Projectiles/bow_arrow");
} }
......
...@@ -9,7 +9,7 @@ public class SkillPlay : StateMachineBehaviour { ...@@ -9,7 +9,7 @@ public class SkillPlay : StateMachineBehaviour {
public GameObject player; public GameObject player;
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
player = GameObject.Find("Player"); player = GameManager.Instance.player;
playercontroller = player.GetComponent<PlayerController>(); playercontroller = player.GetComponent<PlayerController>();
playerattack = player.GetComponent<PlayerAttack>(); playerattack = player.GetComponent<PlayerAttack>();
} }
......
...@@ -7,7 +7,6 @@ public class MapManager : Singleton<MapManager> { ...@@ -7,7 +7,6 @@ public class MapManager : Singleton<MapManager> {
/* /*
* variables * variables
* */ * */
public GameObject player;
/// <summary> /// <summary>
/// The clock indicates time of tetrimino. /// The clock indicates time of tetrimino.
/// </summary> /// </summary>
...@@ -460,7 +459,7 @@ public class MapManager : Singleton<MapManager> { ...@@ -460,7 +459,7 @@ public class MapManager : Singleton<MapManager> {
} }
} }
isRoomFalling = true; isRoomFalling = true;
Vector3 previousPlayerRelativePosition = player.transform.position - currentRoom.transform.position; Vector3 previousPlayerRelativePosition = GameManager.Instance.player.transform.position - currentRoom.transform.position;
while (tetrisYCoord[top + 1] > bottom * tetrisMapSize) while (tetrisYCoord[top + 1] > bottom * tetrisMapSize)
{ {
while (GameManager.gameState == GameState.Portal) while (GameManager.gameState == GameState.Portal)
...@@ -482,20 +481,19 @@ public class MapManager : Singleton<MapManager> { ...@@ -482,20 +481,19 @@ public class MapManager : Singleton<MapManager> {
} }
SetRoomsYCoord(); SetRoomsYCoord();
if(currentRoom.mapCoord.y >= bottom) if(currentRoom.mapCoord.y >= bottom)
player.transform.position += new Vector3(0, - yFallSpeed, 0); GameManager.Instance.player.transform.position += new Vector3(0, - yFallSpeed, 0);
previousPlayerRelativePosition = player.transform.position - currentRoom.transform.position; previousPlayerRelativePosition = GameManager.Instance.player.transform.position - currentRoom.transform.position;
} }
if (shakeCamera) if (shakeCamera)
{ {
Camera camera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>(); StartCoroutine(Camera.main.GetComponent<CameraController>().CameraShake(5 * (top - bottom + 1) / CameraController.tetrisCameraSize));
StartCoroutine(camera.GetComponent<CameraController>().CameraShake(5 * (top - bottom + 1) / CameraController.tetrisCameraSize));
} }
for (int i = 0; i < height; i++) for (int i = 0; i < height; i++)
{ {
tetrisYCoord[i] = i * tetrisMapSize; tetrisYCoord[i] = i * tetrisMapSize;
} }
DecreaseRowsAbove(top, bottom); DecreaseRowsAbove(top, bottom);
player.transform.position = currentRoom.transform.position + previousPlayerRelativePosition; GameManager.Instance.player.transform.position = currentRoom.transform.position + previousPlayerRelativePosition;
isRoomFalling = false; isRoomFalling = false;
for (int i = 0; i < width; i++) for (int i = 0; i < width; i++)
{ {
...@@ -675,7 +673,7 @@ public class MapManager : Singleton<MapManager> { ...@@ -675,7 +673,7 @@ public class MapManager : Singleton<MapManager> {
fallSpeed += gravity * fallTime * fallTime; fallSpeed += gravity * fallTime * fallTime;
te.transform.position += new Vector3(0, -fallSpeed, 0); te.transform.position += new Vector3(0, -fallSpeed, 0);
} }
StartCoroutine(GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>().CameraShake(20 / CameraController.tetrisCameraSize)); StartCoroutine(Camera.main.GetComponent<CameraController>().CameraShake(20 / CameraController.tetrisCameraSize));
EndTetrimino(te); EndTetrimino(te);
} }
/// <summary> /// <summary>
...@@ -840,7 +838,7 @@ public class MapManager : Singleton<MapManager> { ...@@ -840,7 +838,7 @@ public class MapManager : Singleton<MapManager> {
/// <returns></returns> /// <returns></returns>
public IEnumerator MakeNextTetrimino() public IEnumerator MakeNextTetrimino()
{ {
StartCoroutine(GameObject.Find("Clock").GetComponent<Timer>().ResetClock()); StartCoroutine(GameManager.Instance.clock.GetComponent<Timer>().ResetClock());
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f);
TetriminoSpawner.Instance.MakeTetrimino(); TetriminoSpawner.Instance.MakeTetrimino();
} }
...@@ -1148,14 +1146,12 @@ public class MapManager : Singleton<MapManager> { ...@@ -1148,14 +1146,12 @@ public class MapManager : Singleton<MapManager> {
for (int i = 0; i < roomBackgroundSprite5.Length; i++) for (int i = 0; i < roomBackgroundSprite5.Length; i++)
roomBackgroundSpritesDistributed[4].Add(roomBackgroundSprite5[i]);*/ roomBackgroundSpritesDistributed[4].Add(roomBackgroundSprite5[i]);*/
currentStage = 0; currentStage = 0;
player = GameObject.Find("Player");
clock = GameObject.Find("Clock").GetComponent<Timer>();
grid = GameObject.Find("Grid").transform; grid = GameObject.Find("Grid").transform;
} }
// Use this for initialization // Use this for initialization
void Start () { void Start () {
clock = GameManager.Instance.clock;
} }
// Update is called once per frame // Update is called once per frame
......
...@@ -14,7 +14,7 @@ public class Portal : MonoBehaviour, IPlayerInteraction { ...@@ -14,7 +14,7 @@ public class Portal : MonoBehaviour, IPlayerInteraction {
isPortalUsed = true; isPortalUsed = true;
} }
else if (!GameManager.Instance.isTutorial && GameManager.gameState == GameState.Ingame) else if (!GameManager.Instance.isTutorial && GameManager.gameState == GameState.Ingame)
StartCoroutine(GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>().ChangeScene(GameState.Portal)); StartCoroutine(Camera.main.GetComponent<CameraController>().ChangeScene(GameState.Portal));
} }
public void HighlightSwitch(bool enabled) public void HighlightSwitch(bool enabled)
......
...@@ -393,9 +393,9 @@ public class Room : MonoBehaviour ...@@ -393,9 +393,9 @@ public class Room : MonoBehaviour
fog.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0); fog.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0);
CreatePortal(); CreatePortal();
isRoomCleared = true; isRoomCleared = true;
MapManager.Instance.clock.clockSpeedStack -= 3; GameManager.Instance.clock.clockSpeedStack -= 3;
if (MapManager.Instance.clock.clockSpeedStack < 0) if (GameManager.Instance.clock.clockSpeedStack < 0)
MapManager.Instance.clock.clockSpeedStack = 0; GameManager.Instance.clock.clockSpeedStack = 0;
roomInGame.RoomClear(); roomInGame.RoomClear();
} }
//Need to make extra works. //Need to make extra works.
......
...@@ -49,7 +49,7 @@ public class Test : MonoBehaviour { ...@@ -49,7 +49,7 @@ public class Test : MonoBehaviour {
} }
public void Timer() public void Timer()
{ {
timer.text = (MapManager.Instance.clock.timeToFallTetrimino - MapManager.Instance.clock.tetriminoWaitedTime).ToString(); timer.text = (GameManager.Instance.clock.timeToFallTetrimino - GameManager.Instance.clock.tetriminoWaitedTime).ToString();
} }
public void ClearRoom() public void ClearRoom()
{ {
......
...@@ -70,8 +70,8 @@ public class TetriminoSpawner : Singleton<TetriminoSpawner> { ...@@ -70,8 +70,8 @@ public class TetriminoSpawner : Singleton<TetriminoSpawner> {
{ {
MapManager.Instance.UpgradeRoom(MapManager.Instance.roomsWaiting.Dequeue()); MapManager.Instance.UpgradeRoom(MapManager.Instance.roomsWaiting.Dequeue());
} }
MapManager.Instance.clock.tetriminoCreatedTime = Time.time; GameManager.Instance.clock.tetriminoCreatedTime = Time.time;
Timer.timer = StartCoroutine(GameObject.Find("Clock").GetComponent<Timer>().CountTetriminoWaitingTime()); Timer.timer = StartCoroutine(GameManager.Instance.clock.CountTetriminoWaitingTime());
} }
} }
/// <summary> /// <summary>
......
...@@ -53,10 +53,7 @@ public class DroppedLifeStone : DroppedObject, IPlayerInteraction ...@@ -53,10 +53,7 @@ public class DroppedLifeStone : DroppedObject, IPlayerInteraction
public void Apply() public void Apply()
{ {
if (LifeStoneManager.Instance.CountType(LifeStoneType.Gold) < price) if (LifeStoneManager.Instance.CountType(LifeStoneType.Gold) < price)
{ StartCoroutine(GameManager.Instance.player.GetComponent<Player>().DisplayText("Not enough gold"));
Debug.Log("Not enough gold");
return;
}
else if (LifeStoneManager.Instance.PushLifeStone(info)) else if (LifeStoneManager.Instance.PushLifeStone(info))
{ {
LifeStoneManager.Instance.ChangeToNormal(LifeStoneType.Gold, price); LifeStoneManager.Instance.ChangeToNormal(LifeStoneType.Gold, price);
......
...@@ -7,5 +7,4 @@ public class DroppedObject : MonoBehaviour ...@@ -7,5 +7,4 @@ public class DroppedObject : MonoBehaviour
{ {
public int price = 0; public int price = 0;
public Text priceTag; public Text priceTag;
} }
...@@ -9,6 +9,8 @@ public class DroppedPotion : DroppedObject, IPlayerInteraction{ ...@@ -9,6 +9,8 @@ public class DroppedPotion : DroppedObject, IPlayerInteraction{
public void Apply() public void Apply()
{ {
if (LifeStoneManager.Instance.CountType(LifeStoneType.Gold) < price)
StartCoroutine(GameManager.Instance.player.GetComponent<Player>().DisplayText("Not enough gold"));
LifeStoneManager.Instance.ChangeFromNormal(LifeStoneType.Gold, 3); LifeStoneManager.Instance.ChangeFromNormal(LifeStoneType.Gold, 3);
Destroy(gameObject); Destroy(gameObject);
} }
......
...@@ -98,7 +98,7 @@ public class LifeStoneManager : Singleton<LifeStoneManager> { ...@@ -98,7 +98,7 @@ public class LifeStoneManager : Singleton<LifeStoneManager> {
GameObject tmpPotion = Instantiate(goldPotionPrefab, pos, Quaternion.identity); GameObject tmpPotion = Instantiate(goldPotionPrefab, pos, Quaternion.identity);
PopoutGenerator(tmpPotion, popoutStrength); PopoutGenerator(tmpPotion, popoutStrength);
tmpPotion.GetComponent<DroppedObject>().price = _price; tmpPotion.GetComponent<DroppedObject>().price = _price;
tmpPotion.GetComponent<DroppedObject>().priceTag = Instantiate(InventoryManager.Instance.price, new Vector3(0, 0, 0), Quaternion.identity, InventoryManager.Instance.priceCanvas.transform); tmpPotion.GetComponent<DroppedObject>().priceTag = Instantiate(InventoryManager.Instance.price, new Vector3(0, 0, 0), Quaternion.identity, GameManager.Instance.textCanvas.transform);
return tmpPotion; return tmpPotion;
} }
...@@ -174,7 +174,7 @@ public class LifeStoneManager : Singleton<LifeStoneManager> { ...@@ -174,7 +174,7 @@ public class LifeStoneManager : Singleton<LifeStoneManager> {
tmpObj.GetComponent<DroppedLifeStone>().Init(CreateLifeStoneInfo(size, goldPer, ameNum), pos); tmpObj.GetComponent<DroppedLifeStone>().Init(CreateLifeStoneInfo(size, goldPer, ameNum), pos);
PopoutGenerator(tmpObj, popoutStrength); PopoutGenerator(tmpObj, popoutStrength);
tmpObj.GetComponent<DroppedObject>().price = _price; tmpObj.GetComponent<DroppedObject>().price = _price;
tmpObj.GetComponent<DroppedObject>().priceTag = Instantiate(InventoryManager.Instance.price, new Vector3(0, 0, 0), Quaternion.identity, InventoryManager.Instance.priceCanvas.transform); tmpObj.GetComponent<DroppedObject>().priceTag = Instantiate(InventoryManager.Instance.price, new Vector3(0, 0, 0), Quaternion.identity, GameManager.Instance.textCanvas.transform);
return tmpObj; return tmpObj;
} }
...@@ -388,7 +388,7 @@ public class LifeStoneManager : Singleton<LifeStoneManager> { ...@@ -388,7 +388,7 @@ public class LifeStoneManager : Singleton<LifeStoneManager> {
} }
InstantiateDroppedLifeStone(CreateLifeStoneInfo( InstantiateDroppedLifeStone(CreateLifeStoneInfo(
new LifeStoneInfo(new Vector2Int(pSize.x, pSize.y - cutRow), new string(newFill))), new LifeStoneInfo(new Vector2Int(pSize.x, pSize.y - cutRow), new string(newFill))),
GameObject.Find("Player").transform.position + new Vector3(droppedLifeStonePrefab.GetComponent<DroppedLifeStone>().unitSprite.GetComponent<SpriteRenderer>().bounds.size.x * i,0,0), GameManager.Instance.player.transform.position + new Vector3(droppedLifeStonePrefab.GetComponent<DroppedLifeStone>().unitSprite.GetComponent<SpriteRenderer>().bounds.size.x * i,0,0),
1f); 1f);
} }
} }
...@@ -461,7 +461,7 @@ public class LifeStoneManager : Singleton<LifeStoneManager> { ...@@ -461,7 +461,7 @@ public class LifeStoneManager : Singleton<LifeStoneManager> {
IEnumerator HitRedEffect(int damage) IEnumerator HitRedEffect(int damage)
{ {
float startTime = Time.time, endTime = startTime + 0.3f; float startTime = Time.time, endTime = startTime + 0.3f;
SpriteRenderer sprt = GameObject.Find("Player").GetComponent<SpriteRenderer>(); SpriteRenderer sprt = GameManager.Instance.player.GetComponent<SpriteRenderer>();
sprt.color = new Color(1, 0, 0); sprt.color = new Color(1, 0, 0);
while(Time.time < endTime) while(Time.time < endTime)
......
...@@ -18,7 +18,7 @@ public class LifeStoneTest : MonoBehaviour { ...@@ -18,7 +18,7 @@ public class LifeStoneTest : MonoBehaviour {
public void push() public void push()
{ {
uii.InstantiateDroppedLifeStone(Convert.ToInt32(numText.GetComponent<InputField>().text), Convert.ToSingle(goldPerText.GetComponent<InputField>().text), Convert.ToInt32(ameNumText.GetComponent<InputField>().text),GameObject.Find("Player").transform.position,1f); uii.InstantiateDroppedLifeStone(Convert.ToInt32(numText.GetComponent<InputField>().text), Convert.ToSingle(goldPerText.GetComponent<InputField>().text), Convert.ToInt32(ameNumText.GetComponent<InputField>().text),GameManager.Instance.player.transform.position,1f);
} }
public void gold() public void gold()
{ {
...@@ -42,6 +42,6 @@ public class LifeStoneTest : MonoBehaviour { ...@@ -42,6 +42,6 @@ public class LifeStoneTest : MonoBehaviour {
} }
public void goldPotion() public void goldPotion()
{ {
uii.InstantiatePotion(GameObject.Find("Player").transform.position, 1f); uii.InstantiatePotion(GameManager.Instance.player.transform.position, 1f);
} }
} }
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