├── .idea ├── misc.xml ├── mmorpg-kit-snippets.iml ├── modules.xml └── workspace.xml ├── CharacterBuilds.meta ├── CharacterBuilds ├── Build.cs ├── Build.cs.meta ├── BuildEquipItem.cs ├── BuildEquipItem.cs.meta ├── BuildHotKey.cs ├── BuildHotKey.cs.meta ├── CharacterBuildController.cs ├── CharacterBuildController.cs.meta ├── CharacterBuilds.cs ├── CharacterBuilds.cs.meta ├── PlayerCharacterEntity_CharacterBuilds.cs ├── PlayerCharacterEntity_CharacterBuilds.cs.meta ├── UIBuild.prefab ├── UIBuild.prefab.meta ├── UIBuildsDialog.prefab ├── UIBuildsDialog.prefab.meta ├── UICharacterBuild.cs ├── UICharacterBuild.cs.meta ├── UICharacterBuilds.cs └── UICharacterBuilds.cs.meta ├── Context.meta ├── Context ├── ContextConfig.cs ├── ContextConfig.cs.meta ├── ContextConfig.prefab ├── ContextConfig.prefab.meta ├── ContextMenuItem.prefab ├── ContextMenuItem.prefab.meta ├── ItemContextMenuButtonActivator.cs ├── ItemContextMenuButtonActivator.cs.meta ├── Menus.meta ├── Menus │ ├── ItemContextMenu.cs │ ├── ItemContextMenu.cs.meta │ ├── ItemContextMenu.prefab │ ├── ItemContextMenu.prefab.meta │ ├── Menus.meta │ ├── Menus │ │ ├── TightenedUISceneGameplay.cs │ │ ├── TightenedUISceneGameplay.cs.meta │ │ ├── UIOrdering.cs │ │ ├── UIOrdering.cs.meta │ │ ├── UISceneGameplay_ExitMenus.cs │ │ └── UISceneGameplay_ExitMenus.cs.meta │ ├── MonsterContextMenu.cs │ ├── MonsterContextMenu.cs.meta │ ├── MonsterContextMenu.prefab │ ├── MonsterContextMenu.prefab.meta │ ├── NPCContextMenu.cs │ ├── NPCContextMenu.cs.meta │ ├── NPCContextMenu.prefab │ ├── NPCContextMenu.prefab.meta │ ├── PlayerContextMenu.cs │ ├── PlayerContextMenu.cs.meta │ ├── PlayerContextMenu.prefab │ ├── PlayerContextMenu.prefab.meta │ ├── SkillContextMenu.cs │ ├── SkillContextMenu.cs.meta │ ├── SkillContextMenu.prefab │ └── SkillContextMenu.prefab.meta ├── UIContextMenu.cs └── UIContextMenu.cs.meta ├── CustomGameMessage.cs ├── CustomGameMessage.cs.meta ├── FlexibleSpawners.meta ├── FlexibleSpawners ├── FlexibleHarvestableSpawnArea.cs ├── FlexibleHarvestableSpawnArea.cs.meta ├── FlexibleMonsterSpawnArea.cs ├── FlexibleMonsterSpawnArea.cs.meta ├── SpawnerUtils.cs └── SpawnerUtils.cs.meta ├── OverheadUI.meta ├── OverheadUI ├── GameInstance_HarvestableUI.cs ├── GameInstance_HarvestableUI.cs.meta ├── HarvestableEntityWithUI.cs ├── HarvestableEntityWithUI.cs.meta ├── OverheadHPToggle.cs ├── OverheadHPToggle.cs.meta ├── OverheadScaler.cs ├── OverheadScaler.cs.meta ├── OverheadTargetToggle.cs ├── OverheadTargetToggle.cs.meta ├── OverheadUI.prefab ├── OverheadUI.prefab.meta ├── PlayerCharacterController_SubTarget.cs ├── PlayerCharacterController_SubTarget.cs.meta ├── UIHarvestableEntity.cs └── UIHarvestableEntity.cs.meta ├── README.md ├── README.md.meta ├── SafeZone.meta ├── SafeZone ├── AreaDamageEntity_SafeZone.cs ├── AreaDamageEntity_SafeZone.cs.meta ├── NoAttackSafeArea.cs ├── NoAttackSafeArea.cs.meta ├── PlayerCharacterController_SafeZone.cs └── PlayerCharacterController_SafeZone.cs.meta ├── Swim.meta ├── Swim ├── SwimRigidBodyEntityMovement.cs └── SwimRigidBodyEntityMovement.cs.meta ├── Targeting.meta ├── Targeting ├── BaseCharacterEntity_Targetable.cs ├── BaseCharacterEntity_Targetable.cs.meta ├── BaseCharacterEntity_TargetingData.cs ├── BaseCharacterEntity_TargetingData.cs.meta ├── CharacterUICamera.prefab ├── CharacterUICamera.prefab.meta ├── GameplayCamera.prefab ├── GameplayCamera.prefab.meta ├── PlayerCharacterController_TabTarget.cs ├── PlayerCharacterController_TabTarget.cs.meta ├── README.md ├── README.md.meta ├── Recticle.prefab ├── Recticle.prefab.meta ├── Spin.cs ├── Spin.cs.meta ├── TabTargetBillboard.cs ├── TabTargetBillboard.cs.meta ├── TabTargetCameraController.cs ├── TabTargetCameraController.cs.meta ├── TabTargetPlayerController.cs ├── TabTargetPlayerController.cs.meta ├── TabTargeting.cs ├── TabTargeting.cs.meta ├── frame-0.png └── frame-0.png.meta ├── Tooltips.meta ├── Tooltips ├── CanvasGameplay.prefab ├── CanvasGameplay.prefab.meta ├── README.md ├── README.md.meta ├── TooltipArea.cs ├── TooltipArea.cs.meta ├── TooltipConfig.cs ├── TooltipConfig.cs.meta ├── TooltipConfig.prefab ├── TooltipConfig.prefab.meta ├── UICharacterSkill.prefab ├── UICharacterSkill.prefab.meta ├── UIItemDialog.prefab ├── UIItemDialog.prefab.meta ├── UIItemIcon.prefab ├── UIItemIcon.prefab.meta ├── UISkillDialog.prefab └── UISkillDialog.prefab.meta ├── UI.meta ├── UI ├── BaseHandleBehavior.cs ├── BaseHandleBehavior.cs.meta ├── DragWindow.cs ├── DragWindow.cs.meta ├── HandleTarget.cs ├── HandleTarget.cs.meta ├── ResizeWindow.cs └── ResizeWindow.cs.meta ├── package.json └── package.json.meta /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/mmorpg-kit-snippets.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 1604246839898 38 | 48 | 49 | 50 | 51 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /CharacterBuilds.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8decad28494154448661346da86638c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /CharacterBuilds/Build.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | namespace CharacterBuilds 7 | { 8 | [Serializable] 9 | public class Build 10 | { 11 | 12 | public string label; 13 | public int playerEntityId; 14 | public BuildEquipItem[] equipment; 15 | public BuildHotKey[] hotKeys; 16 | 17 | public static Build Create() 18 | { 19 | Build build = new Build(); 20 | return build; 21 | } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CharacterBuilds/Build.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4a2ce6588c4088b42af02a8a84b64832 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /CharacterBuilds/BuildEquipItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace CharacterBuilds 3 | { 4 | [Serializable] 5 | public class BuildEquipItem 6 | { 7 | public string slot; 8 | public int equipSet; 9 | public string id; 10 | 11 | public BuildEquipItem(string slot, string id, int equipSet = 0) 12 | { 13 | this.slot = slot; 14 | this.id = id; 15 | this.equipSet = equipSet; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /CharacterBuilds/BuildEquipItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5462be26bcd848240a16cde0265634a0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /CharacterBuilds/BuildHotKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | namespace CharacterBuilds { 7 | 8 | [Serializable] 9 | public class BuildHotKey { 10 | public string hotkeyId; 11 | public string relateId; 12 | public HotkeyType type; 13 | 14 | public BuildHotKey(string hotkeyId, HotkeyType type, string relateId) { 15 | this.hotkeyId = hotkeyId; 16 | this.type = type; 17 | this.relateId = relateId; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /CharacterBuilds/BuildHotKey.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 12fbab0f9771e8d44a22e17f51ce28a9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /CharacterBuilds/CharacterBuildController.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Events; 3 | using MultiplayerARPG; 4 | using System.Collections; 5 | using System.Collections.Generic; 6 | using LiteNetLib; 7 | using LiteNetLibManager; 8 | using System; 9 | 10 | namespace CharacterBuilds 11 | { 12 | public class CharacterBuildEvent : UnityEvent 13 | { 14 | 15 | } 16 | public class CharacterBuildController : MonoBehaviour 17 | { 18 | public static UnityEvent OnLoad = new UnityEvent(); 19 | public static PlayerCharacterEntity player; 20 | public static CharacterBuilds builds; 21 | void Start() 22 | { 23 | player = BasePlayerCharacterController.OwningCharacter as PlayerCharacterEntity; 24 | LoadBuilds(); 25 | if (builds == null) 26 | InitializeBuilds(player.DataId); 27 | } 28 | public static void InitializeBuilds(int playerEntityId) 29 | { 30 | builds = new CharacterBuilds(); 31 | builds.playerEntityId = playerEntityId; 32 | SaveBuilds(); 33 | } 34 | public static void LoadBuilds() 35 | { 36 | try 37 | { 38 | string json = PlayerPrefs.GetString("builds_" + player.DataId); 39 | if (json?.Length > 0) 40 | { 41 | builds = JsonUtility.FromJson(json); 42 | Debug.Log(json); 43 | OnLoad.Invoke(); 44 | } 45 | } 46 | catch (Exception e) 47 | { 48 | Debug.LogWarning(e); 49 | } 50 | } 51 | 52 | public static void ApplyBuild(int index) 53 | { 54 | if (builds.builds.Length > index) 55 | { 56 | try 57 | { 58 | player.UnequipAll(); 59 | player.UnSetHotKeys(); 60 | player.EquipAll(builds.builds[index].equipment); 61 | player.SetHotKeys(builds.builds[index].hotKeys); 62 | builds.currentBuild = index; 63 | CharacterBuildController.SaveBuilds(); 64 | } 65 | catch (Exception e) 66 | { 67 | Debug.Log("Could not apply build " + builds.builds[index].label); 68 | Debug.Log(e); 69 | } 70 | } 71 | } 72 | 73 | public static void SaveBuilds() 74 | { 75 | string json = JsonUtility.ToJson(builds, true); 76 | PlayerPrefs.SetString("builds_" + player.DataId, json); 77 | OnLoad.Invoke(); 78 | } 79 | public static Build CreateBuild() 80 | { 81 | Build build = Build.Create(); 82 | build.equipment = BuildGear().ToArray(); 83 | build.hotKeys = BuildHotKeys().ToArray(); 84 | 85 | return build; 86 | } 87 | 88 | public static List BuildHotKeys() 89 | { 90 | List hotKeys = new List(); 91 | CharacterHotkey hotKey; 92 | for (int i = 0; i < player.Hotkeys.Count; i++) 93 | { 94 | hotKey = player.Hotkeys[i]; 95 | hotKeys.Add(new BuildHotKey(hotKey.hotkeyId, hotKey.type, hotKey.relateId)); 96 | } 97 | return hotKeys; 98 | } 99 | public static List BuildGear() 100 | { 101 | IArmorItem tempArmorItem; 102 | CharacterItem tempEquipItem; 103 | List gear = new List(); 104 | for (int i = 0; i < player.EquipItems.Count; i++) 105 | { 106 | tempEquipItem = player.EquipItems[i]; 107 | tempArmorItem = tempEquipItem.GetArmorItem(); 108 | if (tempArmorItem == null) 109 | continue; 110 | string equipPosition = GetEquipPosition(tempArmorItem.EquipPosition, tempEquipItem.equipSlotIndex); 111 | gear.Add(new BuildEquipItem(equipPosition, tempEquipItem.id)); 112 | } 113 | EquipWeapons weapons; 114 | for (int i = 0; i < player.SelectableWeaponSets.Count; i++) 115 | { 116 | weapons = player.SelectableWeaponSets[i]; 117 | string leftPosition = GetEquipPosition(GameDataConst.EQUIP_POSITION_LEFT_HAND, (byte)i); 118 | string rightPosition = GetEquipPosition(GameDataConst.EQUIP_POSITION_RIGHT_HAND, (byte)i); 119 | if (weapons.rightHand?.GetEquipmentItem()?.DataId != null) 120 | gear.Add(new BuildEquipItem(rightPosition, weapons.rightHand.id, i)); 121 | if (weapons.leftHand?.GetEquipmentItem()?.DataId != null) 122 | gear.Add(new BuildEquipItem(leftPosition, weapons.leftHand.id, i)); 123 | }; 124 | return gear; 125 | } 126 | 127 | public static string GetEquipPosition(string equipPositionId, byte equipSlotIndex) 128 | { 129 | return equipPositionId + ":" + equipSlotIndex; 130 | } 131 | 132 | public static byte GetEquipSlotIndexFromEquipPosition(string equipPosition) 133 | { 134 | string[] splitEquipPosition = equipPosition.Split(':'); 135 | return byte.Parse(splitEquipPosition[splitEquipPosition.Length - 1]); 136 | } 137 | } 138 | 139 | 140 | } -------------------------------------------------------------------------------- /CharacterBuilds/CharacterBuildController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 35180dcb9c00c8b43a060f4b1094f7a8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /CharacterBuilds/CharacterBuilds.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using MultiplayerARPG; 5 | using UnityEngine; 6 | 7 | namespace CharacterBuilds 8 | { 9 | [Serializable] 10 | public class CharacterBuilds 11 | { 12 | public int playerEntityId; 13 | 14 | public int currentBuild = 0; 15 | public Build[] builds; 16 | 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /CharacterBuilds/CharacterBuilds.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 578d10b22cc9c4bb0b2f04497eb3e704 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /CharacterBuilds/PlayerCharacterEntity_CharacterBuilds.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | using LiteNetLib; 4 | using LiteNetLibManager; 5 | using System; 6 | using System.Collections; 7 | using System.Collections.Generic; 8 | using UnityEngine; 9 | using CharacterBuilds; 10 | 11 | namespace MultiplayerARPG 12 | { 13 | public partial class PlayerCharacterEntity : BasePlayerCharacterEntity 14 | { 15 | 16 | 17 | private bool CallServerEquipWeapon(short nonEquipIndex, byte equipWeaponSet, bool isLeftHand) 18 | { 19 | if (!CanDoActions() || 20 | nonEquipIndex >= NonEquipItems.Count) 21 | return false; 22 | RPC(ServerEquipWeapon, nonEquipIndex, equipWeaponSet, isLeftHand); 23 | return true; 24 | } 25 | public void Equip(string id, string slot, int equipSet = 0) 26 | { 27 | short nonEquipIndex = (short)BasePlayerCharacterController.OwningCharacter.IndexOfNonEquipItem(id); 28 | if (nonEquipIndex > -1) 29 | { 30 | if (slot.Contains("_HAND")) 31 | CallServerEquipWeapon(nonEquipIndex, (byte)equipSet, slot.Contains("LEFT_")); 32 | else 33 | CallServerEquipItem(nonEquipIndex); 34 | } 35 | } 36 | 37 | public void UnequipAll() 38 | { 39 | CharacterItem[] equipment = EquipItems.ToArray(); 40 | for (int i = 0; i < equipment.Length; i++) 41 | { 42 | if (equipment[i].GetArmorItem() != null) 43 | RequestUnEquipItem(InventoryType.EquipItems, equipment[i].equipSlotIndex, 0); 44 | } 45 | for (int i = 0; i < SelectableWeaponSets.Count; i++) 46 | { 47 | if (SelectableWeaponSets[i].rightHand.GetWeaponItem() != null) 48 | RequestUnEquipItem(InventoryType.EquipWeaponRight, 0, (byte)i); 49 | if (SelectableWeaponSets[i].leftHand.GetWeaponItem() != null) 50 | RequestUnEquipItem(InventoryType.EquipWeaponLeft, 0, (byte)i); 51 | }; 52 | } 53 | public void EquipAll(BuildEquipItem[] items) 54 | { 55 | foreach (BuildEquipItem equipItem in items) 56 | { 57 | Equip(equipItem.id, equipItem.slot, equipItem.equipSet); 58 | } 59 | } 60 | public void UnSetHotKeys() 61 | { 62 | List set = new List(); 63 | Hotkeys = set; 64 | } 65 | public void SetHotKeys(BuildHotKey[] hotKeys) 66 | { 67 | List set = new List(); 68 | foreach (BuildHotKey hotKey in hotKeys) 69 | { 70 | CharacterHotkey characterHotkey = new CharacterHotkey(); 71 | characterHotkey.type = hotKey.type; 72 | characterHotkey.relateId = hotKey.relateId; 73 | characterHotkey.hotkeyId = hotKey.hotkeyId; 74 | set.Add(characterHotkey); 75 | } 76 | Hotkeys = set; 77 | } 78 | 79 | public string GetEquipPosition(string equipPositionId, byte equipSlotIndex) 80 | { 81 | return equipPositionId + ":" + equipSlotIndex; 82 | } 83 | 84 | public byte GetEquipSlotIndexFromEquipPosition(string equipPosition) 85 | { 86 | string[] splitEquipPosition = equipPosition.Split(':'); 87 | return byte.Parse(splitEquipPosition[splitEquipPosition.Length - 1]); 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /CharacterBuilds/PlayerCharacterEntity_CharacterBuilds.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49dd6b97f44da5b42a263afaa1b61b51 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /CharacterBuilds/UIBuild.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd03a3956620dc44e8065f7f498d6d9e 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /CharacterBuilds/UIBuildsDialog.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85893c2ebf2ad014c8119f1968bdb620 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /CharacterBuilds/UICharacterBuild.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.Events; 5 | using MultiplayerARPG; 6 | 7 | namespace CharacterBuilds 8 | { 9 | public class UICharacterBuild : UIBase 10 | { 11 | 12 | public UnityEvent OnSet = new UnityEvent(); 13 | public UnityEvent OnUpdate = new UnityEvent(); 14 | public UnityEvent OnDelete = new UnityEvent(); 15 | public int index; 16 | 17 | public TextWrapper uiBuildNumber; 18 | public TextWrapper uiBuildName; 19 | 20 | 21 | void OnEnable() 22 | { 23 | UpdateData(); 24 | } 25 | 26 | 27 | public void UpdateData() 28 | { 29 | if (CharacterBuildController.builds?.builds.Length > index) 30 | { 31 | Build build = CharacterBuildController.builds.builds[index]; 32 | if (uiBuildNumber) 33 | uiBuildNumber.text = (index + 1) + ""; 34 | if (uiBuildName) 35 | uiBuildName.text = build.label; 36 | } 37 | } 38 | 39 | public void OnClickSet() 40 | { 41 | OnSet.Invoke(index); 42 | } 43 | public void OnClickUpdate() 44 | { 45 | OnUpdate.Invoke(index); 46 | } 47 | 48 | public void OnClickDelete() 49 | { 50 | OnDelete.Invoke(index); 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /CharacterBuilds/UICharacterBuild.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9c1f40720d04fcd459afb0269d4ab90b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /CharacterBuilds/UICharacterBuilds.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | using MultiplayerARPG; 6 | using System; 7 | 8 | namespace CharacterBuilds 9 | { 10 | public class UICharacterBuilds : UIBase 11 | { 12 | protected List uiBuilds; 13 | public PlayerCharacterEntity Player 14 | { 15 | get 16 | { 17 | return BasePlayerCharacterController.OwningCharacter as PlayerCharacterEntity; 18 | } 19 | } 20 | 21 | public CharacterBuilds Builds 22 | { 23 | get 24 | { 25 | return CharacterBuildController.builds; 26 | } 27 | } 28 | public UICharacterBuild buildPrefab; 29 | public GameObject buildsContainer; 30 | public InputField input; 31 | 32 | void Start() 33 | { 34 | uiBuilds = new List(); 35 | } 36 | 37 | void OnEnable() 38 | { 39 | UpdateData(); 40 | CharacterBuildController.OnLoad.AddListener(UpdateData); 41 | } 42 | 43 | void OnDisable() 44 | { 45 | CharacterBuildController.OnLoad.RemoveListener(UpdateData); 46 | } 47 | 48 | public void OnCreateBuild() 49 | { 50 | string label = input.text; 51 | if (label?.Length > 2) 52 | { 53 | Build build = CharacterBuildController.CreateBuild(); 54 | build.label = label + ""; 55 | Build[] dest = new Build[Builds.builds.Length + 1]; 56 | Array.Copy(Builds.builds, 0, dest, 0, Builds.builds.Length); 57 | dest[Builds.builds.Length] = build; 58 | Builds.builds = dest; 59 | CharacterBuildController.SaveBuilds(); 60 | } 61 | } 62 | public void OnDeleteBuild(int index) 63 | { 64 | 65 | if (Builds.builds.Length > index) 66 | { 67 | Build[] dest = new Build[Builds.builds.Length - 1]; 68 | if (index > 0) 69 | Array.Copy(Builds.builds, 0, dest, 0, index); 70 | 71 | if (index < Builds.builds.Length - 1) 72 | Array.Copy(Builds.builds, index + 1, dest, index, Builds.builds.Length - index - 1); 73 | 74 | Builds.builds = dest; 75 | CharacterBuildController.SaveBuilds(); 76 | } 77 | } 78 | 79 | public void OnSelectBuild(int index) 80 | { 81 | if (Builds.builds.Length > index) 82 | { 83 | CharacterBuildController.ApplyBuild(index); 84 | } 85 | } 86 | 87 | public void OnUpdateBuild(int index) 88 | { 89 | if (Builds.builds.Length > index) 90 | { 91 | Build build = CharacterBuildController.CreateBuild(); 92 | Build existing = Builds.builds[index]; 93 | existing.equipment = build.equipment; 94 | existing.hotKeys = build.hotKeys; 95 | CharacterBuildController.SaveBuilds(); 96 | } 97 | } 98 | 99 | public void UpdateData() 100 | { 101 | if (Builds == null) return; 102 | buildsContainer.RemoveObjectsByComponentInChildren(true); 103 | for (int i = 0; i < Builds.builds.Length; i++) 104 | { 105 | Build build = Builds.builds[i]; 106 | UICharacterBuild uiBuild = Instantiate(buildPrefab, buildsContainer.transform); 107 | uiBuild.index = i; 108 | uiBuild.OnSet.AddListener(OnSelectBuild); 109 | uiBuild.OnUpdate.AddListener(OnUpdateBuild); 110 | uiBuild.OnDelete.AddListener(OnDeleteBuild); 111 | uiBuild.UpdateData(); 112 | 113 | } 114 | } 115 | 116 | } 117 | } -------------------------------------------------------------------------------- /CharacterBuilds/UICharacterBuilds.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 94d29fd65265c0c4cb177b6fa0ebfc4d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Context.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aab8f7321f6731c45bf431d6e47042ec 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Context/ContextConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace Context 6 | { 7 | public class ContextConfig : MonoBehaviour 8 | { 9 | 10 | public Transform contextMenuContainer; 11 | 12 | public static ContextConfig Singleton { get; protected set; } 13 | // Start is called before the first frame update 14 | 15 | void Start() 16 | { 17 | Singleton = this; 18 | } 19 | 20 | void LateUpdate() 21 | { 22 | if (Input.GetMouseButtonUp(0)) 23 | DestroyMenu(); 24 | 25 | } 26 | 27 | bool HasClickedOnSomethingElse() 28 | { 29 | RaycastHit hit; 30 | Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); 31 | if (Input.GetMouseButtonDown(0) && Physics.Raycast(ray, out hit, 100f)) 32 | return hit.transform.gameObject.GetComponentInParent() != null; 33 | return false; 34 | } 35 | 36 | public void CreateMenu(GameObject item) 37 | { 38 | contextMenuContainer.RemoveChildren(); 39 | item.transform.SetParent(contextMenuContainer); 40 | RectTransform rect = contextMenuContainer.GetComponent(); 41 | float x = Input.mousePosition.x; 42 | float y = Input.mousePosition.y; 43 | float halfWidth = rect.sizeDelta.x / 2; 44 | float halfHeight = rect.sizeDelta.y / 2; 45 | float screenWidth = Screen.width; 46 | float screenHeight = Screen.height; 47 | float xPos = x + halfWidth; 48 | float yPos = y - halfHeight; 49 | if (xPos + halfWidth > screenWidth) 50 | xPos = x - halfWidth; 51 | if (y - halfHeight < 0) 52 | yPos = y - (y - halfHeight); 53 | contextMenuContainer.transform.position = new Vector3(xPos, yPos, 0); 54 | contextMenuContainer.gameObject.SetActive(true); 55 | } 56 | 57 | 58 | public void DestroyMenu() 59 | { 60 | contextMenuContainer.RemoveChildren(); 61 | contextMenuContainer.gameObject.SetActive(false); 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /Context/ContextConfig.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8e0c8a4a7bbca844a851412bc403f20a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Context/ContextConfig.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &7502865124128805085 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 6022823646682684926} 12 | - component: {fileID: 1143457916440879865} 13 | - component: {fileID: 429366494723378818} 14 | - component: {fileID: 7136135920393284615} 15 | m_Layer: 0 16 | m_Name: ContextMenu 17 | m_TagString: Untagged 18 | m_Icon: {fileID: 0} 19 | m_NavMeshLayer: 0 20 | m_StaticEditorFlags: 0 21 | m_IsActive: 0 22 | --- !u!224 &6022823646682684926 23 | RectTransform: 24 | m_ObjectHideFlags: 0 25 | m_CorrespondingSourceObject: {fileID: 0} 26 | m_PrefabInstance: {fileID: 0} 27 | m_PrefabAsset: {fileID: 0} 28 | m_GameObject: {fileID: 7502865124128805085} 29 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 30 | m_LocalPosition: {x: 0, y: 0, z: 0} 31 | m_LocalScale: {x: 1, y: 1, z: 1} 32 | m_Children: [] 33 | m_Father: {fileID: 1221418221794361130} 34 | m_RootOrder: 0 35 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 36 | m_AnchorMin: {x: 0.5, y: 0.5} 37 | m_AnchorMax: {x: 0.5, y: 0.5} 38 | m_AnchoredPosition: {x: 0, y: 0} 39 | m_SizeDelta: {x: 0, y: 0} 40 | m_Pivot: {x: 0.5, y: 0.5} 41 | --- !u!114 &1143457916440879865 42 | MonoBehaviour: 43 | m_ObjectHideFlags: 0 44 | m_CorrespondingSourceObject: {fileID: 0} 45 | m_PrefabInstance: {fileID: 0} 46 | m_PrefabAsset: {fileID: 0} 47 | m_GameObject: {fileID: 7502865124128805085} 48 | m_Enabled: 1 49 | m_EditorHideFlags: 0 50 | m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} 51 | m_Name: 52 | m_EditorClassIdentifier: 53 | m_Padding: 54 | m_Left: 0 55 | m_Right: 0 56 | m_Top: 0 57 | m_Bottom: 0 58 | m_ChildAlignment: 0 59 | m_Spacing: 0 60 | m_ChildForceExpandWidth: 1 61 | m_ChildForceExpandHeight: 1 62 | m_ChildControlWidth: 0 63 | m_ChildControlHeight: 0 64 | m_ChildScaleWidth: 1 65 | m_ChildScaleHeight: 1 66 | m_ReverseArrangement: 0 67 | --- !u!222 &429366494723378818 68 | CanvasRenderer: 69 | m_ObjectHideFlags: 0 70 | m_CorrespondingSourceObject: {fileID: 0} 71 | m_PrefabInstance: {fileID: 0} 72 | m_PrefabAsset: {fileID: 0} 73 | m_GameObject: {fileID: 7502865124128805085} 74 | m_CullTransparentMesh: 0 75 | --- !u!114 &7136135920393284615 76 | MonoBehaviour: 77 | m_ObjectHideFlags: 0 78 | m_CorrespondingSourceObject: {fileID: 0} 79 | m_PrefabInstance: {fileID: 0} 80 | m_PrefabAsset: {fileID: 0} 81 | m_GameObject: {fileID: 7502865124128805085} 82 | m_Enabled: 1 83 | m_EditorHideFlags: 0 84 | m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} 85 | m_Name: 86 | m_EditorClassIdentifier: 87 | m_HorizontalFit: 2 88 | m_VerticalFit: 2 89 | --- !u!1 &8644162046005105435 90 | GameObject: 91 | m_ObjectHideFlags: 0 92 | m_CorrespondingSourceObject: {fileID: 0} 93 | m_PrefabInstance: {fileID: 0} 94 | m_PrefabAsset: {fileID: 0} 95 | serializedVersion: 6 96 | m_Component: 97 | - component: {fileID: 1221418221794361130} 98 | - component: {fileID: 7026733294709198802} 99 | m_Layer: 0 100 | m_Name: ContextConfig 101 | m_TagString: Untagged 102 | m_Icon: {fileID: 0} 103 | m_NavMeshLayer: 0 104 | m_StaticEditorFlags: 0 105 | m_IsActive: 1 106 | --- !u!4 &1221418221794361130 107 | Transform: 108 | m_ObjectHideFlags: 0 109 | m_CorrespondingSourceObject: {fileID: 0} 110 | m_PrefabInstance: {fileID: 0} 111 | m_PrefabAsset: {fileID: 0} 112 | m_GameObject: {fileID: 8644162046005105435} 113 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 114 | m_LocalPosition: {x: 194.59966, y: 129.40836, z: -34.052734} 115 | m_LocalScale: {x: 1.0984184, y: 1.0984184, z: 1.0984184} 116 | m_Children: 117 | - {fileID: 6022823646682684926} 118 | m_Father: {fileID: 0} 119 | m_RootOrder: 0 120 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 121 | --- !u!114 &7026733294709198802 122 | MonoBehaviour: 123 | m_ObjectHideFlags: 0 124 | m_CorrespondingSourceObject: {fileID: 0} 125 | m_PrefabInstance: {fileID: 0} 126 | m_PrefabAsset: {fileID: 0} 127 | m_GameObject: {fileID: 8644162046005105435} 128 | m_Enabled: 1 129 | m_EditorHideFlags: 0 130 | m_Script: {fileID: 11500000, guid: 8e0c8a4a7bbca844a851412bc403f20a, type: 3} 131 | m_Name: 132 | m_EditorClassIdentifier: 133 | contextMenuContainer: {fileID: 6022823646682684926} 134 | -------------------------------------------------------------------------------- /Context/ContextConfig.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dbf8857f454f86a47bfcbabd990e38f9 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Context/ContextMenuItem.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &2240215140838153184 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 4517969560120726428} 12 | - component: {fileID: 6049958231992612228} 13 | - component: {fileID: 6256258173756994024} 14 | m_Layer: 0 15 | m_Name: Text 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!224 &4517969560120726428 22 | RectTransform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 2240215140838153184} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: [] 32 | m_Father: {fileID: 5127821461125531301} 33 | m_RootOrder: 0 34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 35 | m_AnchorMin: {x: 0, y: 0} 36 | m_AnchorMax: {x: 0, y: 0} 37 | m_AnchoredPosition: {x: 0, y: 0} 38 | m_SizeDelta: {x: 0, y: 0} 39 | m_Pivot: {x: 0.5, y: 0.5} 40 | --- !u!222 &6049958231992612228 41 | CanvasRenderer: 42 | m_ObjectHideFlags: 0 43 | m_CorrespondingSourceObject: {fileID: 0} 44 | m_PrefabInstance: {fileID: 0} 45 | m_PrefabAsset: {fileID: 0} 46 | m_GameObject: {fileID: 2240215140838153184} 47 | m_CullTransparentMesh: 0 48 | --- !u!114 &6256258173756994024 49 | MonoBehaviour: 50 | m_ObjectHideFlags: 0 51 | m_CorrespondingSourceObject: {fileID: 0} 52 | m_PrefabInstance: {fileID: 0} 53 | m_PrefabAsset: {fileID: 0} 54 | m_GameObject: {fileID: 2240215140838153184} 55 | m_Enabled: 1 56 | m_EditorHideFlags: 0 57 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 58 | m_Name: 59 | m_EditorClassIdentifier: 60 | m_Material: {fileID: 0} 61 | m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} 62 | m_RaycastTarget: 1 63 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 64 | m_Maskable: 1 65 | m_OnCullStateChanged: 66 | m_PersistentCalls: 67 | m_Calls: [] 68 | m_FontData: 69 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 70 | m_FontSize: 14 71 | m_FontStyle: 0 72 | m_BestFit: 0 73 | m_MinSize: 10 74 | m_MaxSize: 40 75 | m_Alignment: 3 76 | m_AlignByGeometry: 0 77 | m_RichText: 1 78 | m_HorizontalOverflow: 0 79 | m_VerticalOverflow: 0 80 | m_LineSpacing: 1 81 | m_Text: Menu Item 82 | --- !u!1 &5422732495145290498 83 | GameObject: 84 | m_ObjectHideFlags: 0 85 | m_CorrespondingSourceObject: {fileID: 0} 86 | m_PrefabInstance: {fileID: 0} 87 | m_PrefabAsset: {fileID: 0} 88 | serializedVersion: 6 89 | m_Component: 90 | - component: {fileID: 5127821461125531301} 91 | - component: {fileID: 1351197392164059180} 92 | - component: {fileID: 4935332736377774345} 93 | - component: {fileID: 7790209541180999948} 94 | - component: {fileID: 8674086734189024986} 95 | m_Layer: 0 96 | m_Name: ContextMenuItem 97 | m_TagString: Untagged 98 | m_Icon: {fileID: 0} 99 | m_NavMeshLayer: 0 100 | m_StaticEditorFlags: 0 101 | m_IsActive: 1 102 | --- !u!224 &5127821461125531301 103 | RectTransform: 104 | m_ObjectHideFlags: 0 105 | m_CorrespondingSourceObject: {fileID: 0} 106 | m_PrefabInstance: {fileID: 0} 107 | m_PrefabAsset: {fileID: 0} 108 | m_GameObject: {fileID: 5422732495145290498} 109 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 110 | m_LocalPosition: {x: 0, y: 0, z: 0} 111 | m_LocalScale: {x: 1, y: 1, z: 1} 112 | m_Children: 113 | - {fileID: 4517969560120726428} 114 | m_Father: {fileID: 0} 115 | m_RootOrder: 0 116 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 117 | m_AnchorMin: {x: 0, y: 1} 118 | m_AnchorMax: {x: 0, y: 1} 119 | m_AnchoredPosition: {x: 0, y: 0} 120 | m_SizeDelta: {x: 120, y: 32} 121 | m_Pivot: {x: 0.5, y: 0.5} 122 | --- !u!222 &1351197392164059180 123 | CanvasRenderer: 124 | m_ObjectHideFlags: 0 125 | m_CorrespondingSourceObject: {fileID: 0} 126 | m_PrefabInstance: {fileID: 0} 127 | m_PrefabAsset: {fileID: 0} 128 | m_GameObject: {fileID: 5422732495145290498} 129 | m_CullTransparentMesh: 0 130 | --- !u!114 &4935332736377774345 131 | MonoBehaviour: 132 | m_ObjectHideFlags: 0 133 | m_CorrespondingSourceObject: {fileID: 0} 134 | m_PrefabInstance: {fileID: 0} 135 | m_PrefabAsset: {fileID: 0} 136 | m_GameObject: {fileID: 5422732495145290498} 137 | m_Enabled: 1 138 | m_EditorHideFlags: 0 139 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 140 | m_Name: 141 | m_EditorClassIdentifier: 142 | m_Material: {fileID: 0} 143 | m_Color: {r: 1, g: 1, b: 1, a: 1} 144 | m_RaycastTarget: 1 145 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 146 | m_Maskable: 1 147 | m_OnCullStateChanged: 148 | m_PersistentCalls: 149 | m_Calls: [] 150 | m_Sprite: {fileID: 0} 151 | m_Type: 0 152 | m_PreserveAspect: 0 153 | m_FillCenter: 1 154 | m_FillMethod: 4 155 | m_FillAmount: 1 156 | m_FillClockwise: 1 157 | m_FillOrigin: 0 158 | m_UseSpriteMesh: 0 159 | m_PixelsPerUnitMultiplier: 1 160 | --- !u!114 &7790209541180999948 161 | MonoBehaviour: 162 | m_ObjectHideFlags: 0 163 | m_CorrespondingSourceObject: {fileID: 0} 164 | m_PrefabInstance: {fileID: 0} 165 | m_PrefabAsset: {fileID: 0} 166 | m_GameObject: {fileID: 5422732495145290498} 167 | m_Enabled: 1 168 | m_EditorHideFlags: 0 169 | m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} 170 | m_Name: 171 | m_EditorClassIdentifier: 172 | m_Padding: 173 | m_Left: 4 174 | m_Right: 4 175 | m_Top: 0 176 | m_Bottom: 0 177 | m_ChildAlignment: 0 178 | m_Spacing: 0 179 | m_ChildForceExpandWidth: 1 180 | m_ChildForceExpandHeight: 1 181 | m_ChildControlWidth: 1 182 | m_ChildControlHeight: 1 183 | m_ChildScaleWidth: 0 184 | m_ChildScaleHeight: 0 185 | m_ReverseArrangement: 0 186 | --- !u!114 &8674086734189024986 187 | MonoBehaviour: 188 | m_ObjectHideFlags: 0 189 | m_CorrespondingSourceObject: {fileID: 0} 190 | m_PrefabInstance: {fileID: 0} 191 | m_PrefabAsset: {fileID: 0} 192 | m_GameObject: {fileID: 5422732495145290498} 193 | m_Enabled: 1 194 | m_EditorHideFlags: 0 195 | m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} 196 | m_Name: 197 | m_EditorClassIdentifier: 198 | m_Navigation: 199 | m_Mode: 3 200 | m_SelectOnUp: {fileID: 0} 201 | m_SelectOnDown: {fileID: 0} 202 | m_SelectOnLeft: {fileID: 0} 203 | m_SelectOnRight: {fileID: 0} 204 | m_Transition: 1 205 | m_Colors: 206 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 207 | m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 208 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 209 | m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 210 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 211 | m_ColorMultiplier: 1 212 | m_FadeDuration: 0.1 213 | m_SpriteState: 214 | m_HighlightedSprite: {fileID: 0} 215 | m_PressedSprite: {fileID: 0} 216 | m_SelectedSprite: {fileID: 0} 217 | m_DisabledSprite: {fileID: 0} 218 | m_AnimationTriggers: 219 | m_NormalTrigger: Normal 220 | m_HighlightedTrigger: Highlighted 221 | m_PressedTrigger: Pressed 222 | m_SelectedTrigger: Selected 223 | m_DisabledTrigger: Disabled 224 | m_Interactable: 1 225 | m_TargetGraphic: {fileID: 4935332736377774345} 226 | m_OnClick: 227 | m_PersistentCalls: 228 | m_Calls: [] 229 | -------------------------------------------------------------------------------- /Context/ContextMenuItem.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08359f862eca3ca42972046bd2cdb5f2 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Context/ItemContextMenuButtonActivator.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | using MultiplayerARPG; 4 | 5 | namespace Context 6 | { 7 | public class ItemContextMenuButtonActivator : MonoBehaviour 8 | { 9 | public Button buttonEquip; 10 | public Button buttonUnEquip; 11 | public Button buttonUse; 12 | public Button buttonRefine; 13 | public Button buttonDismantle; 14 | public Button buttonRepair; 15 | public Button buttonSocketEnhance; 16 | public Button buttonSell; 17 | public Button buttonOffer; 18 | public Button buttonMoveToStorage; 19 | public Button buttonMoveFromStorage; 20 | public Button buttonDrop; 21 | private UICharacterItem ui; 22 | private void Start() 23 | { 24 | ui = GetComponent().item; 25 | ui.onSetEquippedData.AddListener(OnSetEquippedData); 26 | ui.onSetUnEquippedData.AddListener(OnSetUnEquippedData); 27 | ui.onSetUnEquippableData.AddListener(OnSetUnEquippableData); 28 | ui.onSetUsableData.AddListener(OnSetUsableData); 29 | ui.onSetStorageItemData.AddListener(OnSetStorageItemData); 30 | ui.onRefineItemDialogAppear.AddListener(OnRefineItemDialogAppear); 31 | ui.onRefineItemDialogDisappear.AddListener(OnRefineItemDialogDisappear); 32 | ui.onDismantleItemDialogAppear.AddListener(OnDismantleItemDialogAppear); 33 | ui.onDismantleItemDialogDisappear.AddListener(OnDismantleItemDialogDisappear); 34 | ui.onRepairItemDialogAppear.AddListener(OnRepairItemDialogAppear); 35 | ui.onRepairItemDialogDisappear.AddListener(OnRepairItemDialogDisappear); 36 | ui.onNpcSellItemDialogAppear.AddListener(OnNpcSellItemDialogAppear); 37 | ui.onNpcSellItemDialogDisappear.AddListener(OnNpcSellItemDialogDisappear); 38 | ui.onStorageDialogAppear.AddListener(OnStorageDialogAppear); 39 | ui.onStorageDialogDisappear.AddListener(OnStorageDialogDisappear); 40 | ui.onEnterDealingState.AddListener(OnEnterDealingState); 41 | ui.onExitDealingState.AddListener(OnExitDealingState); 42 | // Refresh UI data to applies events 43 | ui.ForceUpdate(); 44 | } 45 | 46 | public void DeactivateAllButtons() 47 | { 48 | if (buttonEquip) 49 | buttonEquip.gameObject.SetActive(false); 50 | if (buttonUnEquip) 51 | buttonUnEquip.gameObject.SetActive(false); 52 | if (buttonUse) 53 | buttonUse.gameObject.SetActive(false); 54 | if (buttonRefine) 55 | buttonRefine.gameObject.SetActive(false); 56 | if (buttonDismantle) 57 | buttonDismantle.gameObject.SetActive(false); 58 | if (buttonRepair) 59 | buttonRepair.gameObject.SetActive(false); 60 | if (buttonSocketEnhance) 61 | buttonSocketEnhance.gameObject.SetActive(false); 62 | if (buttonSell) 63 | buttonSell.gameObject.SetActive(false); 64 | if (buttonOffer) 65 | buttonOffer.gameObject.SetActive(false); 66 | if (buttonMoveToStorage) 67 | buttonMoveToStorage.gameObject.SetActive(false); 68 | if (buttonMoveFromStorage) 69 | buttonMoveFromStorage.gameObject.SetActive(false); 70 | if (buttonDrop) 71 | buttonDrop.gameObject.SetActive(false); 72 | } 73 | 74 | public void OnSetEquippedData() 75 | { 76 | DeactivateAllButtons(); 77 | if (buttonUnEquip) 78 | buttonUnEquip.gameObject.SetActive(true); 79 | if (buttonRefine) 80 | buttonRefine.gameObject.SetActive(GameInstance.Singleton.canRefineItemByPlayer); 81 | if (buttonRepair) 82 | buttonRepair.gameObject.SetActive(GameInstance.Singleton.canRepairItemByPlayer); 83 | if (buttonSocketEnhance) 84 | buttonSocketEnhance.gameObject.SetActive(true); 85 | } 86 | 87 | public void OnSetUnEquippedData() 88 | { 89 | DeactivateAllButtons(); 90 | if (buttonEquip) 91 | buttonEquip.gameObject.SetActive(true); 92 | if (buttonRefine) 93 | buttonRefine.gameObject.SetActive(GameInstance.Singleton.canRefineItemByPlayer); 94 | if (buttonDismantle) 95 | buttonDismantle.gameObject.SetActive(GameInstance.Singleton.canDismantleItemByPlayer && GameInstance.Singleton.dismantleFilter.Filter(ui.CharacterItem)); 96 | if (buttonRepair) 97 | buttonRepair.gameObject.SetActive(GameInstance.Singleton.canRepairItemByPlayer); 98 | if (buttonSocketEnhance) 99 | buttonSocketEnhance.gameObject.SetActive(true); 100 | if (buttonDrop) 101 | buttonDrop.gameObject.SetActive(true); 102 | } 103 | 104 | public void OnSetUnEquippableData() 105 | { 106 | DeactivateAllButtons(); 107 | if (buttonDismantle) 108 | buttonDismantle.gameObject.SetActive(GameInstance.Singleton.canDismantleItemByPlayer && GameInstance.Singleton.dismantleFilter.Filter(ui.CharacterItem)); 109 | if (buttonDrop) 110 | buttonDrop.gameObject.SetActive(true); 111 | } 112 | 113 | public void OnSetUsableData() 114 | { 115 | DeactivateAllButtons(); 116 | if (buttonUse) 117 | buttonUse.gameObject.SetActive(true); 118 | if (buttonDismantle) 119 | buttonDismantle.gameObject.SetActive(GameInstance.Singleton.canDismantleItemByPlayer && GameInstance.Singleton.dismantleFilter.Filter(ui.CharacterItem)); 120 | if (buttonDrop) 121 | buttonDrop.gameObject.SetActive(true); 122 | } 123 | 124 | public void OnSetStorageItemData() 125 | { 126 | DeactivateAllButtons(); 127 | if (buttonMoveFromStorage) 128 | buttonMoveFromStorage.gameObject.SetActive(true); 129 | } 130 | 131 | public void OnRefineItemDialogAppear() 132 | { 133 | if (GameInstance.Singleton.canRefineItemByPlayer) 134 | return; 135 | 136 | if (buttonRefine) 137 | buttonRefine.gameObject.SetActive(true); 138 | } 139 | 140 | public void OnRefineItemDialogDisappear() 141 | { 142 | if (GameInstance.Singleton.canRefineItemByPlayer) 143 | return; 144 | 145 | if (buttonRefine) 146 | buttonRefine.gameObject.SetActive(false); 147 | } 148 | 149 | public void OnDismantleItemDialogAppear() 150 | { 151 | if (GameInstance.Singleton.canDismantleItemByPlayer) 152 | return; 153 | 154 | if (buttonDismantle) 155 | buttonDismantle.gameObject.SetActive(GameInstance.Singleton.dismantleFilter.Filter(ui.CharacterItem)); 156 | } 157 | 158 | public void OnDismantleItemDialogDisappear() 159 | { 160 | if (GameInstance.Singleton.canDismantleItemByPlayer) 161 | return; 162 | 163 | if (buttonDismantle) 164 | buttonDismantle.gameObject.SetActive(false); 165 | } 166 | public void OnRepairItemDialogAppear() 167 | { 168 | if (GameInstance.Singleton.canRepairItemByPlayer) 169 | return; 170 | 171 | if (buttonRepair) 172 | buttonRepair.gameObject.SetActive(true); 173 | } 174 | 175 | public void OnRepairItemDialogDisappear() 176 | { 177 | if (GameInstance.Singleton.canRepairItemByPlayer) 178 | return; 179 | 180 | if (buttonRepair) 181 | buttonRepair.gameObject.SetActive(false); 182 | } 183 | 184 | public void OnNpcSellItemDialogAppear() 185 | { 186 | if (buttonSell) 187 | buttonSell.gameObject.SetActive(true); 188 | } 189 | 190 | public void OnNpcSellItemDialogDisappear() 191 | { 192 | if (buttonSell) 193 | buttonSell.gameObject.SetActive(false); 194 | } 195 | 196 | public void OnStorageDialogAppear() 197 | { 198 | if (buttonMoveToStorage) 199 | buttonMoveToStorage.gameObject.SetActive(true); 200 | } 201 | 202 | public void OnStorageDialogDisappear() 203 | { 204 | if (buttonMoveToStorage) 205 | buttonMoveToStorage.gameObject.SetActive(false); 206 | } 207 | 208 | public void OnEnterDealingState() 209 | { 210 | if (buttonOffer) 211 | buttonOffer.gameObject.SetActive(true); 212 | } 213 | 214 | public void OnExitDealingState() 215 | { 216 | if (buttonOffer) 217 | buttonOffer.gameObject.SetActive(false); 218 | } 219 | } 220 | } 221 | -------------------------------------------------------------------------------- /Context/ItemContextMenuButtonActivator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1300555c4bb513142ad55821dfc3073a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Context/Menus.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 654a16250f1cb57419563c22a311f138 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Context/Menus/ItemContextMenu.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using MultiplayerARPG; 4 | using UnityEngine; 5 | 6 | namespace Context 7 | { 8 | public class ItemContextMenu : MonoBehaviour 9 | { 10 | public UICharacterItem item; 11 | 12 | public void OnEquip() 13 | { 14 | item.OnClickEquip(); 15 | ContextConfig.Singleton.DestroyMenu(); 16 | } 17 | 18 | public void OnUnEquip() 19 | { 20 | item.OnClickUnEquip(); 21 | ContextConfig.Singleton.DestroyMenu(); 22 | } 23 | 24 | public void OnUse() 25 | { 26 | item.OnClickUse(); 27 | ContextConfig.Singleton.DestroyMenu(); 28 | } 29 | 30 | public void OnDrop() 31 | { 32 | item.OnClickDrop(); 33 | ContextConfig.Singleton.DestroyMenu(); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Context/Menus/ItemContextMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b378be0b67232fc4681d34b6abeaa68b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Context/Menus/ItemContextMenu.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae477e76e46979543b24e2407a634357 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Context/Menus/Menus.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e36bf516913aa6547bd7952de35372a0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Context/Menus/Menus/TightenedUISceneGameplay.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace MultiplayerARPG 6 | { 7 | public class TightenedUISceneGameplay : UISceneGameplay 8 | { 9 | 10 | protected override void Update() 11 | { 12 | if (GenericUtils.IsFocusInputField()) 13 | return; 14 | 15 | UpdateToggles(); 16 | base.Update(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Context/Menus/Menus/TightenedUISceneGameplay.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 487b457b4fb9e544e8803c33c3b84496 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Context/Menus/Menus/UIOrdering.cs: -------------------------------------------------------------------------------- 1 | using MultiplayerARPG; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | public class UIOrdering : MonoBehaviour 7 | { 8 | public bool shouldAffectOrdering = true; 9 | public bool canBeClosedByEscape = true; 10 | public List closePeersOnEscape = new List(); 11 | [Tooltip("It will toggle `ui` when key with `keyCode` pressed or button with `buttonName` pressed.")] 12 | public KeyCode keyCode; 13 | [Tooltip("It will toggle `ui` when key with `keyCode` pressed or button with `buttonName` pressed.")] 14 | public string buttonName; 15 | 16 | [Tooltip("indicator for performing behaviors when certain elements are shown or hidden")] 17 | public string uiType; 18 | 19 | 20 | protected UISceneGameplay mainUi; 21 | 22 | 23 | protected UISceneGameplay MainUi 24 | { 25 | get 26 | { 27 | if (mainUi == null) 28 | mainUi = GetComponentInParent(); 29 | return mainUi; 30 | } 31 | } 32 | 33 | public void Show() 34 | { 35 | Debug.Log("Show!"); 36 | UIBase uiBase = GetComponent(); 37 | if (uiBase != null) 38 | uiBase.Show(); 39 | else 40 | gameObject.SetActive(true); 41 | } 42 | 43 | public void Hide() 44 | { 45 | Debug.Log("Hide!"); 46 | UIBase uiBase = GetComponent(); 47 | if (uiBase != null) 48 | uiBase.Hide(); 49 | else 50 | gameObject.SetActive(false); 51 | if (MainUi.orderedUIs.Contains(this)) 52 | MainUi.orderedUIs.Remove(this); 53 | } 54 | 55 | public void Toggle() 56 | { 57 | if (IsVisible()) 58 | Hide(); 59 | else 60 | Show(); 61 | } 62 | 63 | public bool IsVisible() 64 | { 65 | UIBase uiBase = GetComponent(); 66 | if (uiBase != null) 67 | return uiBase.IsVisible(); 68 | return gameObject.activeInHierarchy; 69 | } 70 | 71 | public void UpdateInput() 72 | { 73 | 74 | if (Input.GetKeyDown(keyCode) || InputManager.GetButtonDown(buttonName)) 75 | { 76 | Debug.Log(gameObject.name + "Toggle!"); 77 | Toggle(); 78 | } 79 | if (shouldAffectOrdering) 80 | { 81 | if (MainUi.orderedUIs.Contains(this) && !IsVisible()) 82 | { 83 | MainUi.orderedUIs.Remove(this); 84 | foreach (UIOrdering peer in closePeersOnEscape) 85 | { 86 | peer.Hide(); 87 | } 88 | } 89 | if (!MainUi.orderedUIs.Contains(this) && IsVisible()) 90 | { 91 | MainUi.orderedUIs.Add(this); 92 | } 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Context/Menus/Menus/UIOrdering.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd5cb73f07693a44abe3b840de09dc98 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Context/Menus/Menus/UISceneGameplay_ExitMenus.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEngine; 5 | 6 | namespace MultiplayerARPG 7 | { 8 | public partial class UISceneGameplay : BaseUISceneGameplay 9 | { 10 | public UIOrdering uiSystemDialog; 11 | [HideInInspector] public List orderedUIs = new List(); 12 | 13 | 14 | protected UIOrdering[] uis; 15 | UIOrdering[] Uis 16 | { 17 | get 18 | { 19 | if (uis == null) 20 | uis = GetComponentsInChildren(true); 21 | return uis; 22 | } 23 | } 24 | 25 | 26 | protected PlayerCharacterController controller; 27 | 28 | PlayerCharacterController Controller 29 | { 30 | get 31 | { 32 | if (controller == null) 33 | controller = BasePlayerCharacterController.Singleton as PlayerCharacterController; 34 | return controller; 35 | } 36 | } 37 | 38 | protected virtual void UpdateToggles() 39 | { 40 | if (Input.GetKeyDown(KeyCode.Escape) && orderedUIs.Count > 0) 41 | { 42 | UIOrdering lastUi = orderedUIs.Last(); 43 | lastUi.Hide(); 44 | foreach (UIOrdering peer in lastUi.closePeersOnEscape) 45 | { 46 | peer.Hide(); 47 | } 48 | } 49 | else if (Input.GetKeyDown(KeyCode.Escape) && Controller.Targeting.SelectedTarget == null && Controller.Targeting.PotentialTarget == null) 50 | { 51 | uiSystemDialog.Show(); 52 | } 53 | Controller.uisOpen = orderedUIs.Count > 0; 54 | foreach (UIOrdering ui in Uis) 55 | { 56 | ui.UpdateInput(); 57 | } 58 | 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Context/Menus/Menus/UISceneGameplay_ExitMenus.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ccb1cf826a92584ba818faf65bac8b6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Context/Menus/MonsterContextMenu.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using MultiplayerARPG; 4 | using UnityEngine; 5 | 6 | namespace Context 7 | { 8 | public class MonsterContextMenu : MonoBehaviour 9 | { 10 | public MonsterCharacterEntity monster; 11 | } 12 | } -------------------------------------------------------------------------------- /Context/Menus/MonsterContextMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ec8ab24afb82af41877204751778380 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Context/Menus/MonsterContextMenu.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &7695848836863154118 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 8446470238662676943} 12 | - component: {fileID: 6858250339820927283} 13 | - component: {fileID: 3655471931510005209} 14 | - component: {fileID: 1474635349031888321} 15 | - component: {fileID: 8500910161506535441} 16 | - component: {fileID: 224252202087384574} 17 | - component: {fileID: 7175980281585290450} 18 | m_Layer: 5 19 | m_Name: MonsterContextMenu 20 | m_TagString: Untagged 21 | m_Icon: {fileID: 0} 22 | m_NavMeshLayer: 0 23 | m_StaticEditorFlags: 0 24 | m_IsActive: 1 25 | --- !u!224 &8446470238662676943 26 | RectTransform: 27 | m_ObjectHideFlags: 0 28 | m_CorrespondingSourceObject: {fileID: 0} 29 | m_PrefabInstance: {fileID: 0} 30 | m_PrefabAsset: {fileID: 0} 31 | m_GameObject: {fileID: 7695848836863154118} 32 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 33 | m_LocalPosition: {x: 0, y: 0, z: 0} 34 | m_LocalScale: {x: 1, y: 1, z: 1} 35 | m_Children: 36 | - {fileID: 5958732606451578575} 37 | m_Father: {fileID: 0} 38 | m_RootOrder: 0 39 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 40 | m_AnchorMin: {x: 0.5, y: 0.5} 41 | m_AnchorMax: {x: 0.5, y: 0.5} 42 | m_AnchoredPosition: {x: 0, y: 0} 43 | m_SizeDelta: {x: 0, y: 0} 44 | m_Pivot: {x: 0.5, y: 0.5} 45 | --- !u!114 &6858250339820927283 46 | MonoBehaviour: 47 | m_ObjectHideFlags: 0 48 | m_CorrespondingSourceObject: {fileID: 0} 49 | m_PrefabInstance: {fileID: 0} 50 | m_PrefabAsset: {fileID: 0} 51 | m_GameObject: {fileID: 7695848836863154118} 52 | m_Enabled: 1 53 | m_EditorHideFlags: 0 54 | m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} 55 | m_Name: 56 | m_EditorClassIdentifier: 57 | m_Padding: 58 | m_Left: 0 59 | m_Right: 0 60 | m_Top: 0 61 | m_Bottom: 0 62 | m_ChildAlignment: 0 63 | m_Spacing: 0 64 | m_ChildForceExpandWidth: 1 65 | m_ChildForceExpandHeight: 1 66 | m_ChildControlWidth: 1 67 | m_ChildControlHeight: 0 68 | m_ChildScaleWidth: 0 69 | m_ChildScaleHeight: 0 70 | m_ReverseArrangement: 0 71 | --- !u!114 &3655471931510005209 72 | MonoBehaviour: 73 | m_ObjectHideFlags: 0 74 | m_CorrespondingSourceObject: {fileID: 0} 75 | m_PrefabInstance: {fileID: 0} 76 | m_PrefabAsset: {fileID: 0} 77 | m_GameObject: {fileID: 7695848836863154118} 78 | m_Enabled: 1 79 | m_EditorHideFlags: 0 80 | m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} 81 | m_Name: 82 | m_EditorClassIdentifier: 83 | m_HorizontalFit: 2 84 | m_VerticalFit: 2 85 | --- !u!222 &1474635349031888321 86 | CanvasRenderer: 87 | m_ObjectHideFlags: 0 88 | m_CorrespondingSourceObject: {fileID: 0} 89 | m_PrefabInstance: {fileID: 0} 90 | m_PrefabAsset: {fileID: 0} 91 | m_GameObject: {fileID: 7695848836863154118} 92 | m_CullTransparentMesh: 0 93 | --- !u!114 &8500910161506535441 94 | MonoBehaviour: 95 | m_ObjectHideFlags: 0 96 | m_CorrespondingSourceObject: {fileID: 0} 97 | m_PrefabInstance: {fileID: 0} 98 | m_PrefabAsset: {fileID: 0} 99 | m_GameObject: {fileID: 7695848836863154118} 100 | m_Enabled: 1 101 | m_EditorHideFlags: 0 102 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 103 | m_Name: 104 | m_EditorClassIdentifier: 105 | m_Material: {fileID: 0} 106 | m_Color: {r: 1, g: 1, b: 1, a: 1} 107 | m_RaycastTarget: 1 108 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 109 | m_Maskable: 1 110 | m_OnCullStateChanged: 111 | m_PersistentCalls: 112 | m_Calls: [] 113 | m_Sprite: {fileID: 0} 114 | m_Type: 0 115 | m_PreserveAspect: 0 116 | m_FillCenter: 1 117 | m_FillMethod: 4 118 | m_FillAmount: 1 119 | m_FillClockwise: 1 120 | m_FillOrigin: 0 121 | m_UseSpriteMesh: 0 122 | m_PixelsPerUnitMultiplier: 1 123 | --- !u!114 &224252202087384574 124 | MonoBehaviour: 125 | m_ObjectHideFlags: 0 126 | m_CorrespondingSourceObject: {fileID: 0} 127 | m_PrefabInstance: {fileID: 0} 128 | m_PrefabAsset: {fileID: 0} 129 | m_GameObject: {fileID: 7695848836863154118} 130 | m_Enabled: 1 131 | m_EditorHideFlags: 0 132 | m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} 133 | m_Name: 134 | m_EditorClassIdentifier: 135 | m_IgnoreLayout: 0 136 | m_MinWidth: 120 137 | m_MinHeight: -1 138 | m_PreferredWidth: -1 139 | m_PreferredHeight: -1 140 | m_FlexibleWidth: -1 141 | m_FlexibleHeight: -1 142 | m_LayoutPriority: 1 143 | --- !u!114 &7175980281585290450 144 | MonoBehaviour: 145 | m_ObjectHideFlags: 0 146 | m_CorrespondingSourceObject: {fileID: 0} 147 | m_PrefabInstance: {fileID: 0} 148 | m_PrefabAsset: {fileID: 0} 149 | m_GameObject: {fileID: 7695848836863154118} 150 | m_Enabled: 1 151 | m_EditorHideFlags: 0 152 | m_Script: {fileID: 11500000, guid: 8ec8ab24afb82af41877204751778380, type: 3} 153 | m_Name: 154 | m_EditorClassIdentifier: 155 | monster: {fileID: 0} 156 | --- !u!1001 &1556000059099082858 157 | PrefabInstance: 158 | m_ObjectHideFlags: 0 159 | serializedVersion: 2 160 | m_Modification: 161 | m_TransformParent: {fileID: 8446470238662676943} 162 | m_Modifications: 163 | - target: {fileID: 4517969560120726428, guid: 08359f862eca3ca42972046bd2cdb5f2, 164 | type: 3} 165 | propertyPath: m_AnchorMin.y 166 | value: 0 167 | objectReference: {fileID: 0} 168 | - target: {fileID: 4517969560120726428, guid: 08359f862eca3ca42972046bd2cdb5f2, 169 | type: 3} 170 | propertyPath: m_AnchorMax.y 171 | value: 0 172 | objectReference: {fileID: 0} 173 | - target: {fileID: 4517969560120726428, guid: 08359f862eca3ca42972046bd2cdb5f2, 174 | type: 3} 175 | propertyPath: m_AnchoredPosition.x 176 | value: 0 177 | objectReference: {fileID: 0} 178 | - target: {fileID: 4517969560120726428, guid: 08359f862eca3ca42972046bd2cdb5f2, 179 | type: 3} 180 | propertyPath: m_AnchoredPosition.y 181 | value: 0 182 | objectReference: {fileID: 0} 183 | - target: {fileID: 4517969560120726428, guid: 08359f862eca3ca42972046bd2cdb5f2, 184 | type: 3} 185 | propertyPath: m_SizeDelta.x 186 | value: 0 187 | objectReference: {fileID: 0} 188 | - target: {fileID: 4517969560120726428, guid: 08359f862eca3ca42972046bd2cdb5f2, 189 | type: 3} 190 | propertyPath: m_SizeDelta.y 191 | value: 0 192 | objectReference: {fileID: 0} 193 | - target: {fileID: 4946559951719831807, guid: 08359f862eca3ca42972046bd2cdb5f2, 194 | type: 3} 195 | propertyPath: id 196 | value: equip 197 | objectReference: {fileID: 0} 198 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 199 | type: 3} 200 | propertyPath: m_LocalPosition.x 201 | value: 0 202 | objectReference: {fileID: 0} 203 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 204 | type: 3} 205 | propertyPath: m_LocalPosition.y 206 | value: 0 207 | objectReference: {fileID: 0} 208 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 209 | type: 3} 210 | propertyPath: m_LocalPosition.z 211 | value: 0 212 | objectReference: {fileID: 0} 213 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 214 | type: 3} 215 | propertyPath: m_LocalRotation.x 216 | value: -0 217 | objectReference: {fileID: 0} 218 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 219 | type: 3} 220 | propertyPath: m_LocalRotation.y 221 | value: -0 222 | objectReference: {fileID: 0} 223 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 224 | type: 3} 225 | propertyPath: m_LocalRotation.z 226 | value: -0 227 | objectReference: {fileID: 0} 228 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 229 | type: 3} 230 | propertyPath: m_LocalRotation.w 231 | value: 1 232 | objectReference: {fileID: 0} 233 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 234 | type: 3} 235 | propertyPath: m_RootOrder 236 | value: 0 237 | objectReference: {fileID: 0} 238 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 239 | type: 3} 240 | propertyPath: m_LocalEulerAnglesHint.x 241 | value: 0 242 | objectReference: {fileID: 0} 243 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 244 | type: 3} 245 | propertyPath: m_LocalEulerAnglesHint.y 246 | value: 0 247 | objectReference: {fileID: 0} 248 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 249 | type: 3} 250 | propertyPath: m_LocalEulerAnglesHint.z 251 | value: 0 252 | objectReference: {fileID: 0} 253 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 254 | type: 3} 255 | propertyPath: m_AnchoredPosition.x 256 | value: 0 257 | objectReference: {fileID: 0} 258 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 259 | type: 3} 260 | propertyPath: m_AnchoredPosition.y 261 | value: 0 262 | objectReference: {fileID: 0} 263 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 264 | type: 3} 265 | propertyPath: m_SizeDelta.x 266 | value: 0 267 | objectReference: {fileID: 0} 268 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 269 | type: 3} 270 | propertyPath: m_SizeDelta.y 271 | value: 32 272 | objectReference: {fileID: 0} 273 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 274 | type: 3} 275 | propertyPath: m_AnchorMin.x 276 | value: 0 277 | objectReference: {fileID: 0} 278 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 279 | type: 3} 280 | propertyPath: m_AnchorMin.y 281 | value: 0 282 | objectReference: {fileID: 0} 283 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 284 | type: 3} 285 | propertyPath: m_AnchorMax.x 286 | value: 0 287 | objectReference: {fileID: 0} 288 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 289 | type: 3} 290 | propertyPath: m_AnchorMax.y 291 | value: 0 292 | objectReference: {fileID: 0} 293 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 294 | type: 3} 295 | propertyPath: m_Pivot.x 296 | value: 0.5 297 | objectReference: {fileID: 0} 298 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 299 | type: 3} 300 | propertyPath: m_Pivot.y 301 | value: 0.5 302 | objectReference: {fileID: 0} 303 | - target: {fileID: 5422732495145290498, guid: 08359f862eca3ca42972046bd2cdb5f2, 304 | type: 3} 305 | propertyPath: m_Name 306 | value: ContextMenuItem 307 | objectReference: {fileID: 0} 308 | - target: {fileID: 6256258173756994024, guid: 08359f862eca3ca42972046bd2cdb5f2, 309 | type: 3} 310 | propertyPath: m_Text 311 | value: Attack 312 | objectReference: {fileID: 0} 313 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 314 | type: 3} 315 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size 316 | value: 0 317 | objectReference: {fileID: 0} 318 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 319 | type: 3} 320 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode 321 | value: 1 322 | objectReference: {fileID: 0} 323 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 324 | type: 3} 325 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState 326 | value: 2 327 | objectReference: {fileID: 0} 328 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 329 | type: 3} 330 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target 331 | value: 332 | objectReference: {fileID: 0} 333 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 334 | type: 3} 335 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName 336 | value: Context.ItemContextMenu, Assembly-CSharp 337 | objectReference: {fileID: 0} 338 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 339 | type: 3} 340 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName 341 | value: OnEquip 342 | objectReference: {fileID: 0} 343 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 344 | type: 3} 345 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName 346 | value: UnityEngine.Object, UnityEngine 347 | objectReference: {fileID: 0} 348 | m_RemovedComponents: 349 | - {fileID: 4946559951719831807, guid: 08359f862eca3ca42972046bd2cdb5f2, type: 3} 350 | m_SourcePrefab: {fileID: 100100000, guid: 08359f862eca3ca42972046bd2cdb5f2, type: 3} 351 | --- !u!224 &5958732606451578575 stripped 352 | RectTransform: 353 | m_CorrespondingSourceObject: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 354 | type: 3} 355 | m_PrefabInstance: {fileID: 1556000059099082858} 356 | m_PrefabAsset: {fileID: 0} 357 | -------------------------------------------------------------------------------- /Context/Menus/MonsterContextMenu.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4443004dca14d0045801e97420d5fb73 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Context/Menus/NPCContextMenu.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using MultiplayerARPG; 4 | using UnityEngine; 5 | 6 | namespace Context 7 | { 8 | public class NPCContextMenu : MonoBehaviour 9 | { 10 | public NpcEntity npc; 11 | } 12 | } -------------------------------------------------------------------------------- /Context/Menus/NPCContextMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea0988c74baa83d45a59b2aecd6c84bb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Context/Menus/NPCContextMenu.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 73f1b7bfc5822ad4a92358291332f9d3 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Context/Menus/PlayerContextMenu.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using MultiplayerARPG; 4 | using UnityEngine; 5 | 6 | namespace Context 7 | { 8 | public class PlayerContextMenu : MonoBehaviour 9 | { 10 | public PlayerCharacterEntity player; 11 | } 12 | } -------------------------------------------------------------------------------- /Context/Menus/PlayerContextMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 87a456e587cf1d340872f7d69ca5b6ad 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Context/Menus/PlayerContextMenu.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 00e9d98b51024ee4db21492a14a8c073 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Context/Menus/SkillContextMenu.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using MultiplayerARPG; 4 | using UnityEngine; 5 | 6 | namespace Context 7 | { 8 | public class SkillContextMenu : MonoBehaviour 9 | { 10 | public UICharacterSkill skill; 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /Context/Menus/SkillContextMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba097c60379e9254fb99641e7ea2c996 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Context/Menus/SkillContextMenu.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &7695848836863154118 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 8446470238662676943} 12 | - component: {fileID: 6858250339820927283} 13 | - component: {fileID: 3655471931510005209} 14 | - component: {fileID: 1474635349031888321} 15 | - component: {fileID: 8500910161506535441} 16 | - component: {fileID: 224252202087384574} 17 | - component: {fileID: 124063479975248673} 18 | m_Layer: 5 19 | m_Name: SkillContextMenu 20 | m_TagString: Untagged 21 | m_Icon: {fileID: 0} 22 | m_NavMeshLayer: 0 23 | m_StaticEditorFlags: 0 24 | m_IsActive: 1 25 | --- !u!224 &8446470238662676943 26 | RectTransform: 27 | m_ObjectHideFlags: 0 28 | m_CorrespondingSourceObject: {fileID: 0} 29 | m_PrefabInstance: {fileID: 0} 30 | m_PrefabAsset: {fileID: 0} 31 | m_GameObject: {fileID: 7695848836863154118} 32 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 33 | m_LocalPosition: {x: 0, y: 0, z: 0} 34 | m_LocalScale: {x: 1, y: 1, z: 1} 35 | m_Children: 36 | - {fileID: 5958732606451578575} 37 | m_Father: {fileID: 0} 38 | m_RootOrder: 0 39 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 40 | m_AnchorMin: {x: 0.5, y: 0.5} 41 | m_AnchorMax: {x: 0.5, y: 0.5} 42 | m_AnchoredPosition: {x: 0, y: 0} 43 | m_SizeDelta: {x: 0, y: 0} 44 | m_Pivot: {x: 0.5, y: 0.5} 45 | --- !u!114 &6858250339820927283 46 | MonoBehaviour: 47 | m_ObjectHideFlags: 0 48 | m_CorrespondingSourceObject: {fileID: 0} 49 | m_PrefabInstance: {fileID: 0} 50 | m_PrefabAsset: {fileID: 0} 51 | m_GameObject: {fileID: 7695848836863154118} 52 | m_Enabled: 1 53 | m_EditorHideFlags: 0 54 | m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} 55 | m_Name: 56 | m_EditorClassIdentifier: 57 | m_Padding: 58 | m_Left: 0 59 | m_Right: 0 60 | m_Top: 0 61 | m_Bottom: 0 62 | m_ChildAlignment: 0 63 | m_Spacing: 0 64 | m_ChildForceExpandWidth: 1 65 | m_ChildForceExpandHeight: 1 66 | m_ChildControlWidth: 1 67 | m_ChildControlHeight: 0 68 | m_ChildScaleWidth: 0 69 | m_ChildScaleHeight: 0 70 | m_ReverseArrangement: 0 71 | --- !u!114 &3655471931510005209 72 | MonoBehaviour: 73 | m_ObjectHideFlags: 0 74 | m_CorrespondingSourceObject: {fileID: 0} 75 | m_PrefabInstance: {fileID: 0} 76 | m_PrefabAsset: {fileID: 0} 77 | m_GameObject: {fileID: 7695848836863154118} 78 | m_Enabled: 1 79 | m_EditorHideFlags: 0 80 | m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} 81 | m_Name: 82 | m_EditorClassIdentifier: 83 | m_HorizontalFit: 2 84 | m_VerticalFit: 2 85 | --- !u!222 &1474635349031888321 86 | CanvasRenderer: 87 | m_ObjectHideFlags: 0 88 | m_CorrespondingSourceObject: {fileID: 0} 89 | m_PrefabInstance: {fileID: 0} 90 | m_PrefabAsset: {fileID: 0} 91 | m_GameObject: {fileID: 7695848836863154118} 92 | m_CullTransparentMesh: 0 93 | --- !u!114 &8500910161506535441 94 | MonoBehaviour: 95 | m_ObjectHideFlags: 0 96 | m_CorrespondingSourceObject: {fileID: 0} 97 | m_PrefabInstance: {fileID: 0} 98 | m_PrefabAsset: {fileID: 0} 99 | m_GameObject: {fileID: 7695848836863154118} 100 | m_Enabled: 1 101 | m_EditorHideFlags: 0 102 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 103 | m_Name: 104 | m_EditorClassIdentifier: 105 | m_Material: {fileID: 0} 106 | m_Color: {r: 1, g: 1, b: 1, a: 1} 107 | m_RaycastTarget: 1 108 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 109 | m_Maskable: 1 110 | m_OnCullStateChanged: 111 | m_PersistentCalls: 112 | m_Calls: [] 113 | m_Sprite: {fileID: 0} 114 | m_Type: 0 115 | m_PreserveAspect: 0 116 | m_FillCenter: 1 117 | m_FillMethod: 4 118 | m_FillAmount: 1 119 | m_FillClockwise: 1 120 | m_FillOrigin: 0 121 | m_UseSpriteMesh: 0 122 | m_PixelsPerUnitMultiplier: 1 123 | --- !u!114 &224252202087384574 124 | MonoBehaviour: 125 | m_ObjectHideFlags: 0 126 | m_CorrespondingSourceObject: {fileID: 0} 127 | m_PrefabInstance: {fileID: 0} 128 | m_PrefabAsset: {fileID: 0} 129 | m_GameObject: {fileID: 7695848836863154118} 130 | m_Enabled: 1 131 | m_EditorHideFlags: 0 132 | m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} 133 | m_Name: 134 | m_EditorClassIdentifier: 135 | m_IgnoreLayout: 0 136 | m_MinWidth: 120 137 | m_MinHeight: -1 138 | m_PreferredWidth: -1 139 | m_PreferredHeight: -1 140 | m_FlexibleWidth: -1 141 | m_FlexibleHeight: -1 142 | m_LayoutPriority: 1 143 | --- !u!114 &124063479975248673 144 | MonoBehaviour: 145 | m_ObjectHideFlags: 0 146 | m_CorrespondingSourceObject: {fileID: 0} 147 | m_PrefabInstance: {fileID: 0} 148 | m_PrefabAsset: {fileID: 0} 149 | m_GameObject: {fileID: 7695848836863154118} 150 | m_Enabled: 1 151 | m_EditorHideFlags: 0 152 | m_Script: {fileID: 11500000, guid: ba097c60379e9254fb99641e7ea2c996, type: 3} 153 | m_Name: 154 | m_EditorClassIdentifier: 155 | skill: {fileID: 0} 156 | --- !u!1001 &1556000059099082858 157 | PrefabInstance: 158 | m_ObjectHideFlags: 0 159 | serializedVersion: 2 160 | m_Modification: 161 | m_TransformParent: {fileID: 8446470238662676943} 162 | m_Modifications: 163 | - target: {fileID: 4517969560120726428, guid: 08359f862eca3ca42972046bd2cdb5f2, 164 | type: 3} 165 | propertyPath: m_AnchorMin.y 166 | value: 0 167 | objectReference: {fileID: 0} 168 | - target: {fileID: 4517969560120726428, guid: 08359f862eca3ca42972046bd2cdb5f2, 169 | type: 3} 170 | propertyPath: m_AnchorMax.y 171 | value: 0 172 | objectReference: {fileID: 0} 173 | - target: {fileID: 4517969560120726428, guid: 08359f862eca3ca42972046bd2cdb5f2, 174 | type: 3} 175 | propertyPath: m_AnchoredPosition.x 176 | value: 0 177 | objectReference: {fileID: 0} 178 | - target: {fileID: 4517969560120726428, guid: 08359f862eca3ca42972046bd2cdb5f2, 179 | type: 3} 180 | propertyPath: m_AnchoredPosition.y 181 | value: 0 182 | objectReference: {fileID: 0} 183 | - target: {fileID: 4517969560120726428, guid: 08359f862eca3ca42972046bd2cdb5f2, 184 | type: 3} 185 | propertyPath: m_SizeDelta.x 186 | value: 0 187 | objectReference: {fileID: 0} 188 | - target: {fileID: 4517969560120726428, guid: 08359f862eca3ca42972046bd2cdb5f2, 189 | type: 3} 190 | propertyPath: m_SizeDelta.y 191 | value: 0 192 | objectReference: {fileID: 0} 193 | - target: {fileID: 4946559951719831807, guid: 08359f862eca3ca42972046bd2cdb5f2, 194 | type: 3} 195 | propertyPath: id 196 | value: equip 197 | objectReference: {fileID: 0} 198 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 199 | type: 3} 200 | propertyPath: m_LocalPosition.x 201 | value: 0 202 | objectReference: {fileID: 0} 203 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 204 | type: 3} 205 | propertyPath: m_LocalPosition.y 206 | value: 0 207 | objectReference: {fileID: 0} 208 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 209 | type: 3} 210 | propertyPath: m_LocalPosition.z 211 | value: 0 212 | objectReference: {fileID: 0} 213 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 214 | type: 3} 215 | propertyPath: m_LocalRotation.x 216 | value: -0 217 | objectReference: {fileID: 0} 218 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 219 | type: 3} 220 | propertyPath: m_LocalRotation.y 221 | value: -0 222 | objectReference: {fileID: 0} 223 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 224 | type: 3} 225 | propertyPath: m_LocalRotation.z 226 | value: -0 227 | objectReference: {fileID: 0} 228 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 229 | type: 3} 230 | propertyPath: m_LocalRotation.w 231 | value: 1 232 | objectReference: {fileID: 0} 233 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 234 | type: 3} 235 | propertyPath: m_RootOrder 236 | value: 0 237 | objectReference: {fileID: 0} 238 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 239 | type: 3} 240 | propertyPath: m_LocalEulerAnglesHint.x 241 | value: 0 242 | objectReference: {fileID: 0} 243 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 244 | type: 3} 245 | propertyPath: m_LocalEulerAnglesHint.y 246 | value: 0 247 | objectReference: {fileID: 0} 248 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 249 | type: 3} 250 | propertyPath: m_LocalEulerAnglesHint.z 251 | value: 0 252 | objectReference: {fileID: 0} 253 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 254 | type: 3} 255 | propertyPath: m_AnchoredPosition.x 256 | value: 0 257 | objectReference: {fileID: 0} 258 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 259 | type: 3} 260 | propertyPath: m_AnchoredPosition.y 261 | value: 0 262 | objectReference: {fileID: 0} 263 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 264 | type: 3} 265 | propertyPath: m_SizeDelta.x 266 | value: 0 267 | objectReference: {fileID: 0} 268 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 269 | type: 3} 270 | propertyPath: m_SizeDelta.y 271 | value: 32 272 | objectReference: {fileID: 0} 273 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 274 | type: 3} 275 | propertyPath: m_AnchorMin.x 276 | value: 0 277 | objectReference: {fileID: 0} 278 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 279 | type: 3} 280 | propertyPath: m_AnchorMin.y 281 | value: 0 282 | objectReference: {fileID: 0} 283 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 284 | type: 3} 285 | propertyPath: m_AnchorMax.x 286 | value: 0 287 | objectReference: {fileID: 0} 288 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 289 | type: 3} 290 | propertyPath: m_AnchorMax.y 291 | value: 0 292 | objectReference: {fileID: 0} 293 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 294 | type: 3} 295 | propertyPath: m_Pivot.x 296 | value: 0.5 297 | objectReference: {fileID: 0} 298 | - target: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 299 | type: 3} 300 | propertyPath: m_Pivot.y 301 | value: 0.5 302 | objectReference: {fileID: 0} 303 | - target: {fileID: 5422732495145290498, guid: 08359f862eca3ca42972046bd2cdb5f2, 304 | type: 3} 305 | propertyPath: m_Name 306 | value: ContextMenuItem 307 | objectReference: {fileID: 0} 308 | - target: {fileID: 6256258173756994024, guid: 08359f862eca3ca42972046bd2cdb5f2, 309 | type: 3} 310 | propertyPath: m_Text 311 | value: Attack 312 | objectReference: {fileID: 0} 313 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 314 | type: 3} 315 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size 316 | value: 0 317 | objectReference: {fileID: 0} 318 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 319 | type: 3} 320 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode 321 | value: 1 322 | objectReference: {fileID: 0} 323 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 324 | type: 3} 325 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState 326 | value: 2 327 | objectReference: {fileID: 0} 328 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 329 | type: 3} 330 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target 331 | value: 332 | objectReference: {fileID: 0} 333 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 334 | type: 3} 335 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName 336 | value: Context.ItemContextMenu, Assembly-CSharp 337 | objectReference: {fileID: 0} 338 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 339 | type: 3} 340 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName 341 | value: OnEquip 342 | objectReference: {fileID: 0} 343 | - target: {fileID: 8674086734189024986, guid: 08359f862eca3ca42972046bd2cdb5f2, 344 | type: 3} 345 | propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName 346 | value: UnityEngine.Object, UnityEngine 347 | objectReference: {fileID: 0} 348 | m_RemovedComponents: 349 | - {fileID: 4946559951719831807, guid: 08359f862eca3ca42972046bd2cdb5f2, type: 3} 350 | m_SourcePrefab: {fileID: 100100000, guid: 08359f862eca3ca42972046bd2cdb5f2, type: 3} 351 | --- !u!224 &5958732606451578575 stripped 352 | RectTransform: 353 | m_CorrespondingSourceObject: {fileID: 5127821461125531301, guid: 08359f862eca3ca42972046bd2cdb5f2, 354 | type: 3} 355 | m_PrefabInstance: {fileID: 1556000059099082858} 356 | m_PrefabAsset: {fileID: 0} 357 | -------------------------------------------------------------------------------- /Context/Menus/SkillContextMenu.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e8788d9dde596d43bf84c18d80942d0 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Context/UIContextMenu.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using MultiplayerARPG; 4 | using UnityEngine; 5 | using UnityEngine.EventSystems; 6 | 7 | namespace Context 8 | { 9 | public class UIContextMenu : MonoBehaviour, IPointerUpHandler 10 | { 11 | 12 | public MonsterCharacterEntity monster; 13 | public NpcEntity npc; 14 | public PlayerCharacterEntity player; 15 | public UICharacterItem uiCharacterItem; 16 | public UICharacterSkill uiCharacterSkill; 17 | 18 | public ItemContextMenu itemMenu; 19 | public SkillContextMenu skillMenu; 20 | public PlayerContextMenu playerMenu; 21 | public NPCContextMenu npcMenu; 22 | public MonsterContextMenu monsterMenu; 23 | 24 | // Update is called once per frame 25 | 26 | 27 | public void OnPointerUp(PointerEventData eventData) 28 | { 29 | if (Input.GetMouseButtonUp(1)) 30 | OpenMenu(); 31 | } 32 | public void OnMouseOver() 33 | { 34 | if (Input.GetMouseButtonUp(1)) 35 | OpenMenu(); 36 | } 37 | 38 | void OpenMenu() 39 | { 40 | if (itemMenu != null && uiCharacterItem != null) 41 | { 42 | ItemContextMenu menu = Instantiate(itemMenu); 43 | menu.item = uiCharacterItem; 44 | ContextConfig.Singleton.CreateMenu(menu.gameObject); 45 | } 46 | 47 | if (skillMenu != null && uiCharacterSkill != null) 48 | { 49 | SkillContextMenu menu = Instantiate(skillMenu); 50 | menu.skill = uiCharacterSkill; 51 | ContextConfig.Singleton.CreateMenu(menu.gameObject); 52 | } 53 | 54 | if (playerMenu != null && player != null) 55 | { 56 | PlayerContextMenu menu = Instantiate(playerMenu); 57 | menu.player = player; 58 | ContextConfig.Singleton.CreateMenu(menu.gameObject); 59 | } 60 | 61 | if (npcMenu != null && npc != null) 62 | { 63 | NPCContextMenu menu = Instantiate(npcMenu); 64 | menu.npc = npc; 65 | ContextConfig.Singleton.CreateMenu(menu.gameObject); 66 | } 67 | 68 | if (monsterMenu != null && monster != null) 69 | { 70 | MonsterContextMenu menu = Instantiate(monsterMenu); 71 | menu.monster = monster; 72 | ContextConfig.Singleton.CreateMenu(menu.gameObject); 73 | } 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /Context/UIContextMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4dfb07a786443b848ac3ddc68a76fc39 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /CustomGameMessage.cs: -------------------------------------------------------------------------------- 1 | using MultiplayerARPG; 2 | 3 | public class CustomGameMessage 4 | { 5 | public static GameMessage.Type NoCastingInSafeArea = (GameMessage.Type)82; 6 | } 7 | -------------------------------------------------------------------------------- /CustomGameMessage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41951547156c79f42a9782bb1f9ea074 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /FlexibleSpawners.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f42745cb9406a2f4b849cb681265db61 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /FlexibleSpawners/FlexibleHarvestableSpawnArea.cs: -------------------------------------------------------------------------------- 1 | using LiteNetLibManager; 2 | using MultiplayerARPG; 3 | using UnityEngine; 4 | 5 | namespace FlexibleSpawners 6 | { 7 | public class FlexibleHarvestableSpawnArea : HarvestableSpawnArea 8 | { 9 | private static readonly RaycastHit[] findGroundRaycastHits = new RaycastHit[FIND_GROUND_RAYCAST_HIT_SIZE]; 10 | 11 | public new Vector3 GetRandomPosition() 12 | { 13 | return SpawnerUtils.GetRandomPosition(transform, type, randomRadius, squareSizeX, squareSizeZ, squareGizmosHeight, findGroundRaycastHits, GroundLayerMask); 14 | } 15 | 16 | protected override void SpawnInternal() 17 | { 18 | float colliderDetectionRadius = asset.ColliderDetectionRadius; 19 | Vector3 spawnPosition = GetRandomPosition(); 20 | Quaternion spawnRotation = GetRandomRotation(); 21 | bool overlapEntities = false; 22 | Collider[] overlaps = Physics.OverlapSphere(spawnPosition, colliderDetectionRadius); 23 | foreach (Collider overlap in overlaps) 24 | { 25 | if (OverlapsEntities(overlap)) 26 | { 27 | overlapEntities = true; 28 | break; 29 | } 30 | } 31 | if (!overlapEntities) 32 | { 33 | GameObject spawnObj = Instantiate(asset.gameObject, spawnPosition, spawnRotation); 34 | HarvestableEntity entity = spawnObj.GetComponent(); 35 | entity.gameObject.SetActive(false); 36 | // This is the change from GROUND_DETECTION_DISTANCE to squareGizmosHeight 37 | if (entity.FindGroundedPosition(spawnPosition, squareGizmosHeight, out spawnPosition)) 38 | { 39 | entity.SetSpawnArea(this, spawnPosition); 40 | BaseGameNetworkManager.Singleton.Assets.NetworkSpawn(spawnObj); 41 | } 42 | else 43 | { 44 | // Destroy the entity (because it can't find ground position) 45 | Destroy(entity.gameObject); 46 | ++pending; 47 | Logging.LogWarning(ToString(), "Cannot spawn harvestable, it cannot find grounded position, pending harvestable amount " + pending); 48 | } 49 | } 50 | else 51 | { 52 | ++pending; 53 | Logging.LogWarning(ToString(), "Cannot spawn harvestable, it is collided to another entities, pending harvestable amount " + pending); 54 | } 55 | } 56 | 57 | private bool OverlapsEntities(Collider overlap) 58 | { 59 | return overlap.gameObject.layer == CurrentGameInstance.characterLayer || 60 | overlap.gameObject.layer == CurrentGameInstance.itemDropLayer || 61 | overlap.gameObject.layer == CurrentGameInstance.buildingLayer || 62 | overlap.gameObject.layer == CurrentGameInstance.harvestableLayer; 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /FlexibleSpawners/FlexibleHarvestableSpawnArea.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 73ef9e4c73d929f4385754a9924e2653 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /FlexibleSpawners/FlexibleMonsterSpawnArea.cs: -------------------------------------------------------------------------------- 1 | using LiteNetLibManager; 2 | using MultiplayerARPG; 3 | using UnityEngine; 4 | 5 | namespace FlexibleSpawners 6 | { 7 | public class FlexibleMonsterSpawnArea : MonsterSpawnArea 8 | { 9 | private static readonly RaycastHit[] findGroundRaycastHits = new RaycastHit[FIND_GROUND_RAYCAST_HIT_SIZE]; 10 | 11 | public new Vector3 GetRandomPosition() 12 | { 13 | return SpawnerUtils.GetRandomPosition(transform, type, randomRadius, squareSizeX, squareSizeZ, squareGizmosHeight, findGroundRaycastHits, GroundLayerMask); 14 | } 15 | protected override void SpawnInternal() 16 | { 17 | Vector3 spawnPosition = GetRandomPosition(); 18 | Quaternion spawnRotation = GetRandomRotation(); 19 | GameObject spawnObj = Instantiate(asset.gameObject, spawnPosition, spawnRotation); 20 | BaseMonsterCharacterEntity entity = spawnObj.GetComponent(); 21 | entity.gameObject.SetActive(false); 22 | // This is the change from GROUND_DETECTION_DISTANCE to squareGizmosHeight 23 | if (FindGroundedPosition(entity, spawnPosition, out spawnPosition)) 24 | { 25 | entity.Level = level; 26 | entity.SetSpawnArea(this, spawnPosition); 27 | BaseGameNetworkManager.Singleton.Assets.NetworkSpawn(spawnObj); 28 | } 29 | else 30 | { 31 | // Destroy the entity (because it can't find ground position) 32 | Destroy(entity.gameObject); 33 | ++pending; 34 | Logging.LogWarning(ToString(), "Cannot spawn monster, it cannot find grounded position, pending monster amount " + pending); 35 | } 36 | } 37 | protected virtual bool FindGroundedPosition(BaseMonsterCharacterEntity entity, Vector3 spawnPosition, out Vector3 result) 38 | { 39 | return entity.FindGroundedPosition(spawnPosition, squareGizmosHeight, out result); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /FlexibleSpawners/FlexibleMonsterSpawnArea.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2209d611bfcc47742866747fdd7ca3f7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /FlexibleSpawners/SpawnerUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using MultiplayerARPG; 5 | 6 | namespace FlexibleSpawners 7 | { 8 | public static class SpawnerUtils 9 | { 10 | public static Vector3 GetRandomPosition(Transform transform, GameAreaType type, float randomRadius, float squareWidth, float squareDepth, float squareHeight, RaycastHit[] findGroundRaycastHits, int groundLayerMask) 11 | { 12 | Vector3 randomedPosition = transform.position; 13 | 14 | switch (type) 15 | { 16 | case GameAreaType.Radius: 17 | randomedPosition += new Vector3(Random.Range(-1f, 1f) * randomRadius, 0, Random.Range(-1f, 1f) * randomRadius); 18 | break; 19 | case GameAreaType.Square: 20 | randomedPosition += new Vector3(Random.Range(-0.5f, 0.5f) * squareWidth, 0, Random.Range(-0.5f, 0.5f) * squareDepth); 21 | break; 22 | } 23 | return PhysicUtils.FindGroundedPosition(randomedPosition, findGroundRaycastHits, squareHeight, groundLayerMask); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /FlexibleSpawners/SpawnerUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2e4a47dcc30636140aab63e3c9bbe725 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /OverheadUI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: facaf6c56bf62af48bafcd7e18ac06a0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /OverheadUI/GameInstance_HarvestableUI.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace MultiplayerARPG 6 | { 7 | public partial class GameInstance : MonoBehaviour 8 | { 9 | [Header("Gameplay Objects")] 10 | [Tooltip("This UI will be instaniate as Harvestable's child to show the harvestable name")] 11 | public UIHarvestableEntity harvestableUI; 12 | } 13 | } -------------------------------------------------------------------------------- /OverheadUI/GameInstance_HarvestableUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7043b506562ef1741a2c2bcae4aa1eac 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /OverheadUI/HarvestableEntityWithUI.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace MultiplayerARPG 6 | { 7 | public class HarvestableEntityWithUI : HarvestableEntity 8 | { 9 | [Header("Relates Element Containers")] 10 | public Transform uiElementTransform; 11 | private UIHarvestableEntity uiHarvestableEntity; 12 | public Transform UIElementTransform 13 | { 14 | get 15 | { 16 | if (uiElementTransform == null) 17 | uiElementTransform = CacheTransform; 18 | return uiElementTransform; 19 | } 20 | } 21 | public override void OnSetup() 22 | { 23 | base.OnSetup(); 24 | if (CurrentGameInstance.harvestableUI != null) 25 | InstantiateUI(CurrentGameInstance.harvestableUI); 26 | } 27 | 28 | public void InstantiateUI(UIHarvestableEntity prefab) 29 | { 30 | if (prefab == null) 31 | return; 32 | if (uiHarvestableEntity != null) 33 | Destroy(uiHarvestableEntity.gameObject); 34 | uiHarvestableEntity = Instantiate(prefab, UIElementTransform); 35 | uiHarvestableEntity.transform.localPosition = Vector3.zero; 36 | uiHarvestableEntity.Data = this; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /OverheadUI/HarvestableEntityWithUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8279947ef937ef46b0d3255239ebf6e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /OverheadUI/OverheadHPToggle.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | namespace OverheadUI 7 | { 8 | public class OverheadHPToggle : MonoBehaviour 9 | { 10 | public GameObject hpContainer; 11 | public GameObject hpGauge; 12 | 13 | void FixedUpdate() 14 | { 15 | hpContainer.SetActive(hpGauge.GetComponent().fillAmount < 1); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /OverheadUI/OverheadHPToggle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 75353ea42abaeac4c91a9e92b7e31ed8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /OverheadUI/OverheadScaler.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace OverheadUI 4 | { 5 | public class OverheadScaler : MonoBehaviour 6 | { 7 | public float scale = 0.015f; 8 | private Vector3 lossyScale; 9 | private float verticalOffset = 0.1f; 10 | 11 | void Awake() 12 | { 13 | lossyScale = transform.lossyScale; 14 | Resize(1); 15 | } 16 | 17 | void FixedUpdate() 18 | { 19 | float distanceFromCamera = Camera.main ? Vector3.Distance(Camera.main.transform.position, transform.position) / 10 : 1; 20 | Resize(distanceFromCamera < 0 ? 1 : distanceFromCamera); 21 | } 22 | void Resize(float distance) 23 | { 24 | transform.localScale = new Vector3( 25 | scale / lossyScale.x * distance, 26 | scale / lossyScale.y * distance, 27 | scale / lossyScale.z 28 | ); 29 | transform.localPosition = new Vector3(0, verticalOffset, 0); 30 | } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /OverheadUI/OverheadScaler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b7a8b4663e848b44888dc4b2b642940a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /OverheadUI/OverheadTargetToggle.cs: -------------------------------------------------------------------------------- 1 | using MultiplayerARPG; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | namespace OverheadUI 7 | { 8 | public class OverheadTargetToggle : MonoBehaviour 9 | { 10 | public UICharacterEntity character; 11 | public UINpcEntity npc; 12 | public UIHarvestableEntity harvestable; 13 | public GameObject targetIndicator; 14 | public GameObject subTargetIndicator; 15 | public string targetedLayer = "TargetedUI"; 16 | public string defaultLayer = "CharacterUI"; 17 | 18 | void OnGUI() 19 | { 20 | PlayerCharacterController controller = BasePlayerCharacterController.Singleton as PlayerCharacterController; 21 | if (controller) 22 | { 23 | BaseGameEntity target = controller.Targeting?.SelectedTarget != null ? controller.Targeting.SelectedTarget.GetComponent() : null; 24 | BaseGameEntity subTarget = controller.subTarget; 25 | if (character) 26 | { 27 | subTargetIndicator.SetActive(subTarget != null && subTarget.ObjectId == character.Data.ObjectId); 28 | targetIndicator.SetActive(target != null && target.ObjectId == character.Data.ObjectId); 29 | } 30 | if (npc) 31 | { 32 | subTargetIndicator.SetActive(subTarget != null && subTarget.ObjectId == npc.Data.ObjectId); 33 | targetIndicator.SetActive(target != null && target.ObjectId == npc.Data.ObjectId); 34 | } 35 | if (harvestable) 36 | { 37 | subTargetIndicator.SetActive(subTarget != null && subTarget.ObjectId == harvestable.Data.ObjectId); 38 | targetIndicator.SetActive(target != null && target.ObjectId == harvestable.Data.ObjectId); 39 | } 40 | gameObject.layer = LayerMask.NameToLayer(targetIndicator.activeSelf || subTargetIndicator.activeSelf ? targetedLayer : defaultLayer); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /OverheadUI/OverheadTargetToggle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 252375e08ef6db8439b227c368b22696 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /OverheadUI/OverheadUI.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 982b7c76a3cce6b4fbbefbc505954af1 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /OverheadUI/PlayerCharacterController_SubTarget.cs: -------------------------------------------------------------------------------- 1 | using MultiplayerARPG; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | namespace MultiplayerARPG 7 | { 8 | public partial class PlayerCharacterController 9 | { 10 | 11 | public BaseGameEntity subTarget; 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /OverheadUI/PlayerCharacterController_SubTarget.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1e26a8d87f64c04099de7c682f744c9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /OverheadUI/UIHarvestableEntity.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace MultiplayerARPG 6 | { 7 | public class UIHarvestableEntity : UIDamageableEntity { } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /OverheadUI/UIHarvestableEntity.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26fe5427be5ab4d449f4cabe02d82df6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## MMORPG Kit Snippets 2 | Utility scripts and components for the everyman. 3 | Developed for: 4 | https://assetstore.unity.com/packages/templates/systems/mmorpg-kit-2d-3d-survival-110188 5 | 6 | If you would like to make a donation to support this effort: 7 | [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=C9W7CRZFJQEDA¤cy_code=USD) 8 | 9 | ### Overhead UI 10 | The purpose of these scripts are to improve the rendering and behavior of Overhead UI. 11 | 12 | Instructions: 13 | - Attach any of the scripts to the following Prefabs (or similarly created prefabs) 14 | - CanvasOwningCharacterUI 15 | - CanvasNonOwningCharacterUI 16 | - CanvasMonsterCharacterUI 17 | - CanvasNPCUI 18 | - (To leverage the harvestable overhead ui, you need to create a CanvasHarvestableUI with UI Harvestable Entity and replace instances of Harvestable Entity with "Harvestable Entity with UI") 19 | - Configure the parameters of the scripts to meet your needs 20 | - Watch the magic! 21 | 22 | ### Tab Targeting 23 | The purpose of these scripts are to improve tab targeting 24 | Instructions: 25 | - In the extended PlayerCharacterController, remember to remove the `Input.GetButtonDown("FindEnemy")` handling, as this will replace it 26 | - In your overwritten PlayerCharacterController, add the following: 27 | ``` 28 | public override void UpdateInput() { 29 | // some logic 30 | if (ConstructingBuildingEntity == null) 31 | { 32 | UpdateSelectedTarget(); 33 | Targeting.HandleTargeting(); 34 | // Remove the Input.GetButtonDown("FindEnemy") check and execution! 35 | // some more logic 36 | } 37 | // the rest of the logic 38 | } 39 | 40 | protected override void OnPointClickOnGround(Vector3 targetPosition) 41 | { 42 | Targeting.m_currentlySelectedTarget = null; 43 | // do stuff or not (if you dont call base.OnPointClickOnGround it will disable click to move on the ground) 44 | } 45 | ``` 46 | Controls: 47 | - Hitting tab will select closest targetable harvestable/npc/player/monster 48 | - Hitting tab after will move the target to the right 49 | - Holding shift and hitting tab will move the target to the left 50 | - Hitting tab/shift+tab will cycle the target from the other end if you reach the end of the targetable list 51 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf4707164d75216409e817f07dabeb7c 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /SafeZone.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a104a2bb1655fc14aabb3a55afef9a34 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /SafeZone/AreaDamageEntity_SafeZone.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | namespace MultiplayerARPG 5 | { 6 | public partial class AreaDamageEntity : BaseDamageEntity 7 | { 8 | 9 | public bool IsInSafeArea; 10 | } 11 | } -------------------------------------------------------------------------------- /SafeZone/AreaDamageEntity_SafeZone.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f0b6cf5496c4c3e4baf4879b6138da2c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /SafeZone/NoAttackSafeArea.cs: -------------------------------------------------------------------------------- 1 | using MultiplayerARPG; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | public class NoAttackSafeArea : MonoBehaviour, IUnHittable 7 | { 8 | private void Awake() 9 | { 10 | gameObject.layer = PhysicLayers.IgnoreRaycast; 11 | } 12 | 13 | private void OnTriggerEnter(Collider other) 14 | { 15 | TriggerEnter(other.gameObject); 16 | } 17 | 18 | private void OnTriggerEnter2D(Collider2D other) 19 | { 20 | TriggerEnter(other.gameObject); 21 | } 22 | 23 | private void TriggerEnter(GameObject other) 24 | { 25 | BaseGameEntity gameEntity = other.GetComponent(); 26 | if (gameEntity != null) 27 | gameEntity.IsInSafeArea = true; 28 | AreaDamageEntity areaDamage = other.GetComponent(); 29 | if (areaDamage != null) 30 | areaDamage.IsInSafeArea = true; 31 | } 32 | 33 | private void OnTriggerExit(Collider other) 34 | { 35 | TriggerExit(other.gameObject); 36 | } 37 | 38 | private void OnTriggerExit2D(Collider2D other) 39 | { 40 | TriggerExit(other.gameObject); 41 | } 42 | 43 | private void TriggerExit(GameObject other) 44 | { 45 | BaseGameEntity gameEntity = other.GetComponent(); 46 | if (gameEntity != null) 47 | gameEntity.IsInSafeArea = false; 48 | AreaDamageEntity areaDamage = other.GetComponent(); 49 | if (areaDamage != null) 50 | areaDamage.IsInSafeArea = false; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /SafeZone/NoAttackSafeArea.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a23952b0cd5cc9047ac3b73e2e4a167c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /SafeZone/PlayerCharacterController_SafeZone.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace MultiplayerARPG 6 | { 7 | public partial class PlayerCharacterController 8 | { 9 | 10 | [DevExtMethods("Awake")] 11 | protected void DevExt_Awake() 12 | { 13 | if (!DefaultLocale.Texts.ContainsKey(CustomGameMessage.NoCastingInSafeArea.ToString())) 14 | { 15 | DefaultLocale.Texts.Add(CustomGameMessage.NoCastingInSafeArea.ToString(), "Unable to attack in the Safe Zone"); 16 | } 17 | } 18 | protected virtual void ClearQueuedSkillIfInSafeZone() 19 | { 20 | if (queueUsingSkill.skill == null || queueUsingSkill.level <= 0) 21 | return; 22 | BaseSkill skill = queueUsingSkill.skill; 23 | 24 | if (PlayerCharacterEntity.IsInSafeArea && skill.IsAttack()) 25 | { 26 | ClearQueueUsingSkill(); 27 | PlayerCharacterEntity.CurrentGameManager.SendServerGameMessage(PlayerCharacterEntity.ConnectionId, 28 | CustomGameMessage.NoCastingInSafeArea); 29 | return; 30 | } 31 | } 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /SafeZone/PlayerCharacterController_SafeZone.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bea6aab5c3845e74791749793d13b40b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Swim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 46fbd2e1ee7a2904985307766ac594e7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Swim/SwimRigidBodyEntityMovement.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d727d92bac0dbde4a82b3a89c3a6f140 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Targeting.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d82000af9e2dd4c4fa5df900449301d1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Targeting/BaseCharacterEntity_Targetable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.Tracing; 4 | using UnityEngine; 5 | using UnityEngine.Events; 6 | 7 | namespace MultiplayerARPG 8 | { 9 | public partial class BaseCharacterEntity : DamageableEntity, ICharacterData 10 | { 11 | public readonly UnityEvent CharacterDied = new UnityEvent(); 12 | private readonly List m_targetedBy = new List(); //list of candidate game objects 13 | 14 | 15 | 16 | [DevExtMethods("Awake")] 17 | void DevExt_Awake() 18 | { 19 | 20 | onDead.AddListener(() => CharacterDied.Invoke(this)); 21 | } 22 | 23 | [DevExtMethods("OnDestroy")] 24 | void DevExt_Destroy() 25 | { 26 | onDead = null; 27 | CharacterDied.RemoveAllListeners(); 28 | } 29 | 30 | 31 | public void OnTargeted(BaseCharacterEntity entity) 32 | { 33 | m_targetedBy.Add(entity); 34 | } 35 | public void OnUnTargeted(BaseCharacterEntity entity) 36 | { 37 | m_targetedBy.Remove(entity); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Targeting/BaseCharacterEntity_Targetable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8b35290f6842cf40ac8034860176fa1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Targeting/BaseCharacterEntity_TargetingData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using LiteNetLibManager; 5 | 6 | namespace MultiplayerARPG 7 | { 8 | public partial class BaseCharacterEntity 9 | { 10 | [SerializeField] 11 | protected SyncFieldUInt castingTargetEntityId = new SyncFieldUInt(); 12 | [SerializeField] 13 | protected SyncFieldUInt subTargetEntityId = new SyncFieldUInt(); 14 | #region Tab Target Entity Getter/Setter 15 | public void SetSubTarget(BaseGameEntity entity) 16 | { 17 | if (entity == null) 18 | { 19 | subTargetEntityId.Value = 0; 20 | return; 21 | } 22 | 23 | subTargetEntityId.Value = entity.ObjectId; 24 | subTargetEntityId.UpdateImmediately(); 25 | } 26 | public void SetCastingTarget(BaseGameEntity entity) 27 | { 28 | if (entity == null) 29 | { 30 | castingTargetEntityId.Value = 0; 31 | return; 32 | } 33 | 34 | castingTargetEntityId.Value = entity.ObjectId; 35 | castingTargetEntityId.UpdateImmediately(); 36 | } 37 | #endregion 38 | 39 | 40 | /** 41 | * Use GetTargetEntity/TryGetTargetEntity for NPC dialogue, Autoattack and harvesting 42 | */ 43 | 44 | 45 | /** 46 | * Use this method when applying skills that were mid-cast when changing targets 47 | */ 48 | public virtual BaseGameEntity GetCastingTargetEntity() 49 | { 50 | BaseGameEntity entity; 51 | if (castingTargetEntityId.Value == 0 || !Manager.Assets.TryGetSpawnedObject(castingTargetEntityId.Value, out entity)) 52 | return null; 53 | return entity; 54 | } 55 | /** 56 | * Use this method for using skills/items on sub-targets 57 | */ 58 | public virtual BaseGameEntity GetSubTargetEntity() 59 | { 60 | BaseGameEntity entity; 61 | if (subTargetEntityId.Value == 0 || !Manager.Assets.TryGetSpawnedObject(subTargetEntityId.Value, out entity)) 62 | return null; 63 | return entity; 64 | } 65 | 66 | 67 | public virtual bool TryGetCastingTargetEntity(out T entity) where T : class 68 | { 69 | if (GetCastingTargetEntity() == null) 70 | return TryGetSubTargetEntity(out entity); 71 | entity = GetCastingTargetEntity() as T; 72 | return entity != null; 73 | } 74 | public virtual bool TryGetSubTargetEntity(out T entity) where T : class 75 | { 76 | // Fallback to selected entity if sub target is not available 77 | if (GetSubTargetEntity() == null) 78 | return TryGetTargetEntity(out entity); 79 | Debug.Log("Getting Sub Target"); 80 | entity = GetSubTargetEntity() as T; 81 | return entity != null; 82 | } 83 | public Vector3 GetDefaultAttackAimPositionForSkill(DamageInfo damageInfo, bool isLeftHand) 84 | { 85 | // No aim position set, set aim position to forward direction 86 | BaseGameEntity targetEntity; 87 | TryGetCastingTargetEntity(out targetEntity); 88 | if (targetEntity) 89 | { 90 | if (targetEntity is DamageableEntity) 91 | { 92 | return (targetEntity as DamageableEntity).OpponentAimTransform.position; 93 | } 94 | else 95 | { 96 | return targetEntity.CacheTransform.position; 97 | } 98 | } 99 | return damageInfo.GetDamageTransform(this, isLeftHand).position + CacheTransform.forward * damageInfo.GetDistance(); 100 | } 101 | } 102 | } -------------------------------------------------------------------------------- /Targeting/BaseCharacterEntity_TargetingData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ee1404b5ff933a41b87b553dee30c77 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Targeting/CharacterUICamera.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &342019576605658840 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 339787113356548362} 12 | - component: {fileID: 356116268726843254} 13 | - component: {fileID: 373275804814129830} 14 | - component: {fileID: 4571605522974087243} 15 | m_Layer: 0 16 | m_Name: CharacterUICamera 17 | m_TagString: Untagged 18 | m_Icon: {fileID: 0} 19 | m_NavMeshLayer: 0 20 | m_StaticEditorFlags: 0 21 | m_IsActive: 1 22 | --- !u!4 &339787113356548362 23 | Transform: 24 | m_ObjectHideFlags: 0 25 | m_CorrespondingSourceObject: {fileID: 0} 26 | m_PrefabInstance: {fileID: 0} 27 | m_PrefabAsset: {fileID: 0} 28 | m_GameObject: {fileID: 342019576605658840} 29 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 30 | m_LocalPosition: {x: 0, y: 0, z: 0} 31 | m_LocalScale: {x: 1, y: 1, z: 1} 32 | m_Children: [] 33 | m_Father: {fileID: 0} 34 | m_RootOrder: 0 35 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 36 | --- !u!20 &356116268726843254 37 | Camera: 38 | m_ObjectHideFlags: 0 39 | m_CorrespondingSourceObject: {fileID: 0} 40 | m_PrefabInstance: {fileID: 0} 41 | m_PrefabAsset: {fileID: 0} 42 | m_GameObject: {fileID: 342019576605658840} 43 | m_Enabled: 1 44 | serializedVersion: 2 45 | m_ClearFlags: 3 46 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 47 | m_projectionMatrixMode: 1 48 | m_GateFitMode: 2 49 | m_FOVAxisMode: 0 50 | m_SensorSize: {x: 36, y: 24} 51 | m_LensShift: {x: 0, y: 0} 52 | m_FocalLength: 50 53 | m_NormalizedViewPortRect: 54 | serializedVersion: 2 55 | x: 0 56 | y: 0 57 | width: 1 58 | height: 1 59 | near clip plane: 0.3 60 | far clip plane: 1000 61 | field of view: 60 62 | orthographic: 0 63 | orthographic size: 5 64 | m_Depth: 0 65 | m_CullingMask: 66 | serializedVersion: 2 67 | m_Bits: 262144 68 | m_RenderingPath: 1 69 | m_TargetTexture: {fileID: 0} 70 | m_TargetDisplay: 0 71 | m_TargetEye: 3 72 | m_HDR: 0 73 | m_AllowMSAA: 0 74 | m_AllowDynamicResolution: 0 75 | m_ForceIntoRT: 0 76 | m_OcclusionCulling: 0 77 | m_StereoConvergence: 10 78 | m_StereoSeparation: 0.022 79 | --- !u!114 &373275804814129830 80 | MonoBehaviour: 81 | m_ObjectHideFlags: 0 82 | m_CorrespondingSourceObject: {fileID: 0} 83 | m_PrefabInstance: {fileID: 0} 84 | m_PrefabAsset: {fileID: 0} 85 | m_GameObject: {fileID: 342019576605658840} 86 | m_Enabled: 1 87 | m_EditorHideFlags: 0 88 | m_Script: {fileID: 11500000, guid: 1e61383545c180d4c86325689616578a, type: 3} 89 | m_Name: 90 | m_EditorClassIdentifier: 91 | copyFromCamera: {fileID: 0} 92 | copyToCamera: {fileID: 356116268726843254} 93 | --- !u!114 &4571605522974087243 94 | MonoBehaviour: 95 | m_ObjectHideFlags: 0 96 | m_CorrespondingSourceObject: {fileID: 0} 97 | m_PrefabInstance: {fileID: 0} 98 | m_PrefabAsset: {fileID: 0} 99 | m_GameObject: {fileID: 342019576605658840} 100 | m_Enabled: 1 101 | m_EditorHideFlags: 0 102 | m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} 103 | m_Name: 104 | m_EditorClassIdentifier: 105 | m_RenderShadows: 0 106 | m_RequiresDepthTextureOption: 2 107 | m_RequiresOpaqueTextureOption: 2 108 | m_CameraType: 1 109 | m_Cameras: [] 110 | m_RendererIndex: -1 111 | m_VolumeLayerMask: 112 | serializedVersion: 2 113 | m_Bits: 1 114 | m_VolumeTrigger: {fileID: 0} 115 | m_RenderPostProcessing: 0 116 | m_Antialiasing: 0 117 | m_AntialiasingQuality: 2 118 | m_StopNaN: 0 119 | m_Dithering: 0 120 | m_ClearDepth: 1 121 | m_RequiresDepthTexture: 0 122 | m_RequiresColorTexture: 0 123 | m_Version: 2 124 | -------------------------------------------------------------------------------- /Targeting/CharacterUICamera.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c917a7fc6b694f040acf0982207e5ec8 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Targeting/GameplayCamera.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_SourcePrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1278824955568960} 13 | m_IsPrefabAsset: 1 14 | --- !u!1 &1278824955568960 15 | GameObject: 16 | m_ObjectHideFlags: 0 17 | m_CorrespondingSourceObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 6 20 | m_Component: 21 | - component: {fileID: 4983335410072664} 22 | - component: {fileID: 20186615803325660} 23 | - component: {fileID: 114548782499701980} 24 | - component: {fileID: 114185086765178122} 25 | m_Layer: 0 26 | m_Name: GameplayCamera 27 | m_TagString: MainCamera 28 | m_Icon: {fileID: 0} 29 | m_NavMeshLayer: 0 30 | m_StaticEditorFlags: 0 31 | m_IsActive: 1 32 | --- !u!1 &1875850924656240 33 | GameObject: 34 | m_ObjectHideFlags: 0 35 | m_CorrespondingSourceObject: {fileID: 0} 36 | m_PrefabInternal: {fileID: 100100000} 37 | serializedVersion: 6 38 | m_Component: 39 | - component: {fileID: 4108299210592674} 40 | - component: {fileID: 20441234044108766} 41 | - component: {fileID: 114725999672488462} 42 | m_Layer: 0 43 | m_Name: CharacterUICamera 44 | m_TagString: Untagged 45 | m_Icon: {fileID: 0} 46 | m_NavMeshLayer: 0 47 | m_StaticEditorFlags: 0 48 | m_IsActive: 1 49 | --- !u!4 &4108299210592674 50 | Transform: 51 | m_ObjectHideFlags: 1 52 | m_CorrespondingSourceObject: {fileID: 0} 53 | m_PrefabInternal: {fileID: 100100000} 54 | m_GameObject: {fileID: 1875850924656240} 55 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 56 | m_LocalPosition: {x: 0, y: 0, z: 0} 57 | m_LocalScale: {x: 1, y: 1, z: 1} 58 | m_Children: [] 59 | m_Father: {fileID: 4983335410072664} 60 | m_RootOrder: 0 61 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 62 | --- !u!4 &4983335410072664 63 | Transform: 64 | m_ObjectHideFlags: 1 65 | m_CorrespondingSourceObject: {fileID: 0} 66 | m_PrefabInternal: {fileID: 100100000} 67 | m_GameObject: {fileID: 1278824955568960} 68 | m_LocalRotation: {x: 0.000000007590405, y: 0.9848078, z: -0.17364821, w: 0.00000004304732} 69 | m_LocalPosition: {x: -0.00000024645158, y: 1.7760603, z: 2.8190775} 70 | m_LocalScale: {x: 1, y: 1, z: 1} 71 | m_Children: 72 | - {fileID: 4108299210592674} 73 | m_Father: {fileID: 0} 74 | m_RootOrder: 0 75 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 76 | --- !u!20 &20186615803325660 77 | Camera: 78 | m_ObjectHideFlags: 1 79 | m_CorrespondingSourceObject: {fileID: 0} 80 | m_PrefabInternal: {fileID: 100100000} 81 | m_GameObject: {fileID: 1278824955568960} 82 | m_Enabled: 1 83 | serializedVersion: 2 84 | m_ClearFlags: 1 85 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 86 | m_projectionMatrixMode: 1 87 | m_SensorSize: {x: 36, y: 24} 88 | m_LensShift: {x: 0, y: 0} 89 | m_FocalLength: 50 90 | m_NormalizedViewPortRect: 91 | serializedVersion: 2 92 | x: 0 93 | y: 0 94 | width: 1 95 | height: 1 96 | near clip plane: 0.3 97 | far clip plane: 1000 98 | field of view: 60 99 | orthographic: 0 100 | orthographic size: 5 101 | m_Depth: -1 102 | m_CullingMask: 103 | serializedVersion: 2 104 | m_Bits: 31543 105 | m_RenderingPath: -1 106 | m_TargetTexture: {fileID: 0} 107 | m_TargetDisplay: 0 108 | m_TargetEye: 3 109 | m_HDR: 0 110 | m_AllowMSAA: 1 111 | m_AllowDynamicResolution: 0 112 | m_ForceIntoRT: 0 113 | m_OcclusionCulling: 1 114 | m_StereoConvergence: 10 115 | m_StereoSeparation: 0.022 116 | --- !u!20 &20441234044108766 117 | Camera: 118 | m_ObjectHideFlags: 1 119 | m_CorrespondingSourceObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 100100000} 121 | m_GameObject: {fileID: 1875850924656240} 122 | m_Enabled: 1 123 | serializedVersion: 2 124 | m_ClearFlags: 3 125 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 126 | m_projectionMatrixMode: 1 127 | m_SensorSize: {x: 36, y: 24} 128 | m_LensShift: {x: 0, y: 0} 129 | m_FocalLength: 50 130 | m_NormalizedViewPortRect: 131 | serializedVersion: 2 132 | x: 0 133 | y: 0 134 | width: 1 135 | height: 1 136 | near clip plane: 0.3 137 | far clip plane: 1000 138 | field of view: 60 139 | orthographic: 0 140 | orthographic size: 5 141 | m_Depth: 0 142 | m_CullingMask: 143 | serializedVersion: 2 144 | m_Bits: 32768 145 | m_RenderingPath: 1 146 | m_TargetTexture: {fileID: 0} 147 | m_TargetDisplay: 0 148 | m_TargetEye: 3 149 | m_HDR: 0 150 | m_AllowMSAA: 0 151 | m_AllowDynamicResolution: 0 152 | m_ForceIntoRT: 0 153 | m_OcclusionCulling: 0 154 | m_StereoConvergence: 10 155 | m_StereoSeparation: 0.022 156 | --- !u!114 &114185086765178122 157 | MonoBehaviour: 158 | m_ObjectHideFlags: 1 159 | m_CorrespondingSourceObject: {fileID: 0} 160 | m_PrefabInternal: {fileID: 100100000} 161 | m_GameObject: {fileID: 1278824955568960} 162 | m_Enabled: 1 163 | m_EditorHideFlags: 0 164 | m_Script: {fileID: 11500000, guid: 96cc5458343e2534f8507d8b3a781eb4, type: 3} 165 | m_Name: 166 | m_EditorClassIdentifier: 167 | currentFadeState: 2 168 | fadeSpeed: 0.5 169 | --- !u!114 &114548782499701980 170 | MonoBehaviour: 171 | m_ObjectHideFlags: 1 172 | m_CorrespondingSourceObject: {fileID: 0} 173 | m_PrefabInternal: {fileID: 100100000} 174 | m_GameObject: {fileID: 1278824955568960} 175 | m_Enabled: 1 176 | m_EditorHideFlags: 0 177 | m_Script: {fileID: 11500000, guid: 34e5f4512b7c9e94a80ec394fd3a8441, type: 3} 178 | m_Name: 179 | m_EditorClassIdentifier: 180 | targetCamera: {fileID: 0} 181 | target: {fileID: 0} 182 | targetOffset: {x: 0, y: 0.75, z: 0} 183 | xRotation: 20 184 | yRotation: -180 185 | useTargetYRotation: 0 186 | zoomDistance: 3 187 | zoomByAspectRatio: 0 188 | zoomByAspectRatioSettings: 189 | - width: 16 190 | height: 9 191 | zoomDistance: 0.0001 192 | - width: 16 193 | height: 10 194 | zoomDistance: 1.75 195 | - width: 3 196 | height: 2 197 | zoomDistance: 3 198 | - width: 4 199 | height: 3 200 | zoomDistance: 5.5 201 | - width: 5 202 | height: 4 203 | zoomDistance: 7 204 | enableWallHitSpring: 1 205 | wallHitLayerMask: 206 | serializedVersion: 2 207 | m_Bits: 24577 208 | wallHitQueryTriggerInteraction: 1 209 | updateRotation: 1 210 | updateRotationX: 0 211 | updateRotationY: 0 212 | updateZoom: 1 213 | limitXRotation: 1 214 | minXRotation: 0 215 | maxXRotation: 45 216 | smoothRotateX: 0 217 | rotateXSmoothing: 10 218 | limitYRotation: 0 219 | minYRotation: 0 220 | maxYRotation: 0 221 | smoothRotateY: 0 222 | rotateYSmoothing: 10 223 | startXRotation: 30 224 | startYRotation: 180 225 | rotationSpeed: 5 226 | limitZoomDistance: 1 227 | minZoomDistance: 2 228 | maxZoomDistance: 10 229 | smoothZoom: 0 230 | zoomSmoothing: 10 231 | startZoomDistance: 3 232 | zoomSpeed: -5 233 | isSaveCamera: 1 234 | savePrefsPrefix: GAMEPLAY 235 | --- !u!114 &114725999672488462 236 | MonoBehaviour: 237 | m_ObjectHideFlags: 1 238 | m_CorrespondingSourceObject: {fileID: 0} 239 | m_PrefabInternal: {fileID: 100100000} 240 | m_GameObject: {fileID: 1875850924656240} 241 | m_Enabled: 1 242 | m_EditorHideFlags: 0 243 | m_Script: {fileID: 11500000, guid: 1e61383545c180d4c86325689616578a, type: 3} 244 | m_Name: 245 | m_EditorClassIdentifier: 246 | copyFromCamera: {fileID: 20186615803325660} 247 | copyToCamera: {fileID: 20441234044108766} 248 | -------------------------------------------------------------------------------- /Targeting/GameplayCamera.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e450ece85c264c48a1f642595379ac8 3 | timeCreated: 1519917205 4 | licenseType: Store 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 100100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Targeting/PlayerCharacterController_TabTarget.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53a3de5973703c74ab5214fa5e422e38 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Targeting/README.md: -------------------------------------------------------------------------------- 1 | ## Core Changes for Tab Targeting Refinements 2 | 3 | ### BaseCharacterEntity_SkillFunctions.cs 4 | Line 289: Vector3 aimPosition = GetDefaultAttackAimPositionForSkill(damageInfo, isLeftHand); 5 | 6 | 7 | ### Damage.cs 8 | Line 238: bool hasSelectedTarget = attacker.TryGetCastingTargetEntity(out selectedTarget); 9 | Line 337: if (!attacker.TryGetCastingTargetEntity(out tempDamageableHitBox)) 10 | 11 | ### Skill.cs 12 | Line 158: if (skillUser.TryGetCastingTargetEntity(out targetEntity) && !targetEntity.IsDead()) -------------------------------------------------------------------------------- /Targeting/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 918eb7d0de17d2147aaa6bf878429642 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Targeting/Recticle.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &478405178450322564 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 478405178450322566} 12 | - component: {fileID: 288980176372654533} 13 | - component: {fileID: 1338321565776370751} 14 | m_Layer: 15 15 | m_Name: Recticle 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!4 &478405178450322566 22 | Transform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 478405178450322564} 28 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: 32 | - {fileID: 2549509023710959846} 33 | m_Father: {fileID: 0} 34 | m_RootOrder: 0 35 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 36 | --- !u!114 &288980176372654533 37 | MonoBehaviour: 38 | m_ObjectHideFlags: 0 39 | m_CorrespondingSourceObject: {fileID: 0} 40 | m_PrefabInstance: {fileID: 0} 41 | m_PrefabAsset: {fileID: 0} 42 | m_GameObject: {fileID: 478405178450322564} 43 | m_Enabled: 1 44 | m_EditorHideFlags: 0 45 | m_Script: {fileID: 11500000, guid: 5b43ce36ea5b7e543a228f17b6f6d4b0, type: 3} 46 | m_Name: 47 | m_EditorClassIdentifier: 48 | targetCamera: {fileID: 0} 49 | --- !u!136 &1338321565776370751 50 | CapsuleCollider: 51 | m_ObjectHideFlags: 0 52 | m_CorrespondingSourceObject: {fileID: 0} 53 | m_PrefabInstance: {fileID: 0} 54 | m_PrefabAsset: {fileID: 0} 55 | m_GameObject: {fileID: 478405178450322564} 56 | m_Material: {fileID: 0} 57 | m_IsTrigger: 1 58 | m_Enabled: 1 59 | m_Radius: 0.5 60 | m_Height: 1 61 | m_Direction: 1 62 | m_Center: {x: 0, y: 0, z: 0} 63 | --- !u!1 &2495755937810705027 64 | GameObject: 65 | m_ObjectHideFlags: 0 66 | m_CorrespondingSourceObject: {fileID: 0} 67 | m_PrefabInstance: {fileID: 0} 68 | m_PrefabAsset: {fileID: 0} 69 | serializedVersion: 6 70 | m_Component: 71 | - component: {fileID: 2549509023710959846} 72 | - component: {fileID: 1157511944012581754} 73 | - component: {fileID: 9159526623665592681} 74 | m_Layer: 15 75 | m_Name: GameObject 76 | m_TagString: Untagged 77 | m_Icon: {fileID: 0} 78 | m_NavMeshLayer: 0 79 | m_StaticEditorFlags: 0 80 | m_IsActive: 1 81 | --- !u!4 &2549509023710959846 82 | Transform: 83 | m_ObjectHideFlags: 0 84 | m_CorrespondingSourceObject: {fileID: 0} 85 | m_PrefabInstance: {fileID: 0} 86 | m_PrefabAsset: {fileID: 0} 87 | m_GameObject: {fileID: 2495755937810705027} 88 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 89 | m_LocalPosition: {x: 0, y: 0, z: 0} 90 | m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} 91 | m_Children: [] 92 | m_Father: {fileID: 478405178450322566} 93 | m_RootOrder: 0 94 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 95 | --- !u!212 &1157511944012581754 96 | SpriteRenderer: 97 | m_ObjectHideFlags: 0 98 | m_CorrespondingSourceObject: {fileID: 0} 99 | m_PrefabInstance: {fileID: 0} 100 | m_PrefabAsset: {fileID: 0} 101 | m_GameObject: {fileID: 2495755937810705027} 102 | m_Enabled: 1 103 | m_CastShadows: 0 104 | m_ReceiveShadows: 0 105 | m_DynamicOccludee: 1 106 | m_MotionVectors: 1 107 | m_LightProbeUsage: 1 108 | m_ReflectionProbeUsage: 1 109 | m_RayTracingMode: 0 110 | m_RayTraceProcedural: 0 111 | m_RenderingLayerMask: 1 112 | m_RendererPriority: 0 113 | m_Materials: 114 | - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 115 | m_StaticBatchInfo: 116 | firstSubMesh: 0 117 | subMeshCount: 0 118 | m_StaticBatchRoot: {fileID: 0} 119 | m_ProbeAnchor: {fileID: 0} 120 | m_LightProbeVolumeOverride: {fileID: 0} 121 | m_ScaleInLightmap: 1 122 | m_ReceiveGI: 1 123 | m_PreserveUVs: 0 124 | m_IgnoreNormalsForChartDetection: 0 125 | m_ImportantGI: 0 126 | m_StitchLightmapSeams: 1 127 | m_SelectedEditorRenderState: 0 128 | m_MinimumChartSize: 4 129 | m_AutoUVMaxDistance: 0.5 130 | m_AutoUVMaxAngle: 89 131 | m_LightmapParameters: {fileID: 0} 132 | m_SortingLayerID: -737121915 133 | m_SortingLayer: 2 134 | m_SortingOrder: 0 135 | m_Sprite: {fileID: 21300000, guid: 2e94e1b027154e642ae29e7c2dc38151, type: 3} 136 | m_Color: {r: 1, g: 1, b: 1, a: 1} 137 | m_FlipX: 0 138 | m_FlipY: 0 139 | m_DrawMode: 0 140 | m_Size: {x: 2.8, y: 2.8} 141 | m_AdaptiveModeThreshold: 0.5 142 | m_SpriteTileMode: 0 143 | m_WasSpriteAssigned: 1 144 | m_MaskInteraction: 0 145 | m_SpriteSortPoint: 0 146 | --- !u!114 &9159526623665592681 147 | MonoBehaviour: 148 | m_ObjectHideFlags: 0 149 | m_CorrespondingSourceObject: {fileID: 0} 150 | m_PrefabInstance: {fileID: 0} 151 | m_PrefabAsset: {fileID: 0} 152 | m_GameObject: {fileID: 2495755937810705027} 153 | m_Enabled: 1 154 | m_EditorHideFlags: 0 155 | m_Script: {fileID: 11500000, guid: 091ba3c8e35d5414e8ff962103ac3631, type: 3} 156 | m_Name: 157 | m_EditorClassIdentifier: 158 | -------------------------------------------------------------------------------- /Targeting/Recticle.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 997bc9f88e9224244b67ae37c45c73eb 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Targeting/Spin.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class Spin : MonoBehaviour 6 | { 7 | // Update is called once per frame 8 | void Update() 9 | { 10 | transform.Rotate(Vector3.back * 8); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Targeting/Spin.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 091ba3c8e35d5414e8ff962103ac3631 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Targeting/TabTargetBillboard.cs: -------------------------------------------------------------------------------- 1 | using MultiplayerARPG; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | public class TabTargetBillboard : MonoBehaviour 7 | { 8 | public Camera targetCamera; 9 | 10 | public Transform CacheTransform { get; private set; } 11 | public Transform CacheCameraTransform { get; private set; } 12 | 13 | private void OnEnable() 14 | { 15 | CacheTransform = transform; 16 | SetupCamera(); 17 | } 18 | 19 | private bool SetupCamera() 20 | { 21 | if (targetCamera == null) 22 | { 23 | PlayerCharacterController controller = BasePlayerCharacterController.Singleton as PlayerCharacterController; 24 | if (controller != null) 25 | { 26 | targetCamera = controller.CacheGameplayCamera; 27 | if (targetCamera != null) 28 | CacheCameraTransform = targetCamera.transform; 29 | } 30 | } 31 | return targetCamera != null; 32 | } 33 | 34 | private void LateUpdate() 35 | { 36 | if (!SetupCamera()) 37 | return; 38 | CacheTransform.rotation = Quaternion.Euler(Quaternion.LookRotation(CacheCameraTransform.forward, CacheCameraTransform.up).eulerAngles); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Targeting/TabTargetBillboard.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f8c347569a12c942a2487b308ddc612 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Targeting/TabTargetCameraController.cs: -------------------------------------------------------------------------------- 1 | using MultiplayerARPG; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Runtime.InteropServices.ComTypes; 5 | using UnityEngine; 6 | 7 | public class TabTargetCameraController : MonoBehaviour 8 | { 9 | 10 | float cameraPitch = 40.0f; 11 | float cameraYaw = 0; 12 | float cameraDistance = 5.0f; 13 | bool lerpDistance = false; 14 | public static bool lerpOffset = false; 15 | 16 | protected float cameraPitchSpeed = 2.0f; 17 | protected float cameraYawSpeed = 2.0f; 18 | public float cameraPitchMin = -10.0f; 19 | public float cameraPitchMax = 80.0f; 20 | public float cameraDistanceSpeed = 5.0f; 21 | public float cameraDistanceMin = 2.0f; 22 | public float cameraDistanceMax = 12.0f; 23 | public float cameraYOffset = 2f; 24 | 25 | public string savePrefsPrefix = "GAMEPLAY"; 26 | 27 | protected float yawOffset = 0f; 28 | protected float pitchOffset = 0f; 29 | protected float maxOffset = 40f; 30 | 31 | 32 | protected GameObject FocusTarget 33 | { 34 | get 35 | { 36 | return Controller.Targeting.SelectedTarget; 37 | } 38 | } 39 | protected PlayerCharacterController Controller 40 | { 41 | get 42 | { 43 | return BasePlayerCharacterController.Singleton as PlayerCharacterController; 44 | } 45 | } 46 | protected GameObject Player 47 | { 48 | get 49 | { 50 | if (Controller?.PlayerCharacterEntity == null) 51 | return null; 52 | return Controller?.PlayerCharacterEntity?.gameObject; 53 | } 54 | } 55 | 56 | protected Camera camera 57 | { 58 | get 59 | { 60 | PlayerCharacterController controller = BasePlayerCharacterController.Singleton as PlayerCharacterController; 61 | return controller?.CacheGameplayCamera; 62 | } 63 | } 64 | private void Start() 65 | { 66 | cameraYaw = PlayerPrefs.GetFloat(savePrefsPrefix + "_XRotation", cameraYaw); 67 | cameraPitch = PlayerPrefs.GetFloat(savePrefsPrefix + "_YRotation", cameraPitch); 68 | cameraDistance = PlayerPrefs.GetFloat(savePrefsPrefix + "_ZoomDistance", cameraDistance); 69 | } 70 | private void Update() 71 | { 72 | 73 | if (!Player) 74 | return; 75 | PlayerPrefs.SetFloat(savePrefsPrefix + "_XRotation", cameraYaw + yawOffset); 76 | PlayerPrefs.SetFloat(savePrefsPrefix + "_YRotation", cameraPitch + pitchOffset); 77 | PlayerPrefs.SetFloat(savePrefsPrefix + "_ZoomDistance", cameraDistance); 78 | PlayerPrefs.Save(); 79 | } 80 | 81 | // Update is called once per frame 82 | void LateUpdate() 83 | { 84 | if (!camera) 85 | return; 86 | if (!Player) 87 | return; 88 | 89 | bool isFocusInputField = GenericUtils.IsFocusInputField(); 90 | bool isPointerOverUIObject = Controller.CacheUISceneGameplay.IsPointerOverUIObject(); 91 | // If mouse button down then allow user to look around 92 | if (!isPointerOverUIObject && Input.GetMouseButton(1)) 93 | UpdateInput(); 94 | // Zoom 95 | if (!isPointerOverUIObject && Input.GetAxis("Mouse ScrollWheel") != 0) 96 | UpdateZoom(); 97 | 98 | if (IsFocusing()) 99 | FollowSelectedTarget(); 100 | else 101 | FollowPlayer(); 102 | } 103 | 104 | protected virtual void UpdateZoom() 105 | { 106 | cameraDistance -= Input.GetAxis("Mouse ScrollWheel") * cameraDistanceSpeed; 107 | cameraDistance = Mathf.Clamp(cameraDistance, cameraDistanceMin, cameraDistanceMax); 108 | lerpDistance = false; 109 | } 110 | 111 | protected virtual void FollowPlayer() 112 | { 113 | if (pitchOffset > -1) 114 | cameraPitch = cameraPitch + pitchOffset; 115 | MoveCameraTo(camera.transform, Player.transform, cameraYaw, cameraPitch); 116 | camera.transform.LookAt(Player.transform.position + (Vector3.up * cameraYOffset)); 117 | yawOffset = 0; 118 | pitchOffset = -1; 119 | } 120 | 121 | protected virtual void FollowSelectedTarget() 122 | { 123 | Vector3 focusPosition = FocusTarget.transform.position; 124 | Vector3 diffOfCamera = Player.transform.position - camera.transform.position; 125 | Vector3 diffOfCameraFromNewTarget = focusPosition - camera.transform.position; 126 | Vector3 diff = focusPosition - Player.transform.position; 127 | Vector3 angles = Quaternion.LookRotation(diff).eulerAngles; 128 | float horizontal = angles.y; 129 | float vertical = angles.x; 130 | float angle = Vector3.Angle(diff, camera.transform.right); 131 | if (angle < 80 || angle > 100 || Input.GetMouseButton(1)) 132 | cameraYaw = Mathf.LerpAngle(cameraYaw, horizontal, 2f * Time.deltaTime); 133 | 134 | cameraYaw = cameraYaw % 360; 135 | 136 | if (pitchOffset == -1) 137 | pitchOffset = (cameraPitch * diffOfCamera.magnitude) / diffOfCameraFromNewTarget.magnitude; 138 | pitchOffset = Mathf.Clamp(pitchOffset, 0, maxOffset); 139 | cameraPitch = vertical; 140 | if (lerpOffset) 141 | { 142 | yawOffset = Mathf.Lerp(yawOffset, 0, Time.deltaTime / 2); 143 | lerpOffset = false; 144 | } 145 | MoveCameraTo(camera.transform, FocusTarget.transform, (cameraYaw + yawOffset), cameraPitch + pitchOffset, diff.magnitude); 146 | camera.transform.LookAt(focusPosition + (Vector3.up * cameraYOffset)); 147 | } 148 | 149 | protected virtual void UpdateInput() 150 | { 151 | if (IsFocusing()) 152 | { 153 | pitchOffset = pitchOffset - Input.GetAxis("Mouse Y") * cameraPitchSpeed; 154 | yawOffset = yawOffset + Input.GetAxis("Mouse X") * cameraYawSpeed; 155 | lerpOffset = false; 156 | float radius = maxOffset / 2; 157 | Vector3 newLocation = new Vector3(yawOffset, pitchOffset); 158 | Vector3 centerPosition = new Vector3(0, 0); //center of *black circle* 159 | float distance = Vector3.Distance(newLocation, centerPosition); //distance from ~green object~ to *black circle* 160 | 161 | if (distance > radius) 162 | { 163 | Vector3 fromOriginToObject = newLocation - centerPosition; 164 | fromOriginToObject *= radius / distance; 165 | newLocation = centerPosition + fromOriginToObject; 166 | yawOffset = newLocation.x; 167 | pitchOffset = newLocation.y; 168 | 169 | } 170 | return; 171 | } 172 | cameraPitch -= Input.GetAxis("Mouse Y") * cameraPitchSpeed; 173 | cameraPitch = Mathf.Clamp(cameraPitch, cameraPitchMin, cameraPitchMax); 174 | cameraYaw += Input.GetAxis("Mouse X") * cameraYawSpeed; 175 | cameraYaw = cameraYaw % 360.0f; 176 | } 177 | 178 | protected virtual bool IsFocusing() 179 | { 180 | return FocusTarget != null && Controller.Targeting.focusingTarget; 181 | } 182 | 183 | protected virtual void MoveCameraTo(Transform camera, Transform target, float x, float y, float distanceOffset = 0f) 184 | { 185 | Vector3 newCameraPosition = target.position + (Quaternion.Euler(y, x, 0) * Vector3.back * (distanceOffset + cameraDistance)); 186 | 187 | RaycastHit hitInfo; 188 | LayerMask mask = 1 << LayerMask.NameToLayer("Default") | 1 << LayerMask.NameToLayer("Building"); 189 | if (Physics.Linecast(target.position, newCameraPosition, out hitInfo, mask.value)) 190 | { 191 | newCameraPosition = hitInfo.point; 192 | lerpDistance = true; 193 | } 194 | else if (lerpDistance) 195 | { 196 | float newCameraDistance = Mathf.Lerp(Vector3.Distance(target.position, camera.position), distanceOffset + cameraDistance, 5.0f * Time.deltaTime); 197 | newCameraPosition = target.position + (Quaternion.Euler(y, x, 0) * Vector3.back * newCameraDistance); 198 | } 199 | 200 | camera.position = newCameraPosition; 201 | } 202 | 203 | } -------------------------------------------------------------------------------- /Targeting/TabTargetCameraController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1bdc14ffef5a16a478e3a625be6688c7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Targeting/TabTargetPlayerController.cs: -------------------------------------------------------------------------------- 1 |  2 | using MultiplayerARPG; 3 | using UnityEngine; 4 | 5 | public class TabTargetPlayerController : PlayerCharacterController 6 | { 7 | protected override void Update() 8 | { 9 | TabTargetUpdate(); 10 | } 11 | 12 | protected override void OnPointClickOnGround(Vector3 targetPosition) 13 | { 14 | TabTargetOnPointClickOnGround(targetPosition); 15 | } 16 | 17 | 18 | } -------------------------------------------------------------------------------- /Targeting/TabTargetPlayerController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c60e065fe83ae94586cecf07c70ea9e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Targeting/TabTargeting.cs: -------------------------------------------------------------------------------- 1 | /*******************************************************************/ 2 | /* \project: Spicy Dice 3 | * \author: Amir Azmi 4 | * \date: 11/13/2019 5 | * \brief: Locks onto the closest object when a key F is pressed and 6 | * unlocks when F is pressed again, if the ai gets out of the 7 | * range of the camera collider, then targeting is broken free, 8 | * if the camera gets out of range, then it also breaks free 9 | * You can also cycle targets with the left and right arrow 10 | * key within the Camera.main.fieldOfView range 11 | * 12 | */ 13 | /*******************************************************************/ 14 | 15 | using System.Linq; //Sorting for Orderby 16 | using System.Collections.Generic; 17 | using UnityEngine; 18 | using MultiplayerARPG; 19 | 20 | public class TabTargeting : MonoBehaviour 21 | { 22 | 23 | protected GameObject selectedTarget; //object your targeting 24 | protected GameObject potentialTarget; 25 | public GameObject castingTarget; 26 | 27 | protected readonly List m_CandidateTargets = new List(); //list of candidate game objects 28 | PlayerCharacterController controller; 29 | new SphereCollider collider; 30 | 31 | public bool sortByDistance = true; 32 | 33 | protected GameObject targetRecticle; 34 | protected GameObject aimAssistTarget; 35 | protected float recticleMoveTime = 0f; 36 | protected float recticleFinishTime = 0.5f; 37 | protected bool verticalTargetingInUse; 38 | protected bool horizontalTargetingInUse; 39 | 40 | public bool focusingTarget; 41 | 42 | 43 | 44 | public bool IsTargeting 45 | { 46 | get 47 | { 48 | return selectedTarget != null || potentialTarget != null; 49 | } 50 | } 51 | public GameObject SelectedTarget 52 | { 53 | get 54 | { 55 | return selectedTarget; 56 | } 57 | } 58 | public GameObject PotentialTarget 59 | { 60 | get 61 | { 62 | return potentialTarget; 63 | } 64 | } 65 | public GameObject CastingTarget 66 | { 67 | get 68 | { 69 | return castingTarget; 70 | } 71 | set 72 | { 73 | castingTarget = value; 74 | } 75 | } 76 | 77 | protected bool targeting; 78 | 79 | 80 | protected BasePlayerCharacterEntity playerEntity; 81 | 82 | public BasePlayerCharacterEntity PlayerEntity 83 | { 84 | get 85 | { 86 | if (playerEntity == null) 87 | playerEntity = BasePlayerCharacterController.Singleton.PlayerCharacterEntity; 88 | return playerEntity; 89 | } 90 | } 91 | 92 | public PlayerCharacterController Controller 93 | { 94 | get 95 | { 96 | if (controller == null) 97 | controller = BasePlayerCharacterController.Singleton as PlayerCharacterController; 98 | return controller; 99 | } 100 | } 101 | 102 | public void UpdateTargeting() 103 | { 104 | if (castingTarget && !PlayerEntity.IsAttackingOrUsingSkill) 105 | castingTarget = null; 106 | } 107 | 108 | private void Update() 109 | { 110 | if (InputManager.GetButtonDown("FocusTarget")) 111 | { 112 | focusingTarget = !focusingTarget; 113 | } 114 | if (!selectedTarget) 115 | { 116 | focusingTarget = false; 117 | } 118 | } 119 | 120 | 121 | void LateUpdate() 122 | { 123 | if (targetRecticle) 124 | { 125 | if (potentialTarget != null) 126 | { 127 | targeting = true; 128 | recticleMoveTime += Time.deltaTime; 129 | if (!targetRecticle.transform.GetChild(0).gameObject.activeSelf) 130 | targetRecticle.transform.GetChild(0).gameObject.SetActive(true); 131 | targetRecticle.transform.position = Vector3.Lerp(targetRecticle.transform.position, GetCenter(potentialTarget), recticleMoveTime / recticleFinishTime); 132 | } 133 | else 134 | { 135 | if (targetRecticle.transform.GetChild(0).gameObject.activeSelf) 136 | targetRecticle.transform.GetChild(0).gameObject.SetActive(false); 137 | if (selectedTarget == null && potentialTarget == null) 138 | targetRecticle.transform.position = GetCenter(BasePlayerCharacterController.OwningCharacter.gameObject); 139 | } 140 | } 141 | if (Controller.aimAssistTarget) 142 | { 143 | if (selectedTarget && focusingTarget) 144 | { 145 | aimAssistTarget.transform.position = GetCenter(selectedTarget); 146 | aimAssistTarget.SetActive(true); 147 | } 148 | else 149 | { 150 | aimAssistTarget.SetActive(false); 151 | } 152 | } 153 | } 154 | 155 | protected virtual bool TryGetButtonDown(string name) 156 | { 157 | if (InputManager.HasInputSetting(name)) 158 | { 159 | return InputManager.GetButtonDown(name); 160 | } 161 | return false; 162 | } 163 | protected virtual bool IsTargetButtonPressed() 164 | { 165 | return InputManager.GetAxis("TargetHorizontal", true) != 0.0f || TryGetButtonDown("TargetNext") || TryGetButtonDown("TargetPrevious") || TryGetButtonDown("Target") || TryGetButtonDown("Activate"); 166 | } 167 | 168 | protected virtual bool IsTargetNextPressed() 169 | { 170 | return (InputManager.GetAxis("TargetHorizontal", true) > 0.0f || (TryGetButtonDown("TargetNext"))); 171 | } 172 | protected virtual bool IsTargetPreviousPressed() 173 | { 174 | return (InputManager.GetAxis("TargetHorizontal", true) < 0.0f || (TryGetButtonDown("TargetPrevious"))); 175 | } 176 | 177 | protected virtual void Start() 178 | { 179 | 180 | gameObject.transform.localPosition = new Vector3(0, 0, 0); 181 | collider = gameObject.AddComponent(); 182 | collider.radius = Mathf.Max(BasePlayerCharacterController.OwningCharacter.GetAttackDistance(false), Controller.TargetDistance); 183 | collider.isTrigger = true; 184 | targetRecticle = GameObject.Find("Recticle"); 185 | targetRecticle = targetRecticle != null ? targetRecticle : Instantiate(Controller.recticle, new Vector3(0, 0, 0), Quaternion.identity); 186 | targetRecticle.name = "Recticle"; 187 | targetRecticle.layer = LayerMask.NameToLayer("CharacterUI"); 188 | if (Controller.aimAssistTarget) 189 | { 190 | aimAssistTarget = GameObject.Find("AimAssistTarget"); 191 | aimAssistTarget = aimAssistTarget != null ? aimAssistTarget : Instantiate(Controller.aimAssistTarget, new Vector3(0, 0, 0), Quaternion.identity); 192 | aimAssistTarget.name = "AimAssistTarget"; 193 | aimAssistTarget.SetActive(false); 194 | } 195 | 196 | } 197 | 198 | protected virtual float GetDistanceWeight(GameObject go) 199 | { 200 | float distance = (go.transform.position - transform.position).magnitude; 201 | if (distance > 40) 202 | return distance * 16; 203 | if (distance > 20) 204 | return distance * 8; 205 | if (distance > 10) 206 | return distance * 4; 207 | return distance; 208 | } 209 | 210 | protected virtual float GetAngleWeight(GameObject go) 211 | { 212 | 213 | float angle = GetAngle(go); 214 | if (angle > 120) 215 | return angle * 48; 216 | if (angle > 90) 217 | return angle * 32; 218 | if (angle > Camera.main.fieldOfView) 219 | return angle * 16; 220 | return angle; 221 | } 222 | 223 | protected virtual float GetSortWeight(GameObject go, bool cycling = false) 224 | { 225 | if (cycling) 226 | { 227 | Vector2 screenPosition = Camera.main.WorldToScreenPoint(go.transform.position); 228 | return screenPosition.x; //get the angle between the two vectors with higher being to the left and lower being to the right 229 | } 230 | return GetDistanceWeight(go) + GetAngleWeight(go); //get the angle between the two vectors 231 | } 232 | 233 | protected virtual float GetAngle(GameObject go, Transform transForm = null) 234 | { 235 | Transform origin = transForm != null ? transForm : Camera.main.transform; 236 | Vector3 target_direction = go.transform.position - origin.position; //get vector from player to target 237 | var camera_forward = new Vector2(Camera.main.transform.forward.x, Camera.main.transform.forward.z); //convert camera forward direction into 2D vector 238 | var target_dir = new Vector2(target_direction.x, target_direction.z); //do the same with target direction 239 | return Vector2.Angle(camera_forward, target_dir); //get the angle between the two vectors with higher being to the left and lower being to the right 240 | } 241 | protected virtual void PickNextTarget(List list, bool right = true) 242 | { 243 | GameObject targetToCheck = (potentialTarget != null ? potentialTarget : selectedTarget); 244 | bool hasValidTarget = targetToCheck ? targetToCheck?.activeInHierarchy == true : false; 245 | int index = hasValidTarget ? list.IndexOf(targetToCheck) : 0; 246 | if (list.Count > 0) 247 | { 248 | if (!hasValidTarget) 249 | HighlightPotentialTarget(list[0]); 250 | else 251 | { 252 | index += right ? 1 : -1; 253 | if (index < 0) 254 | index = list.Count - 1; 255 | if (index > list.Count - 1) 256 | index = 0; 257 | HighlightPotentialTarget(list[index]); 258 | } 259 | } 260 | } 261 | 262 | public virtual void HandleTargeting() 263 | { 264 | // remove null objects in the list and decrement the counter 265 | // Could optimize through some onDelete event system, probably really not worth 266 | for (int i = m_CandidateTargets.Count - 1; i >= 0; --i) 267 | { 268 | if (m_CandidateTargets[i] == null || !m_CandidateTargets[i].activeInHierarchy) 269 | { 270 | m_CandidateTargets.RemoveAt(i); 271 | } 272 | } 273 | if ((selectedTarget != null || potentialTarget != null) && InputManager.GetButtonUp("Cancel") && !Controller.uisOpen) 274 | { 275 | if (potentialTarget != null) 276 | UnHighlightPotentialTarget(); 277 | else 278 | UnTarget(selectedTarget); 279 | return; 280 | } 281 | 282 | if (TryGetButtonDown("Activate")) 283 | { 284 | if (m_CandidateTargets.Count > 0) 285 | { 286 | if (potentialTarget != null) 287 | Target(potentialTarget); 288 | else if (selectedTarget == null) 289 | TargetClosest(); 290 | else 291 | Controller.Activate(); 292 | } 293 | return; 294 | } 295 | if (IsTargetNextPressed() || IsTargetPreviousPressed()) 296 | { 297 | if (!horizontalTargetingInUse) 298 | { 299 | horizontalTargetingInUse = true; 300 | if (m_CandidateTargets.Count > 0) 301 | { 302 | if (potentialTarget == Controller.PlayerCharacterEntity.gameObject || (potentialTarget == null && selectedTarget == null)) 303 | TargetClosest(true); 304 | else 305 | TargetNextBasedOnDirection(); 306 | } 307 | } 308 | return; 309 | } 310 | else 311 | horizontalTargetingInUse = false; 312 | 313 | 314 | if (InputManager.GetAxis("TargetVertical", true) != 0.0f) 315 | { 316 | if (!verticalTargetingInUse) 317 | { 318 | verticalTargetingInUse = true; 319 | if (Controller.PlayerCharacterEntity.PartyId > 0) 320 | { 321 | PartyData tempPartyData; 322 | Controller.PlayerCharacterEntity.CurrentGameManager.TryGetParty(Controller.PlayerCharacterEntity.PartyId, out tempPartyData); 323 | SocialCharacterData[] members; 324 | tempPartyData.GetSortedMembers(out members); 325 | PickNextTarget(GetPartyMembersInView(members), InputManager.GetAxis("TargetVertical", true) > 0.0f); 326 | } 327 | else 328 | { 329 | HighlightPotentialTarget(Controller.PlayerCharacterEntity.gameObject); 330 | } 331 | return; 332 | } 333 | } 334 | else 335 | verticalTargetingInUse = false; 336 | 337 | if (IsTargetButtonPressed()) 338 | { 339 | if (m_CandidateTargets.Count > 0) 340 | { 341 | if (potentialTarget == null && selectedTarget == null) 342 | TargetClosest(true); 343 | else 344 | TargetNextBasedOnDirection(); 345 | } 346 | } 347 | } 348 | 349 | protected virtual void TargetNextBasedOnDirection() 350 | { 351 | List objectsInView = SortObjectsInView(true); 352 | if (objectsInView.Count > 0) 353 | { 354 | PickNextTarget(objectsInView, IsTargetNextPressed()); 355 | } 356 | } 357 | 358 | protected virtual void TargetClosest(bool potential = false) 359 | { 360 | List objectsInView = SortObjectsInView(false); 361 | 362 | if (objectsInView.Count > 0) 363 | { 364 | if (potential) 365 | { 366 | HighlightPotentialTarget(objectsInView.First()); 367 | } 368 | else 369 | { 370 | Target(objectsInView.First()); 371 | selectedTarget = objectsInView.First(); 372 | } 373 | } 374 | } 375 | 376 | protected virtual Vector3 GetCenter(GameObject go) 377 | { 378 | CapsuleCollider obj = go.GetComponentInChildren(); 379 | return obj != null ? obj.bounds.center : go.transform.position; 380 | } 381 | protected virtual List GetPartyMembersInView(SocialCharacterData[] partyMembers) 382 | { 383 | List party = new List(); 384 | party.Add(Controller.PlayerCharacterEntity.gameObject); 385 | for (int i = 0; i < m_CandidateTargets.Count; i++) 386 | { 387 | foreach (SocialCharacterData partyMember in partyMembers) 388 | { 389 | BasePlayerCharacterEntity entity = m_CandidateTargets[i].GetComponent(); 390 | if (entity != null) 391 | { 392 | if (entity.DataId == partyMember.dataId) 393 | party.Add(entity.gameObject); 394 | } 395 | } 396 | } 397 | return party; 398 | } 399 | protected virtual List SortObjectsInView(bool cycling = false) 400 | { 401 | List Sorted_List = m_CandidateTargets.OrderBy(go => GetSortWeight(go, cycling)).ToList(); 402 | List objectsInView = new List(); 403 | 404 | for (var i = 0; i < Sorted_List.Count(); ++i) 405 | { 406 | IDamageableEntity damageable = Sorted_List[i].GetComponent(); 407 | BaseGameEntity agent = Sorted_List[i].GetComponentInParent(); 408 | if ((agent == null && damageable == null) || (bool)(damageable != null && damageable.IsHideOrDead())) 409 | continue; 410 | Vector2 screenPosition = Camera.main.WorldToScreenPoint(Sorted_List[i].transform.position); 411 | // Entity is within the screen (no targeting offscreen) 412 | if (screenPosition.x > 0 && screenPosition.x < Screen.width && screenPosition.y > 0 && screenPosition.y < Screen.height && Sorted_List[i].activeInHierarchy) 413 | { 414 | // MAKE SURE ALL NON-COLLIDING ENTITIES ARE OFF OF THE DEFAULT LAYER PLEASE 415 | // If this does not work, change the layer for playercharactercontroller to Player or something 416 | LayerMask mask = 1 << LayerMask.NameToLayer("Default") | 1 << LayerMask.NameToLayer("Building"); 417 | bool didHit = Physics.Linecast(Controller.CacheGameplayCamera.transform.position, GetCenter(Sorted_List[i]), mask); 418 | if (!didHit) 419 | { 420 | objectsInView.Add(Sorted_List[i]); 421 | } 422 | } 423 | } 424 | Debug.Log(objectsInView.Count); 425 | return objectsInView; 426 | } 427 | 428 | protected virtual void OnTriggerEnter(Collider other) 429 | { 430 | if (other.tag == "MonsterTag" || other.tag == "HarvestableTag" || other.tag == "NpcTag" || other.tag == "PlayerTag") 431 | { 432 | if (other.gameObject.activeInHierarchy) 433 | { 434 | BaseGameEntity agent = other.gameObject.GetComponent(); 435 | if (agent != null) 436 | { 437 | m_CandidateTargets.Add(other.gameObject); 438 | } 439 | } 440 | } 441 | } 442 | 443 | protected virtual void OnTriggerExit(Collider other) 444 | { 445 | if (m_CandidateTargets.IndexOf(other.gameObject) != -1) 446 | { 447 | m_CandidateTargets.Remove(other.gameObject); 448 | UnTarget(other.gameObject); 449 | } 450 | } 451 | 452 | public virtual void HighlightPotentialTarget(GameObject enemy) 453 | { 454 | recticleMoveTime = 0; 455 | if (enemy != null) 456 | potentialTarget = enemy; 457 | } 458 | public virtual void UnHighlightPotentialTarget() 459 | { 460 | recticleMoveTime = 0; 461 | if (potentialTarget != null) 462 | potentialTarget = null; 463 | } 464 | 465 | 466 | public virtual void Target(GameObject enemy) 467 | { 468 | if (enemy != null) 469 | { 470 | BaseGameEntity agent = enemy.GetComponentInParent(); 471 | 472 | if (agent != null) 473 | { 474 | if (selectedTarget != null && selectedTarget == enemy) 475 | UnTarget(selectedTarget); 476 | selectedTarget = enemy; 477 | if (potentialTarget == selectedTarget) 478 | potentialTarget = null; 479 | if (agent is BaseCharacterEntity) 480 | { 481 | recticleMoveTime = 0; 482 | BaseCharacterEntity character = agent as BaseCharacterEntity; 483 | character.OnTargeted(GetComponent()); 484 | character.CharacterDied.AddListener(AgentDies); 485 | } 486 | } 487 | } 488 | } 489 | 490 | public virtual void UnTarget(GameObject enemy, bool deselect = true) 491 | { 492 | if (enemy != null) 493 | { 494 | var agent = enemy.GetComponentInParent(); 495 | 496 | if (agent != null) 497 | { 498 | if (agent is BaseCharacterEntity) 499 | { 500 | BaseCharacterEntity character = agent as BaseCharacterEntity; 501 | character.OnUnTargeted(GetComponent()); 502 | character.CharacterDied.RemoveListener(AgentDies); 503 | } 504 | if (selectedTarget == enemy) 505 | { 506 | if (deselect) 507 | { 508 | selectedTarget = null; 509 | targeting = false; 510 | } 511 | recticleMoveTime = 0; 512 | } 513 | } 514 | } 515 | } 516 | 517 | protected virtual void AgentDies(BaseGameEntity agent) 518 | { 519 | m_CandidateTargets.Remove(agent.gameObject.gameObject); 520 | if (castingTarget == agent.gameObject) 521 | castingTarget = null; 522 | if (potentialTarget == agent.gameObject) 523 | UnHighlightPotentialTarget(); 524 | UnTarget(agent.gameObject); 525 | } 526 | 527 | 528 | } -------------------------------------------------------------------------------- /Targeting/TabTargeting.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6783c3dc1e6d2d247a2245f21ef9fdb0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Targeting/frame-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/game-arch/mmorpg-kit-snippets/9b6e48a318032d465f0284b433c1506aa95588e7/Targeting/frame-0.png -------------------------------------------------------------------------------- /Targeting/frame-0.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2e94e1b027154e642ae29e7c2dc38151 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | vTOnly: 0 27 | grayScaleToAlpha: 0 28 | generateCubemap: 6 29 | cubemapConvolution: 0 30 | seamlessCubemap: 0 31 | textureFormat: 1 32 | maxTextureSize: 2048 33 | textureSettings: 34 | serializedVersion: 2 35 | filterMode: -1 36 | aniso: 1 37 | mipBias: -100 38 | wrapU: 1 39 | wrapV: 1 40 | wrapW: -1 41 | nPOTScale: 0 42 | lightmap: 0 43 | compressionQuality: 50 44 | spriteMode: 1 45 | spriteExtrude: 1 46 | spriteMeshType: 1 47 | alignment: 0 48 | spritePivot: {x: 0.5, y: 0.5} 49 | spritePixelsToUnits: 100 50 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 51 | spriteGenerateFallbackPhysicsShape: 1 52 | alphaUsage: 1 53 | alphaIsTransparency: 1 54 | spriteTessellationDetail: -1 55 | textureType: 8 56 | textureShape: 1 57 | singleChannelComponent: 0 58 | maxTextureSizeSet: 0 59 | compressionQualitySet: 0 60 | textureFormatSet: 0 61 | ignorePngGamma: 0 62 | applyGammaDecoding: 0 63 | platformSettings: 64 | - serializedVersion: 3 65 | buildTarget: DefaultTexturePlatform 66 | maxTextureSize: 2048 67 | resizeAlgorithm: 0 68 | textureFormat: -1 69 | textureCompression: 1 70 | compressionQuality: 50 71 | crunchedCompression: 0 72 | allowsAlphaSplitting: 0 73 | overridden: 0 74 | androidETC2FallbackOverride: 0 75 | forceMaximumCompressionQuality_BC6H_BC7: 0 76 | - serializedVersion: 3 77 | buildTarget: Standalone 78 | maxTextureSize: 2048 79 | resizeAlgorithm: 0 80 | textureFormat: -1 81 | textureCompression: 1 82 | compressionQuality: 50 83 | crunchedCompression: 0 84 | allowsAlphaSplitting: 0 85 | overridden: 0 86 | androidETC2FallbackOverride: 0 87 | forceMaximumCompressionQuality_BC6H_BC7: 0 88 | - serializedVersion: 3 89 | buildTarget: WebGL 90 | maxTextureSize: 2048 91 | resizeAlgorithm: 0 92 | textureFormat: -1 93 | textureCompression: 1 94 | compressionQuality: 50 95 | crunchedCompression: 0 96 | allowsAlphaSplitting: 0 97 | overridden: 0 98 | androidETC2FallbackOverride: 0 99 | forceMaximumCompressionQuality_BC6H_BC7: 0 100 | spriteSheet: 101 | serializedVersion: 2 102 | sprites: [] 103 | outline: [] 104 | physicsShape: [] 105 | bones: [] 106 | spriteID: 5e97eb03825dee720800000000000000 107 | internalID: 0 108 | vertices: [] 109 | indices: 110 | edges: [] 111 | weights: [] 112 | secondaryTextures: [] 113 | spritePackingTag: 114 | pSDRemoveMatte: 0 115 | pSDShowRemoveMatteOption: 0 116 | userData: 117 | assetBundleName: 118 | assetBundleVariant: 119 | -------------------------------------------------------------------------------- /Tooltips.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ac337cb3ec18cc4e9434a40ab2c686d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Tooltips/CanvasGameplay.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd2a5bf00fa7d3d44b2668bfb26b13fc 3 | timeCreated: 1520184457 4 | licenseType: Store 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 100100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Tooltips/README.md: -------------------------------------------------------------------------------- 1 | ### Tooltips 2 | 3 | #### Instructions 4 | - Drag the TooltipConfig prefab onto your CanvasGameplay 5 | - Add TooltipArea to GameObjects with the UICharacterItem or UICharacterSkill script 6 | - For equipment currently equipped, put the TooltipArea on the EquipSlot game objects (the nested UIItemIcon does not work) 7 | - I have included several prefabs to see how its added 8 | - The tooltips will appear either to the left or right of the element based on the distance from the side of the screen 9 | - The tooltips will appear higher or lower on the screen based on if the tooltip will be fully seen in the screen -------------------------------------------------------------------------------- /Tooltips/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd2ba0ea8a04d224da43c9b008a9f8e1 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Tooltips/TooltipArea.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using MultiplayerARPG; 4 | using UnityEngine; 5 | using UnityEngine.EventSystems; 6 | using UnityEngine.UI; 7 | 8 | namespace Tooltips 9 | { 10 | public class TooltipArea : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler 11 | { 12 | static Canvas canvas; 13 | protected UICharacterItem item; 14 | protected UICharacterSkill skill; 15 | protected UICharacterItem uiCharacterItem 16 | { 17 | get 18 | { 19 | if (item == null) 20 | item = GetComponent(); 21 | return item; 22 | } 23 | } 24 | protected UICharacterSkill uiCharacterSkill 25 | { 26 | get 27 | { 28 | if (skill == null) 29 | skill = GetComponent(); 30 | return skill; 31 | } 32 | } 33 | 34 | protected UIBase instance; 35 | protected Renderer uiRenderer; 36 | // Start is called before the first frame update 37 | void OnEnable() 38 | { 39 | if (instance == null) 40 | { 41 | if (TooltipConfig.Singleton?.uiItemDialog != null && uiCharacterItem != null) 42 | instance = TooltipConfig.Singleton.uiItemDialog; 43 | if (TooltipConfig.Singleton?.uiSkillDialog != null && uiCharacterSkill != null) 44 | instance = TooltipConfig.Singleton.uiSkillDialog; 45 | if (instance != null) 46 | { 47 | uiRenderer = instance.GetComponent(); 48 | } 49 | } 50 | } 51 | void OnDisable() 52 | { 53 | 54 | } 55 | 56 | 57 | void CalculateTooltipPosition() 58 | { 59 | if (canvas == null) 60 | canvas = Object.FindObjectOfType()?.GetComponent(); 61 | float scale = canvas.scaleFactor; 62 | RectTransform parentRect = GetComponent(); 63 | RectTransform rect = instance.GetComponent(); 64 | float halfWidth = rect.rect.width / 2 * scale; 65 | float halfHeight = rect.rect.height / 2 * scale; 66 | float parentHalfWidth = parentRect.rect.width / 2 * scale; 67 | float parentHalfHeight = parentRect.rect.height / 2 * scale; 68 | float screenWidth = Screen.width; 69 | float screenHeight = Screen.height; 70 | float xPos = transform.position.x + parentHalfWidth + halfWidth; 71 | float yPos = transform.position.y; 72 | if (xPos + halfWidth > screenWidth) 73 | xPos = transform.position.x - parentHalfWidth - halfWidth; 74 | if (transform.position.y + halfHeight > screenHeight) 75 | yPos = transform.position.y + halfHeight + (screenHeight - (transform.position.y + halfHeight)); 76 | if (transform.position.y - halfHeight < 0) 77 | yPos = transform.position.y - (transform.position.y - halfHeight); 78 | instance.transform.position = new Vector3(xPos, yPos, 0); 79 | if (!instance.gameObject.activeSelf) 80 | instance.gameObject.SetActive(true); 81 | 82 | } 83 | 84 | 85 | public void OnPointerEnter(PointerEventData eventData) 86 | { 87 | if (instance != null && !instance.gameObject.activeSelf) 88 | { 89 | if (instance is UICharacterItem && uiCharacterItem.Data.characterItem?.GetItem() != null) 90 | { 91 | UICharacterItem ui = instance as UICharacterItem; 92 | ui.Setup(uiCharacterItem.Data, uiCharacterItem.Character, uiCharacterItem.IndexOfData); 93 | CalculateTooltipPosition(); 94 | } 95 | if (instance is UICharacterSkill && uiCharacterSkill.Data.characterSkill?.GetSkill() != null) 96 | { 97 | UICharacterSkill ui = instance as UICharacterSkill; 98 | ui.Setup(uiCharacterSkill.Data, uiCharacterSkill.Character, uiCharacterSkill.IndexOfData); 99 | CalculateTooltipPosition(); 100 | } 101 | } 102 | } 103 | public void OnPointerExit(PointerEventData eventData) 104 | { 105 | if (instance != null && instance.gameObject.activeSelf) 106 | { 107 | instance.gameObject.SetActive(false); 108 | } 109 | } 110 | } 111 | } -------------------------------------------------------------------------------- /Tooltips/TooltipArea.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 964b4b47a803d89499d908b6cc0f8671 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tooltips/TooltipConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using MultiplayerARPG; 5 | 6 | namespace Tooltips 7 | { 8 | public class TooltipConfig : MonoBehaviour 9 | { 10 | 11 | public UICharacterItem uiItemDialog; 12 | public UICharacterSkill uiSkillDialog; 13 | 14 | public static TooltipConfig Singleton { get; protected set; } 15 | // Start is called before the first frame update 16 | void Start() 17 | { 18 | Singleton = this; 19 | } 20 | 21 | // Update is called once per frame 22 | void Update() 23 | { 24 | 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Tooltips/TooltipConfig.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79f6852cf2b5f154993062fe000b1d28 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tooltips/TooltipConfig.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0128a2c840246c54a8b7540a9540917c 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Tooltips/UICharacterSkill.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f3f546e485a67247a4b6476ceb0ff08 3 | timeCreated: 1520361104 4 | licenseType: Store 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 100100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Tooltips/UIItemDialog.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6c0c3fb758b7d640b587bf547e3e2c5 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Tooltips/UIItemIcon.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a1ccaa69d4d6a24bb446f70fc3a1e42 3 | timeCreated: 1520191362 4 | licenseType: Store 5 | NativeFormatImporter: 6 | externalObjects: {} 7 | mainObjectFileID: 100100000 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Tooltips/UISkillDialog.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 739be37273674cf4893bf2ea6539c903 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 784a822bde6d71d41bb270b57f7ffd01 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UI/BaseHandleBehavior.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using UnityEngine.EventSystems; 4 | using UnityEngine.UI; 5 | 6 | namespace UI 7 | { 8 | 9 | [RequireComponent(typeof(HandleTarget))] 10 | public abstract class BaseHandleBehavior : MonoBehaviour 11 | { 12 | 13 | protected GameObject target; 14 | protected RectTransform rectTransform; 15 | 16 | protected Vector2 lastPosition; 17 | protected bool hasLastPosition; 18 | 19 | protected bool dragging; 20 | public void Start() 21 | { 22 | HandleTarget dt = GetComponent(); 23 | if (dt) 24 | { 25 | target = dt.target; 26 | rectTransform = target.GetComponent(); 27 | } 28 | } 29 | public void OnMouseDown() { 30 | dragging = true; 31 | hasLastPosition = false; 32 | } 33 | public void OnMouseUp() { 34 | dragging = false; 35 | hasLastPosition = false; 36 | } 37 | void FixedUpdate() { 38 | if (dragging) { 39 | OnDrag(); 40 | lastPosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y); 41 | hasLastPosition = true; 42 | } 43 | } 44 | 45 | protected void OnDrag() 46 | { 47 | if (hasLastPosition) { 48 | Vector2 delta = new Vector2( 49 | Input.mousePosition.x - lastPosition.x, 50 | Input.mousePosition.y - lastPosition.y 51 | ); 52 | OnHandleChange(delta, rectTransform); 53 | } 54 | } 55 | 56 | protected abstract void OnHandleChange(Vector2 delta, RectTransform rectTransform); 57 | } 58 | } -------------------------------------------------------------------------------- /UI/BaseHandleBehavior.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9447a4d1d9b284fd58b093c40fd914e3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UI/DragWindow.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.EventSystems; 3 | using UnityEngine.UI; 4 | 5 | namespace UI 6 | { 7 | public class DragWindow : BaseHandleBehavior 8 | { 9 | 10 | protected override void OnHandleChange(Vector2 delta, RectTransform rectTransform) 11 | { 12 | target.transform.position = new Vector2(target.transform.position.x + delta.x, target.transform.position.y + delta.y); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /UI/DragWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bbc3157374a15ab4ead141a0ff5c06e0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UI/HandleTarget.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.EventSystems; 5 | 6 | namespace UI 7 | { 8 | public class HandleTarget : MonoBehaviour 9 | { 10 | 11 | public GameObject target; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /UI/HandleTarget.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e962d193a100c4d0d81e6e9eeaebe42e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UI/ResizeWindow.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.EventSystems; 3 | using UnityEngine.UI; 4 | 5 | namespace UI 6 | { 7 | public class ResizeWindow : BaseHandleBehavior 8 | { 9 | 10 | protected override void OnHandleChange(Vector2 delta, RectTransform rectTransform) 11 | { 12 | rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, rectTransform.rect.width + (delta.x / 1.42f)); 13 | rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, rectTransform.rect.height + (delta.y / 1.42f)); 14 | 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /UI/ResizeWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e0c0e3ca07eb4d9caf19ee59e31d64d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.jwhenry3.snippets", 3 | "version": "1.0.6", 4 | "displayName": "MMORPG Kit Snippets", 5 | "description": "Utility scripts and components for the everyman.", 6 | "unity": "2019.3", 7 | "keywords": ["mmorpg", "kit", "jwhenry", "snippet", "suragata"] 8 | } 9 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c4f7ba2c689a304798b5689f8ab0c46 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------