Multiple fix and updates
- Fix parentscript missing from npc's - Reworked save/load data - Character data, player coins, character inventory and equipped items now properly saved and loaded
This commit is contained in:
parent
655472a16a
commit
2e12515870
@ -1101,6 +1101,7 @@ MonoBehaviour:
|
|||||||
- {fileID: 11445532}
|
- {fileID: 11445532}
|
||||||
- {fileID: 11458674}
|
- {fileID: 11458674}
|
||||||
- {fileID: 11458568}
|
- {fileID: 11458568}
|
||||||
|
onJoinedRoom: {fileID: 0}
|
||||||
OnItemRightClickedEvent:
|
OnItemRightClickedEvent:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
@ -2965,6 +2966,7 @@ MonoBehaviour:
|
|||||||
- {fileID: 11400232}
|
- {fileID: 11400232}
|
||||||
- {fileID: 11439382}
|
- {fileID: 11439382}
|
||||||
- {fileID: 11417996}
|
- {fileID: 11417996}
|
||||||
|
onJoinedRoom: {fileID: 0}
|
||||||
OnItemRightClickedEvent:
|
OnItemRightClickedEvent:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using Photon.Pun;
|
||||||
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Kryz.CharacterStats.Examples
|
namespace Kryz.CharacterStats.Examples
|
||||||
@ -8,8 +9,17 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
[SerializeField] Transform equipmentSlotsParent;
|
[SerializeField] Transform equipmentSlotsParent;
|
||||||
[SerializeField] EquipmentSlot[] equipmentSlots;
|
[SerializeField] EquipmentSlot[] equipmentSlots;
|
||||||
|
|
||||||
|
[SerializeField] GameEventListener onJoinedRoom;
|
||||||
|
|
||||||
public UnityEvent_Item OnItemRightClickedEvent = new UnityEvent_Item();
|
public UnityEvent_Item OnItemRightClickedEvent = new UnityEvent_Item();
|
||||||
|
|
||||||
|
EquipmentData equipmentData = new EquipmentData();
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
onJoinedRoom.Response.AddListener(LoadEquipment);
|
||||||
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < equipmentSlots.Length; i++)
|
for (int i = 0; i < equipmentSlots.Length; i++)
|
||||||
@ -32,6 +42,9 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
{
|
{
|
||||||
previousItem = (EquippableItem)equipmentSlots[i].Item;
|
previousItem = (EquippableItem)equipmentSlots[i].Item;
|
||||||
equipmentSlots[i].Item = item;
|
equipmentSlots[i].Item = item;
|
||||||
|
|
||||||
|
equipmentData.equippedItems[i] = ItemIndexer.Instance.Items.IndexOf(item);
|
||||||
|
PlayerDataHandler.Instance.SaveCharacterEquipmentData(PhotonNetwork.NickName, equipmentData);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,6 +59,8 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
if (equipmentSlots[i].Item == item)
|
if (equipmentSlots[i].Item == item)
|
||||||
{
|
{
|
||||||
equipmentSlots[i].Item = null;
|
equipmentSlots[i].Item = null;
|
||||||
|
equipmentData.equippedItems[i] = -1;
|
||||||
|
PlayerDataHandler.Instance.SaveCharacterEquipmentData(PhotonNetwork.NickName, equipmentData);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,5 +71,29 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
{
|
{
|
||||||
return equipmentSlots;
|
return equipmentSlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadEquipment()
|
||||||
|
{
|
||||||
|
equipmentData = PlayerDataHandler.Instance.LoadCharacterEquipmentData(PhotonNetwork.NickName);
|
||||||
|
|
||||||
|
if (equipmentData != null)
|
||||||
|
{
|
||||||
|
Debug.Log("Success Loading Equipment");
|
||||||
|
for (int i = 0; i < equipmentData.equippedItems.Length; i++)
|
||||||
|
{
|
||||||
|
if (equipmentData.equippedItems[i] < 0)
|
||||||
|
{
|
||||||
|
equipmentSlots[i].Item = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
equipmentSlots[i].Item = ItemIndexer.Instance.Items[equipmentData.equippedItems[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
equipmentData = new EquipmentData();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using Photon.Pun;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -10,19 +11,25 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
[SerializeField] Transform itemsParent;
|
[SerializeField] Transform itemsParent;
|
||||||
[SerializeField] ItemSlot[] itemSlots;
|
[SerializeField] ItemSlot[] itemSlots;
|
||||||
|
|
||||||
|
[SerializeField] GameEventListener onJoinedRoom;
|
||||||
|
|
||||||
public UnityEvent_Item OnItemRightClickedEvent = new UnityEvent_Item();
|
public UnityEvent_Item OnItemRightClickedEvent = new UnityEvent_Item();
|
||||||
|
|
||||||
|
InventoryData inventoryData = new InventoryData();
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < itemSlots.Length; i++)
|
for (int i = 0; i < itemSlots.Length; i++)
|
||||||
{
|
{
|
||||||
itemSlots[i].OnRightClickEvent.AddListener((X) => OnItemRightClickedEvent.Invoke(X));
|
itemSlots[i].OnRightClickEvent.AddListener((X) => OnItemRightClickedEvent.Invoke(X));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onJoinedRoom.Response.AddListener(LoadInventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
RefreshUI();
|
RefreshUI(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnValidate()
|
private void OnValidate()
|
||||||
@ -30,24 +37,33 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
if (itemsParent != null)
|
if (itemsParent != null)
|
||||||
{
|
{
|
||||||
itemSlots = itemsParent.GetComponentsInChildren<ItemSlot>();
|
itemSlots = itemsParent.GetComponentsInChildren<ItemSlot>();
|
||||||
RefreshUI();
|
RefreshUI(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RefreshUI()
|
private void RefreshUI(bool shouldSave)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; i < items.Count && i < itemSlots.Length; i++)
|
for (; i < items.Count && i < itemSlots.Length; i++)
|
||||||
{
|
{
|
||||||
itemSlots[i].Item = items[i];
|
itemSlots[i].Item = items[i];
|
||||||
|
|
||||||
|
inventoryData.inventoryItems[i] = ItemIndexer.Instance.Items.IndexOf(items[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < itemSlots.Length; i++)
|
for (; i < itemSlots.Length; i++)
|
||||||
{
|
{
|
||||||
itemSlots[i].Item = null;
|
itemSlots[i].Item = null;
|
||||||
|
|
||||||
|
inventoryData.inventoryItems[i] = -1;
|
||||||
}
|
}
|
||||||
|
if (!Application.isPlaying) return;
|
||||||
|
if (!PhotonNetwork.IsConnected) return;
|
||||||
|
if (!PhotonNetwork.InRoom) return;
|
||||||
|
if (!shouldSave) return;
|
||||||
|
|
||||||
|
PlayerDataHandler.Instance.SaveCharacterInventoryData(PhotonNetwork.NickName, inventoryData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddItem(Item item)
|
public bool AddItem(Item item)
|
||||||
@ -56,7 +72,8 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
RefreshUI();
|
|
||||||
|
RefreshUI(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +81,7 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
{
|
{
|
||||||
if (items.Remove(item))
|
if (items.Remove(item))
|
||||||
{
|
{
|
||||||
RefreshUI();
|
RefreshUI(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -74,5 +91,25 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
{
|
{
|
||||||
return items.Count >= itemSlots.Length;
|
return items.Count >= itemSlots.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadInventory()
|
||||||
|
{
|
||||||
|
inventoryData = PlayerDataHandler.Instance.LoadCharacterInventoryData(PhotonNetwork.NickName);
|
||||||
|
|
||||||
|
if (inventoryData != null)
|
||||||
|
{
|
||||||
|
Debug.Log("Success Loading Inventory");
|
||||||
|
for (int i = 0; i < inventoryData.inventoryItems.Length; i++)
|
||||||
|
{
|
||||||
|
if (inventoryData.inventoryItems[i] < 0) continue;
|
||||||
|
|
||||||
|
items.Add(ItemIndexer.Instance.Items[inventoryData.inventoryItems[i]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshUI(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
inventoryData = new InventoryData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
public int AvailablePointsToAllocate;
|
public int AvailablePointsToAllocate;
|
||||||
|
|
||||||
CharacterData characterData = new CharacterData();
|
CharacterData characterData = new CharacterData();
|
||||||
string characterDataKey;
|
|
||||||
|
|
||||||
List<CharacterStat> statsCollection = new List<CharacterStat>();
|
List<CharacterStat> statsCollection = new List<CharacterStat>();
|
||||||
|
|
||||||
@ -41,8 +40,6 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
health = player.GetComponent<Health>();
|
health = player.GetComponent<Health>();
|
||||||
mana = player.GetComponent<Mana>();
|
mana = player.GetComponent<Mana>();
|
||||||
|
|
||||||
characterDataKey = GameConstants.PlayerPrefsKeys.GetCharacterDataKey(photonView.Owner.NickName);
|
|
||||||
|
|
||||||
level = new Level();
|
level = new Level();
|
||||||
|
|
||||||
base.Awake();
|
base.Awake();
|
||||||
@ -55,9 +52,11 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
|
|
||||||
if (!photonView.IsMine) return;
|
if (!photonView.IsMine) return;
|
||||||
|
|
||||||
if (GameStatePersistenceManager.Instance.HasDataForKey(characterDataKey))
|
characterData = PlayerDataHandler.Instance.LoadCharacterData(photonView.Owner.NickName);
|
||||||
|
|
||||||
|
if (characterData != null)
|
||||||
{
|
{
|
||||||
characterData = GameStatePersistenceManager.Instance.LoadData<CharacterData>(characterDataKey);
|
Debug.Log("Success Loading CharacterData");
|
||||||
level = new Level(characterData.currentLevel, characterData.currentExperience);
|
level = new Level(characterData.currentLevel, characterData.currentExperience);
|
||||||
|
|
||||||
for (int i = 0; i < statsDictionary.Keys.Count; i++)
|
for (int i = 0; i < statsDictionary.Keys.Count; i++)
|
||||||
@ -71,6 +70,8 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
characterData = new CharacterData();
|
||||||
|
|
||||||
for (int i = 0; i < statsDictionary.Keys.Count; i++)
|
for (int i = 0; i < statsDictionary.Keys.Count; i++)
|
||||||
{
|
{
|
||||||
AllocatedStatPoints.Add(0);
|
AllocatedStatPoints.Add(0);
|
||||||
@ -122,7 +123,7 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
characterData.currentLevel = level.currentLevel;
|
characterData.currentLevel = level.currentLevel;
|
||||||
characterData.currentExperience = level.GetCurrentExperience();
|
characterData.currentExperience = level.GetCurrentExperience();
|
||||||
|
|
||||||
GameStatePersistenceManager.Instance.SaveData(characterDataKey, characterData);
|
PlayerDataHandler.Instance.SaveCharacterData(photonView.Owner.NickName, characterData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLevelUp()
|
private void OnLevelUp()
|
||||||
@ -231,7 +232,7 @@ namespace Kryz.CharacterStats.Examples
|
|||||||
characterData.allocatedStatPoints[i] = AllocatedStatPoints[i];
|
characterData.allocatedStatPoints[i] = AllocatedStatPoints[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
GameStatePersistenceManager.Instance.SaveData(characterDataKey, characterData);
|
PlayerDataHandler.Instance.SaveCharacterData(photonView.Owner.NickName, characterData);
|
||||||
|
|
||||||
onUpdateStatValues.Invoke();
|
onUpdateStatValues.Invoke();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,49 @@
|
|||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &12404647734564934
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 783112258715650873}
|
||||||
|
- component: {fileID: 6779425038366157320}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerDataHandler
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &783112258715650873
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 12404647734564934}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 7475116342638198534}
|
||||||
|
m_RootOrder: 6
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &6779425038366157320
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 12404647734564934}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 40822b285732f4c4faa78e10ed5932da, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &185707331849063518
|
--- !u!1 &185707331849063518
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -222,7 +266,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 16
|
m_RootOrder: 18
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &8592470823058126151
|
--- !u!114 &8592470823058126151
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -294,6 +338,111 @@ MonoBehaviour:
|
|||||||
Response:
|
Response:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
|
--- !u!1 &5884373015434708458
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 7624448236951792051}
|
||||||
|
- component: {fileID: 2347411357801055816}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: ItemIndexer
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &7624448236951792051
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5884373015434708458}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 7475116342638198534}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &2347411357801055816
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5884373015434708458}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 89530648eb9e4314681d49de96e7f026, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
Items:
|
||||||
|
- {fileID: 11400000, guid: 7520aac8c5a8a1f469cf449dc9678082, type: 2}
|
||||||
|
- {fileID: 11400000, guid: 90bdc04dc3054564b9a95d8bcf359c1c, type: 2}
|
||||||
|
- {fileID: 11400000, guid: d3bc94c8b0e3cbc439f28e38648f9938, type: 2}
|
||||||
|
- {fileID: 11400000, guid: d27871978f2b7524fac2c4f75d09a277, type: 2}
|
||||||
|
- {fileID: 11400000, guid: 426542c729b777f4b9080801a5feda74, type: 2}
|
||||||
|
- {fileID: 11400000, guid: 205970e709df4294991e3cb066bb9d88, type: 2}
|
||||||
|
- {fileID: 11400000, guid: 26b042abfe9104448a1e9599be66e71a, type: 2}
|
||||||
|
- {fileID: 11400000, guid: e08687c26614d154cb5a9a01f4b97635, type: 2}
|
||||||
|
- {fileID: 11400000, guid: bf5ebc199ded3fa48872c4a1caeba0b2, type: 2}
|
||||||
|
- {fileID: 11400000, guid: 753401cb84e3c5c4ebaef324c0399eb0, type: 2}
|
||||||
|
- {fileID: 11400000, guid: 60a432442ce35934eb0a7170f0a113f0, type: 2}
|
||||||
|
- {fileID: 11400000, guid: e2c921ce12afad24f8780b0b7555cb0b, type: 2}
|
||||||
|
--- !u!1 &6738436602598553486
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 6496815317155126854}
|
||||||
|
- component: {fileID: 741966922129695396}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: OnJoinedRoom
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &6496815317155126854
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6738436602598553486}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 7475116342346686368}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &741966922129695396
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6738436602598553486}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: b18d3d5defd7c6845a22a1583a92bfb1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
Event: {fileID: 11400000, guid: f1a37dbd6b4904a4f9d9834d72d99370, type: 2}
|
||||||
|
Response:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
--- !u!1 &7475116340738615313
|
--- !u!1 &7475116340738615313
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -373,7 +522,7 @@ Transform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 7475116341325843503}
|
- {fileID: 7475116341325843503}
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 6
|
m_RootOrder: 8
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &7475116340768526743
|
--- !u!114 &7475116340768526743
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -475,7 +624,7 @@ Transform:
|
|||||||
- {fileID: 7475116340738615312}
|
- {fileID: 7475116340738615312}
|
||||||
- {fileID: 7475116342495084315}
|
- {fileID: 7475116342495084315}
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 3
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &7475116340900335230
|
--- !u!114 &7475116340900335230
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -675,7 +824,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &7475116341184709869
|
--- !u!114 &7475116341184709869
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -737,7 +886,7 @@ Transform:
|
|||||||
- {fileID: 168785440769009768}
|
- {fileID: 168785440769009768}
|
||||||
- {fileID: 2023319060290845352}
|
- {fileID: 2023319060290845352}
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 14
|
m_RootOrder: 16
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &7475116341218466084
|
--- !u!1 &7475116341218466084
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -769,7 +918,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 4
|
m_RootOrder: 5
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &7475116341218466091
|
--- !u!114 &7475116341218466091
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -813,7 +962,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 13
|
m_RootOrder: 15
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &7475116341269730137
|
--- !u!114 &7475116341269730137
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -1165,7 +1314,7 @@ Transform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 7475116341368155189}
|
- {fileID: 7475116341368155189}
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 12
|
m_RootOrder: 14
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &7475116342078506345
|
--- !u!114 &7475116342078506345
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -1502,9 +1651,10 @@ Transform:
|
|||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children:
|
||||||
|
- {fileID: 6496815317155126854}
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 8
|
m_RootOrder: 10
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &7475116342346686373
|
--- !u!114 &7475116342346686373
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -1526,6 +1676,7 @@ MonoBehaviour:
|
|||||||
- {fileID: 7475116342276826859}
|
- {fileID: 7475116342276826859}
|
||||||
- {fileID: 7475116342277038037}
|
- {fileID: 7475116342277038037}
|
||||||
- {fileID: 7475116342277008207}
|
- {fileID: 7475116342277008207}
|
||||||
|
onJoinedRoom: {fileID: 741966922129695396}
|
||||||
OnItemRightClickedEvent:
|
OnItemRightClickedEvent:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
@ -1597,6 +1748,7 @@ MonoBehaviour:
|
|||||||
- {fileID: 7475116342277044191}
|
- {fileID: 7475116342277044191}
|
||||||
- {fileID: 7475116342277016241}
|
- {fileID: 7475116342277016241}
|
||||||
- {fileID: 7475116342277016267}
|
- {fileID: 7475116342277016267}
|
||||||
|
onJoinedRoom: {fileID: 741966922129695396}
|
||||||
OnItemRightClickedEvent:
|
OnItemRightClickedEvent:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
@ -1958,7 +2110,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 10
|
m_RootOrder: 12
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &7475116342606929481
|
--- !u!114 &7475116342606929481
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -2037,10 +2189,12 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 7475116341162077651}
|
- {fileID: 7475116341162077651}
|
||||||
|
- {fileID: 7624448236951792051}
|
||||||
- {fileID: 7475116341184709870}
|
- {fileID: 7475116341184709870}
|
||||||
- {fileID: 7475116340900335231}
|
- {fileID: 7475116340900335231}
|
||||||
- {fileID: 7475116342680308986}
|
- {fileID: 7475116342680308986}
|
||||||
- {fileID: 7475116341218466090}
|
- {fileID: 7475116341218466090}
|
||||||
|
- {fileID: 783112258715650873}
|
||||||
- {fileID: 7475116342785696725}
|
- {fileID: 7475116342785696725}
|
||||||
- {fileID: 7475116340768526742}
|
- {fileID: 7475116340768526742}
|
||||||
- {fileID: 7475116342844710275}
|
- {fileID: 7475116342844710275}
|
||||||
@ -2154,7 +2308,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 3
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &7475116342680308985
|
--- !u!114 &7475116342680308985
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -2207,7 +2361,7 @@ Transform:
|
|||||||
- {fileID: 7475116342145954546}
|
- {fileID: 7475116342145954546}
|
||||||
- {fileID: 7475116342871483252}
|
- {fileID: 7475116342871483252}
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 5
|
m_RootOrder: 7
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &7475116342785696726
|
--- !u!114 &7475116342785696726
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -2228,6 +2382,7 @@ MonoBehaviour:
|
|||||||
onPlayerVoted: {fileID: 11400000, guid: 60ad71c35f341824ba50d350a4dbc039, type: 2}
|
onPlayerVoted: {fileID: 11400000, guid: 60ad71c35f341824ba50d350a4dbc039, type: 2}
|
||||||
onPlayerVoteCanceled: {fileID: 11400000, guid: d78f3b47e5f2863419b4dad25bd8b5c2, type: 2}
|
onPlayerVoteCanceled: {fileID: 11400000, guid: d78f3b47e5f2863419b4dad25bd8b5c2, type: 2}
|
||||||
onLoadLevelStarting: {fileID: 11400000, guid: c86d4c85a149f9648adda7cdcbdefbd9, type: 2}
|
onLoadLevelStarting: {fileID: 11400000, guid: c86d4c85a149f9648adda7cdcbdefbd9, type: 2}
|
||||||
|
onJoinedRoom: {fileID: 11400000, guid: f1a37dbd6b4904a4f9d9834d72d99370, type: 2}
|
||||||
onGameSceneLoaded: {fileID: 1384308382823606702}
|
onGameSceneLoaded: {fileID: 1384308382823606702}
|
||||||
onPlayerSpawned: {fileID: 7475116342871483259}
|
onPlayerSpawned: {fileID: 7475116342871483259}
|
||||||
changeLevelVoteText: {fileID: 5087666242074858168}
|
changeLevelVoteText: {fileID: 5087666242074858168}
|
||||||
@ -2338,7 +2493,7 @@ Transform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 7475116342491251794}
|
- {fileID: 7475116342491251794}
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 11
|
m_RootOrder: 13
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &7475116342821100537
|
--- !u!114 &7475116342821100537
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -2354,6 +2509,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
coinText: {fileID: 7475116342562358806}
|
coinText: {fileID: 7475116342562358806}
|
||||||
onCoinDrop: {fileID: 7475116342491251793}
|
onCoinDrop: {fileID: 7475116342491251793}
|
||||||
|
onJoinedRoom: {fileID: 741966922129695396}
|
||||||
currentCoin: 0
|
currentCoin: 0
|
||||||
--- !u!1 &7475116342844710300
|
--- !u!1 &7475116342844710300
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -2390,7 +2546,7 @@ Transform:
|
|||||||
- {fileID: 2373817044568623682}
|
- {fileID: 2373817044568623682}
|
||||||
- {fileID: 3217804259877291692}
|
- {fileID: 3217804259877291692}
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 7
|
m_RootOrder: 9
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &7475116342844710274
|
--- !u!114 &7475116342844710274
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -2547,7 +2703,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 9
|
m_RootOrder: 11
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &7475116342873915129
|
--- !u!114 &7475116342873915129
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -2599,7 +2755,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 7475116342638198534}
|
m_Father: {fileID: 7475116342638198534}
|
||||||
m_RootOrder: 15
|
m_RootOrder: 17
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &6750135566758250123
|
--- !u!114 &6750135566758250123
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
|
@ -271,6 +271,7 @@ GameObject:
|
|||||||
- component: {fileID: 480484079}
|
- component: {fileID: 480484079}
|
||||||
- component: {fileID: 4251418928517888926}
|
- component: {fileID: 4251418928517888926}
|
||||||
- component: {fileID: 2777423608586637068}
|
- component: {fileID: 2777423608586637068}
|
||||||
|
- component: {fileID: 7237991582445384820}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: AngrySkellyPrefab
|
m_Name: AngrySkellyPrefab
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -523,6 +524,18 @@ CapsuleCollider:
|
|||||||
m_Height: 2
|
m_Height: 2
|
||||||
m_Direction: 1
|
m_Direction: 1
|
||||||
m_Center: {x: 0, y: 0.7, z: 0}
|
m_Center: {x: 0, y: 0.7, z: 0}
|
||||||
|
--- !u!114 &7237991582445384820
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1857032755411982495}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 15740b3357d70f34d8e5e53ca9c27cb0, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &2882927273311943532
|
--- !u!1 &2882927273311943532
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -357,6 +357,7 @@ GameObject:
|
|||||||
- component: {fileID: 419546842284062756}
|
- component: {fileID: 419546842284062756}
|
||||||
- component: {fileID: 4526844801487198549}
|
- component: {fileID: 4526844801487198549}
|
||||||
- component: {fileID: 2547317405899484615}
|
- component: {fileID: 2547317405899484615}
|
||||||
|
- component: {fileID: 7642269519336869515}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: SkellyMagePrefab
|
m_Name: SkellyMagePrefab
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -609,6 +610,18 @@ CapsuleCollider:
|
|||||||
m_Height: 2
|
m_Height: 2
|
||||||
m_Direction: 1
|
m_Direction: 1
|
||||||
m_Center: {x: 0, y: 0.7, z: 0}
|
m_Center: {x: 0, y: 0.7, z: 0}
|
||||||
|
--- !u!114 &7642269519336869515
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2024094060611992148}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 15740b3357d70f34d8e5e53ca9c27cb0, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &2129182132073812335
|
--- !u!1 &2129182132073812335
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
14
Assets/Scriptables/Events/Party/OnJoinedRoom.asset
Normal file
14
Assets/Scriptables/Events/Party/OnJoinedRoom.asset
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 83fe5321976e21d4b96c6d7182a5b8e2, type: 3}
|
||||||
|
m_Name: OnJoinedRoom
|
||||||
|
m_EditorClassIdentifier:
|
8
Assets/Scriptables/Events/Party/OnJoinedRoom.asset.meta
Normal file
8
Assets/Scriptables/Events/Party/OnJoinedRoom.asset.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f1a37dbd6b4904a4f9d9834d72d99370
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -28,8 +28,18 @@ public class CharacterAnimatorController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
parentController = GetComponentInParent<CharacterAnimatorParent>();
|
||||||
|
Debug.Log("OnEnable: parentController is " + (parentController != null ? "not null" : "null"));
|
||||||
CastBarHandler.Instance.OnCastingStateChanged.AddListener(UpdateIsCastingState);
|
CastBarHandler.Instance.OnCastingStateChanged.AddListener(UpdateIsCastingState);
|
||||||
}
|
}
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
CastBarHandler.Instance.OnCastingStateChanged.RemoveListener(UpdateIsCastingState);
|
||||||
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
@ -46,6 +56,15 @@ public class CharacterAnimatorController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
anim.SetFloat("throwingTime", (1 / CastBarHandler.Instance.currentCastTime));
|
anim.SetFloat("throwingTime", (1 / CastBarHandler.Instance.currentCastTime));
|
||||||
SetTriggerBasedOnAbility(CastBarHandler.Instance.currentAbility.animationType);
|
SetTriggerBasedOnAbility(CastBarHandler.Instance.currentAbility.animationType);
|
||||||
|
|
||||||
|
if (parentController == null)
|
||||||
|
{
|
||||||
|
parentController = GetComponentInParent<CharacterAnimatorParent>();
|
||||||
|
Debug.Log("OnEnable: parentController is " + (parentController != null ? "not null" : "null"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Log("NULL: " + parentController);
|
||||||
|
|
||||||
parentController.SetRemoteTriggerBasedOnAbility((int)CastBarHandler.Instance.currentAbility.animationType);
|
parentController.SetRemoteTriggerBasedOnAbility((int)CastBarHandler.Instance.currentAbility.animationType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,22 @@ public static class GameConstants
|
|||||||
#region PlayerPrefs Keys
|
#region PlayerPrefs Keys
|
||||||
|
|
||||||
public static string CharacterDataKey = "characterData";
|
public static string CharacterDataKey = "characterData";
|
||||||
|
public static string CharacterInventoryDataKey = "characterInventoryData";
|
||||||
|
public static string CharacterEquipmentDataKey = "characterEquipmentData";
|
||||||
public static string PlayerCoinKey = "playerCoin";
|
public static string PlayerCoinKey = "playerCoin";
|
||||||
|
|
||||||
public static string GetCharacterDataKey(string characterName)
|
public static string GetCharacterDataKey(string characterName)
|
||||||
{
|
{
|
||||||
return CharacterDataKey + "-" + characterName;
|
return CharacterDataKey + "-" + characterName;
|
||||||
}
|
}
|
||||||
|
public static string GetCharacterInventoryDataKey(string characterName)
|
||||||
|
{
|
||||||
|
return CharacterInventoryDataKey + "-" + characterName;
|
||||||
|
}
|
||||||
|
public static string GetCharacterEquipmentDataKey(string characterName)
|
||||||
|
{
|
||||||
|
return CharacterEquipmentDataKey + "-" + characterName;
|
||||||
|
}
|
||||||
public static string GetPlayerCoinKey(string playerName)
|
public static string GetPlayerCoinKey(string playerName)
|
||||||
{
|
{
|
||||||
return PlayerCoinKey + "-" + playerName;
|
return PlayerCoinKey + "-" + playerName;
|
||||||
@ -42,4 +52,10 @@ public static class GameConstants
|
|||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Sizes
|
||||||
|
{
|
||||||
|
public static int TotalEquipmentSlots = 6;
|
||||||
|
public static int TotalInventorySlots = 18;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
8
Assets/Scripts/Items.meta
Normal file
8
Assets/Scripts/Items.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1b44a0180a8ad7345baaa9131bfdd225
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
29
Assets/Scripts/Items/EquipmentData.cs
Normal file
29
Assets/Scripts/Items/EquipmentData.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class EquipmentData
|
||||||
|
{
|
||||||
|
public int[] equippedItems;
|
||||||
|
|
||||||
|
public EquipmentData()
|
||||||
|
{
|
||||||
|
equippedItems = new int[GameConstants.Sizes.TotalEquipmentSlots];
|
||||||
|
|
||||||
|
for (int i = 0; i < equippedItems.Length; i++)
|
||||||
|
{
|
||||||
|
equippedItems[i] = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public EquipmentData(int[] equippedItems)
|
||||||
|
{
|
||||||
|
this.equippedItems = new int[GameConstants.Sizes.TotalEquipmentSlots];
|
||||||
|
|
||||||
|
for (int i = 0; i < equippedItems.Length; i++)
|
||||||
|
{
|
||||||
|
this.equippedItems[i] = equippedItems[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Items/EquipmentData.cs.meta
Normal file
11
Assets/Scripts/Items/EquipmentData.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 544936ba1c15dca458f0c21534bbd311
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
28
Assets/Scripts/Items/InventoryData.cs
Normal file
28
Assets/Scripts/Items/InventoryData.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class InventoryData
|
||||||
|
{
|
||||||
|
public int[] inventoryItems;
|
||||||
|
|
||||||
|
public InventoryData()
|
||||||
|
{
|
||||||
|
inventoryItems = new int[GameConstants.Sizes.TotalInventorySlots];
|
||||||
|
|
||||||
|
for (int i = 0; i < inventoryItems.Length; i++)
|
||||||
|
{
|
||||||
|
inventoryItems[i] = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public InventoryData(int[] inventoryItems)
|
||||||
|
{
|
||||||
|
this.inventoryItems = new int[GameConstants.Sizes.TotalInventorySlots];
|
||||||
|
|
||||||
|
for (int i = 0; i < inventoryItems.Length; i++)
|
||||||
|
{
|
||||||
|
this.inventoryItems[i] = inventoryItems[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Items/InventoryData.cs.meta
Normal file
11
Assets/Scripts/Items/InventoryData.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0a05b9f8bb51da546a37f79a8794fec7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
48
Assets/Scripts/Items/ItemIndexer.cs
Normal file
48
Assets/Scripts/Items/ItemIndexer.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using Kryz.CharacterStats.Examples;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ItemIndexer : MonoBehaviour
|
||||||
|
{
|
||||||
|
#region Singleton
|
||||||
|
private static ItemIndexer _instance;
|
||||||
|
|
||||||
|
// Public reference to the singleton instance
|
||||||
|
public static ItemIndexer Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// If the instance doesn't exist, try to find it in the scene
|
||||||
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
_instance = FindObjectOfType<ItemIndexer>();
|
||||||
|
|
||||||
|
// If it's still null, create a new GameObject and add the component
|
||||||
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
GameObject singletonObject = new GameObject(typeof(ItemIndexer).Name);
|
||||||
|
_instance = singletonObject.AddComponent<ItemIndexer>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public List<Item> Items = new List<Item>();
|
||||||
|
|
||||||
|
protected void Awake()
|
||||||
|
{
|
||||||
|
// Ensure there's only one instance
|
||||||
|
if (_instance != null && _instance != this)
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this is the first instance, set it as the singleton
|
||||||
|
_instance = this;
|
||||||
|
DontDestroyOnLoad(gameObject);
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Items/ItemIndexer.cs.meta
Normal file
11
Assets/Scripts/Items/ItemIndexer.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 89530648eb9e4314681d49de96e7f026
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
129
Assets/Scripts/Items/PlayerDataHandler.cs
Normal file
129
Assets/Scripts/Items/PlayerDataHandler.cs
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
using Kryz.CharacterStats.Examples;
|
||||||
|
using Photon.Pun;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class PlayerDataHandler : MonoBehaviour
|
||||||
|
{
|
||||||
|
#region Singleton
|
||||||
|
private static PlayerDataHandler _instance;
|
||||||
|
|
||||||
|
// Public reference to the singleton instance
|
||||||
|
public static PlayerDataHandler Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// If the instance doesn't exist, try to find it in the scene
|
||||||
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
_instance = FindObjectOfType<PlayerDataHandler>();
|
||||||
|
|
||||||
|
// If it's still null, create a new GameObject and add the component
|
||||||
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
GameObject singletonObject = new GameObject(typeof(PlayerDataHandler).Name);
|
||||||
|
_instance = singletonObject.AddComponent<PlayerDataHandler>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
CharacterData characterData = new CharacterData();
|
||||||
|
string characterDataKey;
|
||||||
|
|
||||||
|
CoinData coinData = new CoinData();
|
||||||
|
string playerCoinKey;
|
||||||
|
|
||||||
|
EquipmentData equipmentData = new EquipmentData();
|
||||||
|
string equipmentDataKey;
|
||||||
|
|
||||||
|
InventoryData inventoryData = new InventoryData();
|
||||||
|
string inventoryDataKey;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
DontDestroyOnLoad(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Character Data (Level, exp etc)
|
||||||
|
public CharacterData LoadCharacterData(string characterName)
|
||||||
|
{
|
||||||
|
characterDataKey = GameConstants.PlayerPrefsKeys.GetCharacterDataKey(characterName);
|
||||||
|
|
||||||
|
if (GameStatePersistenceManager.Instance.HasDataForKey(characterDataKey))
|
||||||
|
{
|
||||||
|
characterData = GameStatePersistenceManager.Instance.LoadData<CharacterData>(characterDataKey);
|
||||||
|
return characterData;
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
public void SaveCharacterData(string characterName, CharacterData characterData)
|
||||||
|
{
|
||||||
|
characterDataKey = GameConstants.PlayerPrefsKeys.GetCharacterDataKey(characterName);
|
||||||
|
|
||||||
|
GameStatePersistenceManager.Instance.SaveData(characterDataKey, characterData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Player Coin Data (global coin amount)
|
||||||
|
public CoinData LoadPlayerCoinData(string characterName)
|
||||||
|
{
|
||||||
|
playerCoinKey = GameConstants.PlayerPrefsKeys.GetPlayerCoinKey(characterName);
|
||||||
|
|
||||||
|
if (GameStatePersistenceManager.Instance.HasDataForKey(playerCoinKey))
|
||||||
|
{
|
||||||
|
coinData = GameStatePersistenceManager.Instance.LoadData<CoinData>(playerCoinKey);
|
||||||
|
return coinData;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public void SavePlayerCoinData(string characterName, CoinData coinData)
|
||||||
|
{
|
||||||
|
playerCoinKey = GameConstants.PlayerPrefsKeys.GetPlayerCoinKey(characterName);
|
||||||
|
|
||||||
|
GameStatePersistenceManager.Instance.SaveData(playerCoinKey, coinData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Character Equipment Data (equipped items)
|
||||||
|
public EquipmentData LoadCharacterEquipmentData(string characterName)
|
||||||
|
{
|
||||||
|
equipmentDataKey = GameConstants.PlayerPrefsKeys.GetCharacterEquipmentDataKey(characterName);
|
||||||
|
|
||||||
|
if (GameStatePersistenceManager.Instance.HasDataForKey(equipmentDataKey))
|
||||||
|
{
|
||||||
|
equipmentData = GameStatePersistenceManager.Instance.LoadData<EquipmentData>(equipmentDataKey);
|
||||||
|
return equipmentData;
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
public void SaveCharacterEquipmentData(string characterName, EquipmentData equipmentData)
|
||||||
|
{
|
||||||
|
equipmentDataKey = GameConstants.PlayerPrefsKeys.GetCharacterEquipmentDataKey(characterName);
|
||||||
|
|
||||||
|
GameStatePersistenceManager.Instance.SaveData(equipmentDataKey, equipmentData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Character Inventory Data (items on inventory)
|
||||||
|
public InventoryData LoadCharacterInventoryData(string characterName)
|
||||||
|
{
|
||||||
|
inventoryDataKey = GameConstants.PlayerPrefsKeys.GetCharacterInventoryDataKey(characterName);
|
||||||
|
|
||||||
|
if (GameStatePersistenceManager.Instance.HasDataForKey(inventoryDataKey))
|
||||||
|
{
|
||||||
|
inventoryData = GameStatePersistenceManager.Instance.LoadData<InventoryData>(inventoryDataKey);
|
||||||
|
return inventoryData;
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
public void SaveCharacterInventoryData(string characterName, InventoryData inventoryData)
|
||||||
|
{
|
||||||
|
inventoryDataKey = GameConstants.PlayerPrefsKeys.GetCharacterInventoryDataKey(characterName);
|
||||||
|
|
||||||
|
GameStatePersistenceManager.Instance.SaveData(inventoryDataKey, inventoryData);
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Items/PlayerDataHandler.cs.meta
Normal file
11
Assets/Scripts/Items/PlayerDataHandler.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 40822b285732f4c4faa78e10ed5932da
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -20,6 +20,7 @@ public class NetworkManager : MonoBehaviourPunCallbacks, IOnEventCallback
|
|||||||
[SerializeField] private GameEvent_Player onPlayerVoted;
|
[SerializeField] private GameEvent_Player onPlayerVoted;
|
||||||
[SerializeField] private GameEvent_Player onPlayerVoteCanceled;
|
[SerializeField] private GameEvent_Player onPlayerVoteCanceled;
|
||||||
[SerializeField] private GameEvent onLoadLevelStarting;
|
[SerializeField] private GameEvent onLoadLevelStarting;
|
||||||
|
[SerializeField] private GameEvent onJoinedRoom;
|
||||||
|
|
||||||
[SerializeField] private GameEventListener_ZoneData onGameSceneLoaded;
|
[SerializeField] private GameEventListener_ZoneData onGameSceneLoaded;
|
||||||
[SerializeField] private GameEventListener_PhotonView onPlayerSpawned;
|
[SerializeField] private GameEventListener_PhotonView onPlayerSpawned;
|
||||||
@ -85,6 +86,8 @@ public class NetworkManager : MonoBehaviourPunCallbacks, IOnEventCallback
|
|||||||
PhotonNetwork.LoadLevel(huntersInn);
|
PhotonNetwork.LoadLevel(huntersInn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onJoinedRoom.Raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnGameSceneLoaded(ZoneData zoneData)
|
public void OnGameSceneLoaded(ZoneData zoneData)
|
||||||
|
@ -8,26 +8,18 @@ public class CoinBag : MonoBehaviour
|
|||||||
{
|
{
|
||||||
[SerializeField] private TMP_Text coinText;
|
[SerializeField] private TMP_Text coinText;
|
||||||
[SerializeField] private GameEventListener_Int onCoinDrop;
|
[SerializeField] private GameEventListener_Int onCoinDrop;
|
||||||
|
[SerializeField] private GameEventListener onJoinedRoom;
|
||||||
|
|
||||||
public int currentCoin;
|
public int currentCoin;
|
||||||
|
|
||||||
CoinData coinData = new CoinData();
|
CoinData coinData = new CoinData();
|
||||||
string playerCoinKey;
|
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
playerCoinKey = GameConstants.PlayerPrefsKeys.GetPlayerCoinKey(PhotonNetwork.NickName);
|
|
||||||
|
|
||||||
if (GameStatePersistenceManager.Instance.HasDataForKey(playerCoinKey))
|
|
||||||
{
|
|
||||||
coinData = GameStatePersistenceManager.Instance.LoadData<CoinData>(playerCoinKey);
|
|
||||||
currentCoin = coinData.totalCoin;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
currentCoin = 0;
|
|
||||||
|
|
||||||
onCoinDrop.Response.AddListener(ChangeAmount);
|
onCoinDrop.Response.AddListener(ChangeAmount);
|
||||||
|
|
||||||
|
onJoinedRoom.Response.AddListener(LoadCoins);
|
||||||
|
|
||||||
UpdateCoinText();
|
UpdateCoinText();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +55,20 @@ public class CoinBag : MonoBehaviour
|
|||||||
{
|
{
|
||||||
coinData.totalCoin = currentCoin;
|
coinData.totalCoin = currentCoin;
|
||||||
|
|
||||||
GameStatePersistenceManager.Instance.SaveData(playerCoinKey, coinData);
|
PlayerDataHandler.Instance.SavePlayerCoinData(PhotonNetwork.NickName, coinData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LoadCoins()
|
||||||
|
{
|
||||||
|
coinData = PlayerDataHandler.Instance.LoadPlayerCoinData(PhotonNetwork.NickName);
|
||||||
|
if (coinData != null)
|
||||||
|
{
|
||||||
|
Debug.Log("Success Loading CoinData");
|
||||||
|
currentCoin = coinData.totalCoin;
|
||||||
|
UpdateCoinText();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
coinData = new CoinData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,16 @@ public class ProjectileSpawnLocationController : MonoBehaviour
|
|||||||
protected virtual void Awake()
|
protected virtual void Awake()
|
||||||
{
|
{
|
||||||
photonView = GetComponentInParent<PhotonView>();
|
photonView = GetComponentInParent<PhotonView>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
CastBarHandler.Instance.OnCastingStateChanged.AddListener(UpdateIsCastingState);
|
CastBarHandler.Instance.OnCastingStateChanged.AddListener(UpdateIsCastingState);
|
||||||
}
|
}
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
CastBarHandler.Instance.OnCastingStateChanged.RemoveListener(UpdateIsCastingState);
|
||||||
|
}
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
protected virtual void Start()
|
protected virtual void Start()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user