diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index 18b383b8..05e4935c 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -11,7 +11,8 @@ 10.0.20506 2.0 - {F58AF4E0-3E6D-54B1-523D-8F755DC8E665} + {e0f48af5-6d3e-b154-523d-8f755dc8e665} + {E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Library Properties Assembly-CSharp @@ -27,8 +28,9 @@ DEBUG;TRACE;UNITY_2020_3_32;UNITY_2020_3;UNITY_2020;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;UNITY_2020_3_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;USE_SEARCH_ENGINE_API;SCENE_TEMPLATE_MODULE;ENABLE_AR;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_EVENT_QUEUE;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_VIRTUALTEXTURING;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_UNITYTLS;INCLUDE_DYNAMIC_GI;ENABLE_MONO_BDWGC;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;PLATFORM_STANDALONE;PLATFORM_STANDALONE_WIN;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;PLATFORM_UPDATES_TIME_OUTSIDE_OF_PLAYER_LOOP;GFXDEVICE_WAITFOREVENT_MESSAGEPUMP;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_STANDARD_2_0;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER prompt 4 - 0169 + False + False pdbonly @@ -36,8 +38,9 @@ Temp\bin\Release\ prompt 4 - 0169 + False + False true @@ -734,6 +737,7 @@ C:/Program Files/Unity/Hub/Editor/2020.3.32f1/Editor/Data/NetStandard/compat/2.0.0/shims/netfx/System.Xml.Serialization.dll +<<<<<<< HEAD C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Editor.dll @@ -822,6 +826,96 @@ C:/Users/alicj/OneDrive/Desktop/x/Scriptum/Library/ScriptAssemblies/Unity.2D.SpriteShape.Runtime.dll +======= + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.InternalAPIEngineBridge.001.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.VSCode.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.PixelPerfect.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.Tilemap.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/PsdPlugin.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.TextMeshPro.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.VisualStudio.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.Timeline.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.TextMeshPro.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.IK.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.Sprite.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.Psdimporter.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.Path.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.InternalAPIEditorBridge.001.dll + + + C:/Scriptum/Library/ScriptAssemblies/UnityEditor.UI.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.PlasticSCM.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.Rider.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/UnityEngine.UI.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.Mathematics.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.IK.Runtime.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Triangle.Runtime.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Runtime.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.PixelPerfect.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.Timeline.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.Mathematics.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.Common.Runtime.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.SpriteShape.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.Common.Editor.dll + + + C:/Scriptum/Library/ScriptAssemblies/Unity.2D.SpriteShape.Runtime.dll +>>>>>>> jakszt-thuganimations diff --git a/Assets/Resources/SampleScene/Enemies/BossThug.prefab b/Assets/Resources/SampleScene/Enemies/BossThug.prefab index 4fb0d625..70ef36d9 100644 --- a/Assets/Resources/SampleScene/Enemies/BossThug.prefab +++ b/Assets/Resources/SampleScene/Enemies/BossThug.prefab @@ -16,6 +16,7 @@ GameObject: - component: {fileID: 5064228440392526989} - component: {fileID: 482428332992622006} - component: {fileID: 482428332992622001} + - component: {fileID: -4365747932373452915} m_Layer: 0 m_Name: BossThug m_TagString: NPC @@ -207,6 +208,12 @@ MonoBehaviour: chaseRadius: 7 attackRadius: 0.4 homePosition: {fileID: 0} + speed: 0 + shouldRotate: 1 + dir: {x: 0, y: 0, z: 0} + whatisplayer: + serializedVersion: 2 + m_Bits: 0 roundingDistance: 0 anim: {fileID: 0} other: {fileID: 0} @@ -218,6 +225,7 @@ MonoBehaviour: isKilled: 0 isKilled2: 0 isPanelEnabled: 0 + expValue: 0 --- !u!114 &482428332992622001 MonoBehaviour: m_ObjectHideFlags: 0 @@ -232,5 +240,26 @@ MonoBehaviour: m_EditorClassIdentifier: npc1: {fileID: 0} npc2: {fileID: 0} + animator: {fileID: 0} + newController: {fileID: 0} isAfterConversation: 0 state: 0 +--- !u!95 &-4365747932373452915 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 482428332992622009} + m_Enabled: 0 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 4e408ead2b862ca4685d5ace7011f083, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 diff --git a/Assets/Resources/SampleScene/Enemies/Thug.prefab b/Assets/Resources/SampleScene/Enemies/Thug.prefab index 5b1c36d9..04f7e2b1 100644 --- a/Assets/Resources/SampleScene/Enemies/Thug.prefab +++ b/Assets/Resources/SampleScene/Enemies/Thug.prefab @@ -94,14 +94,14 @@ Rigidbody2D: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4006076606190978600} - m_BodyType: 1 + m_BodyType: 0 m_Simulated: 1 m_UseFullKinematicContacts: 0 m_UseAutoMass: 0 m_Mass: 1 m_LinearDrag: 0 m_AngularDrag: 0.05 - m_GravityScale: 1 + m_GravityScale: 0 m_Material: {fileID: 0} m_Interpolate: 0 m_SleepingMode: 1 @@ -154,8 +154,14 @@ MonoBehaviour: chaseRadius: 5 attackRadius: 0.5 homePosition: {fileID: 0} + speed: 0 + shouldRotate: 1 + dir: {x: 0, y: 0, z: 0} + whatisplayer: + serializedVersion: 2 + m_Bits: 1 roundingDistance: 0.1 - anim: {fileID: 0} + anim: {fileID: 4006076606190978598} other: {fileID: 0} inRange: 0 hit: 0 @@ -165,6 +171,7 @@ MonoBehaviour: isKilled: 0 isKilled2: 0 isPanelEnabled: 1 + expValue: 0 --- !u!95 &4006076606190978598 Animator: serializedVersion: 3 @@ -175,7 +182,7 @@ Animator: m_GameObject: {fileID: 4006076606190978600} m_Enabled: 1 m_Avatar: {fileID: 0} - m_Controller: {fileID: 9100000, guid: 70ff19ea203dbb34b90ed8b222e428a8, type: 2} + m_Controller: {fileID: 9100000, guid: d3ee7fa12d1293d4f86d1a73da19c0b8, type: 2} m_CullingMode: 0 m_UpdateMode: 0 m_ApplyRootMotion: 0 diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index fe74d9b2..e36d6c07 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -880,6 +880,12 @@ MonoBehaviour: chaseRadius: 5 attackRadius: 0.5 homePosition: {fileID: 1928316356} + speed: 0 + shouldRotate: 0 + dir: {x: 0, y: 0, z: 0} + whatisplayer: + serializedVersion: 2 + m_Bits: 0 roundingDistance: 0 anim: {fileID: 0} other: {fileID: 0} @@ -26209,6 +26215,12 @@ MonoBehaviour: chaseRadius: 6 attackRadius: 0.5 homePosition: {fileID: 2060891298} + speed: 0 + shouldRotate: 0 + dir: {x: 0, y: 0, z: 0} + whatisplayer: + serializedVersion: 2 + m_Bits: 0 roundingDistance: 0 anim: {fileID: 0} other: {fileID: 0} @@ -26499,6 +26511,12 @@ MonoBehaviour: chaseRadius: 8 attackRadius: 0.5 homePosition: {fileID: 1143151251} + speed: 0 + shouldRotate: 0 + dir: {x: 0, y: 0, z: 0} + whatisplayer: + serializedVersion: 2 + m_Bits: 0 roundingDistance: 0 anim: {fileID: 0} other: {fileID: 0} diff --git a/Assets/Scripts/Enemies' Scprits/Cave/BossThug.cs b/Assets/Scripts/Enemies' Scprits/Cave/BossThug.cs index 2e6113e6..325c3caf 100644 --- a/Assets/Scripts/Enemies' Scprits/Cave/BossThug.cs +++ b/Assets/Scripts/Enemies' Scprits/Cave/BossThug.cs @@ -18,6 +18,9 @@ public class BossThug : MonoBehaviour public GameObject npc2; private GameObject player; private GameObject doorway; + public Animator animator; + private Rigidbody2D rb; + public RuntimeAnimatorController newController; public bool isAfterConversation = false; // drop it if you can... @@ -26,6 +29,8 @@ public class BossThug : MonoBehaviour // Start is called before the first frame update void Start() { + rb = GetComponent(); + animator = GetComponent(); npc1 = GameObject.FindObjectsOfType(true).Where(sr => sr.gameObject.name == "ThugBob" && sr.gameObject.tag == "Enemy").ToArray()[0]; npc2 = GameObject.FindObjectsOfType(true).Where(sr => sr.gameObject.name == "ThugBen" && sr.gameObject.tag == "Enemy").ToArray()[0]; player = GameObject.FindGameObjectWithTag("Player"); @@ -71,6 +76,7 @@ public class BossThug : MonoBehaviour private void ActivateKillingMode() { gameObject.GetComponent().enabled=true; + animator.runtimeAnimatorController = Resources.Load("SampleScene/Enemies/BossThugAnimator.controller") as RuntimeAnimatorController; gameObject.GetComponent().baseAttack=1000f; } diff --git a/Assets/Scripts/Enemies' Scprits/FollowingEnemy.cs b/Assets/Scripts/Enemies' Scprits/FollowingEnemy.cs index 6f2f5909..0717b197 100644 --- a/Assets/Scripts/Enemies' Scprits/FollowingEnemy.cs +++ b/Assets/Scripts/Enemies' Scprits/FollowingEnemy.cs @@ -1,6 +1,8 @@ +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.PlayerLoop; public class FollowingEnemy : Enemy { @@ -8,9 +10,14 @@ public class FollowingEnemy : Enemy public float chaseRadius; public float attackRadius; public Transform homePosition; + private Vector2 movement; + public float speed; + public bool shouldRotate; + public Vector3 dir; + public LayerMask whatisplayer; public float roundingDistance; - private Rigidbody2D myRigidbody; + private Rigidbody2D rb; public Animator anim; public GameObject other; @@ -42,6 +49,10 @@ public class FollowingEnemy : Enemy // Start is called before the first frame update void Start() { + //used for animation of sprites + rb = GetComponent(); + anim = GetComponent(); + // if new game set as alive if (OnMapAppearanceMethod.Gateway == OnMapAppearanceMethodEnum.NewGame) { @@ -60,8 +71,8 @@ public class FollowingEnemy : Enemy gameObject.SetActive(false); health = 0; } - myRigidbody = GetComponent(); - anim = GetComponent(); + //rb = GetComponent(); + //anim = GetComponent(); target = GameObject.FindWithTag("Player").transform; other = GameObject.FindWithTag("Player"); @@ -70,6 +81,20 @@ public class FollowingEnemy : Enemy // Update is called once per frame void Update() { + //animation of Sprites + if (Vector2.Distance(target.position, transform.position) <= chaseRadius) + { + dir = target.position - transform.position; + float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg; + dir.Normalize(); + movement = dir; + anim.SetBool("isRunning", movement != Vector2.zero); + if (shouldRotate) + { + anim.SetFloat("Xinfo", dir.x); + anim.SetFloat("Yinfo", dir.y); + } + } CheckDistance(); //StartCoroutine(Timer()); @@ -113,6 +138,22 @@ public class FollowingEnemy : Enemy } + private void FixedUpdate() + { + if (Physics2D.OverlapCircle(transform.position, chaseRadius, whatisplayer)) + { + MoveCharacter(movement); + } + if (Physics2D.OverlapCircle(transform.position, attackRadius, whatisplayer)) + { + rb.velocity = Vector2.zero; + } + } + + private void MoveCharacter(Vector2 dir) + { + rb.MovePosition((Vector2)transform.position + (dir * moveSpeed * Time.deltaTime)); + } void CheckDistance() { if(Vector2.Distance(target.position, transform.position) <= chaseRadius && Vector2.Distance(target.position, transform.position) > attackRadius) diff --git a/Scriptum.sln b/Scriptum.sln index a0073ad3..06cdecf1 100644 --- a/Scriptum.sln +++ b/Scriptum.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{F58AF4E0-3E6D-54B1-523D-8F755DC8E665}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{e0f48af5-6d3e-b154-523d-8f755dc8e665}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -9,10 +9,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F58AF4E0-3E6D-54B1-523D-8F755DC8E665}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F58AF4E0-3E6D-54B1-523D-8F755DC8E665}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F58AF4E0-3E6D-54B1-523D-8F755DC8E665}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F58AF4E0-3E6D-54B1-523D-8F755DC8E665}.Release|Any CPU.Build.0 = Release|Any CPU + {e0f48af5-6d3e-b154-523d-8f755dc8e665}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {e0f48af5-6d3e-b154-523d-8f755dc8e665}.Debug|Any CPU.Build.0 = Debug|Any CPU + {e0f48af5-6d3e-b154-523d-8f755dc8e665}.Release|Any CPU.ActiveCfg = Release|Any CPU + {e0f48af5-6d3e-b154-523d-8f755dc8e665}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index c74da0ec..c781f832 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -18,6 +18,7 @@ EditorUserSettings: value: 22424703114646680e0b0227036c70050204112e291f2f2a2c3b1920caef212be7a923e7ee2e26 flags: 0 RecentlyUsedScenePath-4: +<<<<<<< HEAD value: 22424703114646680e0b0227036c70050204112e291f2f2a2c3b1920caef212be7a923e7ee2e26 flags: 0 RecentlyUsedScenePath-5: @@ -35,6 +36,18 @@ EditorUserSettings: RecentlyUsedScenePath-9: value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d flags: 0 + RecentlyUsedScenePath-6: + value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d + flags: 0 + RecentlyUsedScenePath-7: + value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d + flags: 0 + RecentlyUsedScenePath-8: + value: 22424703114646680e0b0227036c72111f1958072926337e38271427fb + flags: 0 + RecentlyUsedScenePath-9: + value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d + flags: 0 vcSharedLogLevel: value: 0d5e400f0650 flags: 0