diff options
11 files changed, 105 insertions, 689 deletions
diff --git a/AlienSurvival/Assets/Scripts/TopDown/TopDownShadowCaster.cs b/AlienSurvival/Assets/Scripts/TopDown/TopDownShadowCaster.cs index 88c32bb..1c541b9 100644 --- a/AlienSurvival/Assets/Scripts/TopDown/TopDownShadowCaster.cs +++ b/AlienSurvival/Assets/Scripts/TopDown/TopDownShadowCaster.cs @@ -2,7 +2,8 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -[ExecuteInEditMode, DisallowMultipleComponent] +//[ExecuteInEditMode] +[DisallowMultipleComponent] [RequireComponent(typeof(TopDownTransform))] [RequireComponent(typeof(SpriteRenderer))] public class TopDownShadowCaster : MonoBehaviour @@ -32,11 +33,7 @@ public class TopDownShadowCaster : MonoBehaviour GameObject child = this.transform.GetChild(i).gameObject; if (child.name == "shadow") { -#if UNITY_EDITOR - DestroyImmediate(child); -#else Destroy(child); -#endif } } diff --git a/AlienSurvival/Assets/Scripts/TopDown/TopDownTransform.cs b/AlienSurvival/Assets/Scripts/TopDown/TopDownTransform.cs index ce7421a..216f2cf 100644 --- a/AlienSurvival/Assets/Scripts/TopDown/TopDownTransform.cs +++ b/AlienSurvival/Assets/Scripts/TopDown/TopDownTransform.cs @@ -6,7 +6,7 @@ using UnityEditor; #endif /// <summary> -/// 用于TopDown的Transform,支持模拟垂直高度 +/// 用于TopDown的Transform,支持模拟垂直高度,不允许旋转和缩放 /// </summary> [ExecuteInEditMode] [RequireComponent(typeof(Transform))] @@ -23,12 +23,12 @@ public class TopDownTransform : MonoBehaviour [SerializeField] private Vector3 m_LocalPosition; // 只能绕一个虚拟轴旋转 - [SerializeField] private float m_LocalRotation; + //[SerializeField] private float m_LocalRotation; // x, z //[SerializeField] private Vector2 m_LocalScale; - public Vector3 position + public Vector3 localPosition { get { @@ -39,7 +39,7 @@ public class TopDownTransform : MonoBehaviour m_LocalPosition = value; Project(); } - } + } public float x { @@ -91,23 +91,66 @@ public class TopDownTransform : MonoBehaviour } } - // 地表坐标(Topdown空间) - public Vector3 positionOnGround + /// <summary> + /// 全局坐标 + /// </summary> + public Vector3 position { + get + { + Vector3 pos = m_LocalPosition; + Transform self = this.transform; + while(self.parent != null) + { + TopDownTransform parentTransform = self.parent.GetComponent<TopDownTransform>(); + if (parentTransform == null) + { + Debug.LogError("Parent is not TopDownTransform"); + continue; + } + pos += parentTransform.m_LocalPosition; + self = self.parent; + } + return pos; + } set { - Vector3 pos = position; - pos.x = value.x; - pos.y = value.y; - position = pos; - Project(); + Vector3 pos = value; + Transform self = this.transform; + while (self.parent != null) + { + TopDownTransform parentTransform = self.parent.GetComponent<TopDownTransform>(); + if (parentTransform == null) + { + Debug.LogError("Parent is not TopDownTransform"); + continue; + } + pos -= parentTransform.m_LocalPosition; + self = self.parent; + } + m_LocalPosition = pos; } + } + + /// <summary> + /// 地表坐标(Topdown空间) + /// </summary> + public Vector3 positionOnGround + { get { Vector3 pos = position; pos.z = 0; return pos; } + set + { + Vector3 pos = position; + pos.x = value.x; + pos.y = value.y; + position = pos; + Project(); + } } /// <summary> @@ -128,7 +171,7 @@ public class TopDownTransform : MonoBehaviour if (sr) { gameObject.AddOrGetComponent<TopDownSorting>(); - gameObject.AddOrGetComponent<TopDownShadowCaster>(); + //gameObject.AddOrGetComponent<TopDownShadowCaster>(); } } @@ -140,10 +183,12 @@ public class TopDownTransform : MonoBehaviour #region 转换到3D笛卡尔空间 public Vector3 Get3DPosition() { + Vector3 posTD = position; + Vector3 pos = new Vector3(); - pos.x = m_LocalPosition.x; - pos.y = m_LocalPosition.y + m_LocalPosition.z; - pos.z = transform.localPosition.z; + pos.x = posTD.x; + pos.y = posTD.y + posTD.z; + pos.z = transform.position.z; return pos; } @@ -153,9 +198,11 @@ public class TopDownTransform : MonoBehaviour /// <returns></returns> public Vector3 GetGround3DPosition() { + Vector3 posTD = position; + Vector3 pos = new Vector3(); - pos.x = m_LocalPosition.x; - pos.y = m_LocalPosition.y; + pos.x = posTD.x; + pos.y = posTD.y; pos.z = transform.position.z; return pos; } diff --git a/AlienSurvival/Assets/Scripts/Utils/GameLoop.cs b/AlienSurvival/Assets/Scripts/Utils/GameLoop.cs index e22ed77..6bbb140 100644 --- a/AlienSurvival/Assets/Scripts/Utils/GameLoop.cs +++ b/AlienSurvival/Assets/Scripts/Utils/GameLoop.cs @@ -4,35 +4,18 @@ using UnityEngine; public class GameLoop : MonoBehaviour { + static public GameLoop Instance { get; private set; } - static GameLoop m_GameLoop; - - static public GameLoop instance - { - get - { - return m_GameLoop; - } - } - - int m_IndexOfUpdate = 0; - - public int indexOfUpdate - { - get - { - return m_IndexOfUpdate; - } - } + public int indexOfUpdate { get; private set; } = 0; private void Awake() { - m_GameLoop = this; + Instance = this; } private void Update() { - ++m_IndexOfUpdate; + ++indexOfUpdate; } -} +}
\ No newline at end of file diff --git a/AlienSurvival/Assets/Test/Prefabs/character/peacemaker.prefab b/AlienSurvival/Assets/Test/Prefabs/character/peacemaker.prefab index abe4688..d7f6549 100644 --- a/AlienSurvival/Assets/Test/Prefabs/character/peacemaker.prefab +++ b/AlienSurvival/Assets/Test/Prefabs/character/peacemaker.prefab @@ -39,9 +39,9 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 8582758513482715753} + - component: {fileID: 1688045720} - component: {fileID: 8582758513482715754} - component: {fileID: 8582758513482715767} - - component: {fileID: 1688045720} - component: {fileID: 1688045719} - component: {fileID: 1688045718} m_Layer: 0 @@ -68,6 +68,19 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1688045720 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8582758513482715755} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2b1fbd797bf03674e9d1b81edc11e3f1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LocalPosition: {x: 8.2864, y: 5.50792, z: 0.9101057} --- !u!212 &8582758513482715754 SpriteRenderer: m_ObjectHideFlags: 0 @@ -143,21 +156,6 @@ MonoBehaviour: m_LaunchPoint: {fileID: 1494824567} m_B2: {fileID: 7590146165444391131, guid: 32b87453d68755c408daadfa092ce683, type: 3} m_SpaceBeam: {fileID: 7039965570506506514, guid: aaee1eb6bb697a34c822ff018eca2fdf, type: 3} ---- !u!114 &1688045720 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8582758513482715755} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 2b1fbd797bf03674e9d1b81edc11e3f1, type: 3} - m_Name: - m_EditorClassIdentifier: - m_LocalPosition: {x: 7.7344294, y: 3.99, z: 0.9101057} - m_LocalRotation: 0 - m_LocalScale: {x: 0, y: 0} --- !u!114 &1688045719 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/AlienSurvival/Assets/Test/Prefabs/grenade/grenade_v2.prefab b/AlienSurvival/Assets/Test/Prefabs/grenade/grenade_v2.prefab index 1675d9f..dd4bc25 100644 --- a/AlienSurvival/Assets/Test/Prefabs/grenade/grenade_v2.prefab +++ b/AlienSurvival/Assets/Test/Prefabs/grenade/grenade_v2.prefab @@ -12,7 +12,6 @@ GameObject: - component: {fileID: 2564142152358404510} - component: {fileID: 8159170123667978926} - component: {fileID: 9084381671418316606} - - component: {fileID: 1730586785962640400} - component: {fileID: 3320513471953641861} m_Layer: 0 m_Name: grenade_v2 @@ -49,7 +48,6 @@ MonoBehaviour: m_EditorClassIdentifier: m_LocalPosition: {x: 0, y: 2.4751804, z: 0} m_LocalRotation: 0 - m_LocalScale: {x: 0, y: 0} --- !u!212 &8159170123667978926 SpriteRenderer: m_ObjectHideFlags: 0 @@ -113,20 +111,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a9f0293bd6e86e43bbbefc99b5e2722, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &1730586785962640400 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7267266743187280249} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f1ce201566412034c99687a8c5b94075, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Color: {r: 0, g: 0, b: 0, a: 0.09803922} - m_Scale: {x: 1, y: 0.5} --- !u!114 &3320513471953641861 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/AlienSurvival/Assets/Test/Scenes/6_PixelCanvas 1.unity b/AlienSurvival/Assets/Test/Scenes/6_PixelCanvas 1.unity index d4f16df..5e0b75b 100644 --- a/AlienSurvival/Assets/Test/Scenes/6_PixelCanvas 1.unity +++ b/AlienSurvival/Assets/Test/Scenes/6_PixelCanvas 1.unity @@ -123,88 +123,6 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!1 &68060061 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 68060062} - - component: {fileID: 68060063} - m_Layer: 0 - m_Name: shadow - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &68060062 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 68060061} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -0.91010547, z: 0} - m_LocalScale: {x: 1, y: 0.5, z: 0} - m_Children: [] - m_Father: {fileID: 368379040} - m_RootOrder: 3 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &68060063 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 68060061} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 0 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 601505335 - m_SortingLayer: -1 - m_SortingOrder: 0 - m_Sprite: {fileID: 21300000, guid: 65e65feb049635344acf9528aedd0195, type: 3} - m_Color: {r: 0, g: 0, b: 0, a: 0.22745098} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 1.15625, y: 1.625} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 --- !u!1 &80465628 GameObject: m_ObjectHideFlags: 0 @@ -303,88 +221,6 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 1 ---- !u!1 &166259442 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 166259443} - - component: {fileID: 166259444} - m_Layer: 0 - m_Name: shadow - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &166259443 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 166259442} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -2.2917747, z: 0} - m_LocalScale: {x: 1, y: 0.5, z: 0} - m_Children: [] - m_Father: {fileID: 844062964} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &166259444 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 166259442} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 0 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 601505335 - m_SortingLayer: -1 - m_SortingOrder: 0 - m_Sprite: {fileID: -3685877254663532703, guid: a75b74e89c53fb043902fbe6216cd330, type: 3} - m_Color: {r: 0, g: 0, b: 0, a: 0.22745098} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 1.5625, y: 1.5625} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 --- !u!1 &185848754 GameObject: m_ObjectHideFlags: 0 @@ -584,8 +420,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 4.5282884, y: 8.813862, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 1831277208} + m_Children: [] m_Father: {fileID: 0} m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -628,89 +463,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_LocalPosition: {x: 4.5282884, y: 8.05027, z: 0.76359224} - m_LocalRotation: 0 ---- !u!1 &249545218 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 249545219} - - component: {fileID: 249545220} - m_Layer: 0 - m_Name: shadow - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &249545219 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 249545218} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -2.8256373, z: 0} - m_LocalScale: {x: 1, y: 0.5, z: 0} - m_Children: [] - m_Father: {fileID: 1655800956} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &249545220 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 249545218} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 0 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 601505335 - m_SortingLayer: -1 - m_SortingOrder: 0 - m_Sprite: {fileID: 5068832224188716903, guid: f81265fcc613abd44bffbfcb7215359b, type: 3} - m_Color: {r: 0, g: 0, b: 0, a: 0.22745098} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 2.25, y: 1.5} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 --- !u!1 &268856200 GameObject: m_ObjectHideFlags: 0 @@ -904,11 +656,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 320299115} m_CullTransparentMesh: 1 ---- !u!4 &368379040 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 8582758513482715753, guid: 32f108a63fddba54fbcf9b728f232946, type: 3} - m_PrefabInstance: {fileID: 8582758514292956423} - m_PrefabAsset: {fileID: 0} --- !u!1 &414827375 GameObject: m_ObjectHideFlags: 0 @@ -992,8 +739,7 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 4.9995747, y: 4.5185165, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 1233708128} + m_Children: [] m_Father: {fileID: 0} m_RootOrder: 19 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1049,7 +795,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_LocalPosition: {x: 4.9995747, y: 4.5185165, z: 0} - m_LocalRotation: 0 --- !u!114 &414827383 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1639,8 +1384,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 2.1415555, y: 8.509748, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 166259443} + m_Children: [] m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1683,7 +1427,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_LocalPosition: {x: 2.1415555, y: 6.2179737, z: 2.2917752} - m_LocalRotation: 0 --- !u!1 &917445573 GameObject: m_ObjectHideFlags: 0 @@ -2366,88 +2109,6 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 1 ---- !u!1 &1189140466 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1189140467} - - component: {fileID: 1189140468} - m_Layer: 0 - m_Name: shadow - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1189140467 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1189140466} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -1.208168, z: 0} - m_LocalScale: {x: 1, y: 0.5, z: 0} - m_Children: [] - m_Father: {fileID: 1427931719} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &1189140468 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1189140466} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 0 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 601505335 - m_SortingLayer: -1 - m_SortingOrder: 0 - m_Sprite: {fileID: -6288526288528838362, guid: 180253d8c3a9d7d49ab41c54181dae83, type: 3} - m_Color: {r: 0, g: 0, b: 0, a: 0.22745098} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 1.09375, y: 1.09375} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 --- !u!1001 &1226901732 PrefabInstance: m_ObjectHideFlags: 0 @@ -2509,88 +2170,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 779262af2df6cab4ab893e9884f5bf74, type: 3} ---- !u!1 &1233708127 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1233708128} - - component: {fileID: 1233708129} - m_Layer: 0 - m_Name: shadow - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1233708128 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1233708127} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 0.5, z: 0} - m_Children: [] - m_Father: {fileID: 414827377} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &1233708129 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1233708127} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 0 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 601505335 - m_SortingLayer: -1 - m_SortingOrder: 0 - m_Sprite: {fileID: 21300000, guid: 79a8cc6654335874799aa6349918161e, type: 3} - m_Color: {r: 0, g: 0, b: 0, a: 0.22745098} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 1.03125, y: 1.25} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 --- !u!1 &1406907911 GameObject: m_ObjectHideFlags: 0 @@ -2791,8 +2370,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 7.306535, y: 10.096827, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 1189140467} + m_Children: [] m_Father: {fileID: 0} m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -2863,7 +2441,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_LocalPosition: {x: 7.306535, y: 8.888659, z: 1.2081676} - m_LocalRotation: 0 --- !u!1 &1494583546 GameObject: m_ObjectHideFlags: 0 @@ -3683,8 +3260,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 10.677433, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 249545219} + m_Children: [] m_Father: {fileID: 0} m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -3727,7 +3303,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_LocalPosition: {x: 0, y: 7.8517957, z: 2.8256369} - m_LocalRotation: 0 --- !u!1 &1674033082 GameObject: m_ObjectHideFlags: 0 @@ -4197,88 +3772,6 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 1 ---- !u!1 &1831277207 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1831277208} - - component: {fileID: 1831277209} - m_Layer: 0 - m_Name: shadow - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1831277208 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1831277207} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -0.76359177, z: 0} - m_LocalScale: {x: 1, y: 0.5, z: 0} - m_Children: [] - m_Father: {fileID: 231104474} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &1831277209 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1831277207} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 0 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 601505335 - m_SortingLayer: -1 - m_SortingOrder: 0 - m_Sprite: {fileID: -6997709495448532824, guid: fb08b0f068cbce749917cffaef128c3f, type: 3} - m_Color: {r: 0, g: 0, b: 0, a: 0.22745098} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 0.6875, y: 0.59375} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 --- !u!1 &1856618382 GameObject: m_ObjectHideFlags: 0 @@ -4494,88 +3987,6 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 1 ---- !u!1 &1950066414 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1950066415} - - component: {fileID: 1950066416} - m_Layer: 0 - m_Name: shadow - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1950066415 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1950066414} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -1.0356388, z: 0} - m_LocalScale: {x: 1, y: 0.5, z: 0} - m_Children: [] - m_Father: {fileID: 2103777678} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &1950066416 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1950066414} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 0 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 601505335 - m_SortingLayer: -1 - m_SortingOrder: 0 - m_Sprite: {fileID: 21300000, guid: 52dab49f83ccd8f4895a647210165e85, type: 3} - m_Color: {r: 0, g: 0, b: 0, a: 0.22745098} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 3.125, y: 1.71875} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 --- !u!1 &1993403370 GameObject: m_ObjectHideFlags: 0 @@ -4883,8 +4294,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: -4.3151608, y: 8.581003, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 1950066415} + m_Children: [] m_Father: {fileID: 0} m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -4927,7 +4337,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_LocalPosition: {x: -4.3151608, y: 7.5453644, z: 1.0356388} - m_LocalRotation: 0 --- !u!1001 &8582758514292956423 PrefabInstance: m_ObjectHideFlags: 0 @@ -4941,11 +4350,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8582758513482715753, guid: 32f108a63fddba54fbcf9b728f232946, type: 3} propertyPath: m_LocalPosition.x - value: 7.7344294 + value: 8.2864 objectReference: {fileID: 0} - target: {fileID: 8582758513482715753, guid: 32f108a63fddba54fbcf9b728f232946, type: 3} propertyPath: m_LocalPosition.y - value: 4.9001055 + value: 6.4180255 objectReference: {fileID: 0} - target: {fileID: 8582758513482715753, guid: 32f108a63fddba54fbcf9b728f232946, type: 3} propertyPath: m_LocalPosition.z diff --git a/AlienSurvival/Assets/Test/Scripts/TestBomb.cs b/AlienSurvival/Assets/Test/Scripts/TestBomb.cs index daf3177..797b6a2 100644 --- a/AlienSurvival/Assets/Test/Scripts/TestBomb.cs +++ b/AlienSurvival/Assets/Test/Scripts/TestBomb.cs @@ -24,7 +24,7 @@ public class TestBomb : MonoBehaviour public void Set(Vector3 initPosition, Vector3 initDirection, float initSpeed) { m_Coords = GetComponent<TopDownTransform>(); - m_Coords.position = initPosition; + m_Coords.localPosition = initPosition; m_Velocity = initDirection * initSpeed; } @@ -57,12 +57,10 @@ public class TestBomb : MonoBehaviour GameObject exp = Instantiate<GameObject>(m_ExplosionEffect); TopDownTransform coord = exp.GetComponent<TopDownTransform>(); - coord.position = m_Coords.position; + coord.localPosition = m_Coords.localPosition; exp.GetComponent<TopDownSorting>().Sorting(); - //exp.GetComponent<TopDownShadowCaster>().SetPosition(); - exp.SetActive(true); } diff --git a/AlienSurvival/Assets/Test/Scripts/TestBucket.cs b/AlienSurvival/Assets/Test/Scripts/TestBucket.cs index c3e28f4..82bcee9 100644 --- a/AlienSurvival/Assets/Test/Scripts/TestBucket.cs +++ b/AlienSurvival/Assets/Test/Scripts/TestBucket.cs @@ -18,7 +18,7 @@ public class TestBucket : MonoBehaviour for(int i = 0; i < 10; ++i) { TestBrokenPiece piece = Instantiate<TestBrokenPiece>(m_Piece); - piece.Set(m_Coord.position + new Vector3(0,0,1f), + piece.Set(m_Coord.localPosition + new Vector3(0,0,1f), new Vector3(Random.Range(-1f,1f), Random.Range(-1f, 1f), Random.Range(0.5f, 2f)).normalized, Random.Range(1f, 3f) , i); } diff --git a/AlienSurvival/Assets/Test/Scripts/TestPeaceMaker.cs b/AlienSurvival/Assets/Test/Scripts/TestPeaceMaker.cs index f685e15..931fa81 100644 --- a/AlienSurvival/Assets/Test/Scripts/TestPeaceMaker.cs +++ b/AlienSurvival/Assets/Test/Scripts/TestPeaceMaker.cs @@ -124,11 +124,11 @@ public class TestPeaceMaker : MonoBehaviour { Vector2 direction = new Vector2(x, y).normalized; - Vector3 position = m_Coord.position; + Vector3 position = m_Coord.localPosition; position.x += direction.x * m_Speed * Time.deltaTime; position.y += direction.y * m_Speed * Time.deltaTime; - m_Coord.position = position; + m_Coord.localPosition = position; if (x > 0) { @@ -273,7 +273,7 @@ public class TestPeaceMaker : MonoBehaviour { // grenade TestPeaceMakerGrenade grenade = Instantiate<TestPeaceMakerGrenade>(m_Grenade); - Vector3 position = m_Coord.position + new Vector3(0, 0, 1.8f); + Vector3 position = m_Coord.localPosition + new Vector3(0, 0, 1.8f); grenade.Set(position, GetRandomLaunchGrenadeDirection(), Random.Range(8f, 10f)); grenade.gameObject.SetActive(true); @@ -303,7 +303,7 @@ public class TestPeaceMaker : MonoBehaviour { TestSpaceBeam beam = Instantiate<TestSpaceBeam>(m_SpaceBeam); - Vector3 pos3D = m_Coord.position; + Vector3 pos3D = m_Coord.localPosition; beam.Set(pos3D + new Vector3(3, 0, 0)); } } diff --git a/AlienSurvival/Assets/Test/Scripts/TestPeaceMakerGrenade.cs b/AlienSurvival/Assets/Test/Scripts/TestPeaceMakerGrenade.cs index 021eda7..c40e376 100644 --- a/AlienSurvival/Assets/Test/Scripts/TestPeaceMakerGrenade.cs +++ b/AlienSurvival/Assets/Test/Scripts/TestPeaceMakerGrenade.cs @@ -24,7 +24,7 @@ public class TestPeaceMakerGrenade : MonoBehaviour public void Set(Vector3 initPosition, Vector3 initDirection, float initSpeed) { m_Coords = GetComponent<TopDownTransform>(); - m_Coords.position = initPosition; + m_Coords.localPosition = initPosition; m_Velocity = initDirection * initSpeed; } @@ -57,7 +57,7 @@ public class TestPeaceMakerGrenade : MonoBehaviour GameObject exp = Instantiate<GameObject>(m_ExplosionEffect); TopDownTransform coord = exp.GetComponent<TopDownTransform>(); - coord.position = m_Coords.position; + coord.localPosition = m_Coords.localPosition; exp.GetComponent<TopDownSorting>().Sorting(); diff --git a/AlienSurvival/Assets/Test/Scripts/TestSpaceBeam.cs b/AlienSurvival/Assets/Test/Scripts/TestSpaceBeam.cs index 3683e43..6fc3fb6 100644 --- a/AlienSurvival/Assets/Test/Scripts/TestSpaceBeam.cs +++ b/AlienSurvival/Assets/Test/Scripts/TestSpaceBeam.cs @@ -28,7 +28,7 @@ public class TestSpaceBeam : MonoBehaviour public void Set(Vector3 posTDS) { - m_Coord.position = posTDS; + m_Coord.localPosition = posTDS; Vector3 groundPos = m_Coord.positionOnGround; @@ -37,7 +37,7 @@ public class TestSpaceBeam : MonoBehaviour float angle = Mathf.PI * 2f / (float)count * i; Vector3 pos = /*groundPos +*/ new Vector3(m_Radius * Mathf.Cos(angle), m_Radius * Mathf.Sin(angle), 0f); GameObject beam = Instantiate<GameObject>(m_Beam, this.transform); - beam.GetComponent<TopDownTransform>().position = pos; + beam.GetComponent<TopDownTransform>().localPosition = pos; beam.SetActive(true); m_Beams.Add(beam); } @@ -62,7 +62,7 @@ public class TestSpaceBeam : MonoBehaviour { float rad = angle + Mathf.PI * 2f / (float)count * i; Vector3 pos = /*groundPos + */new Vector3(m_Radius * Mathf.Cos(rad), m_Radius * Mathf.Sin(rad), 0f); - m_Beams[i].GetComponent<TopDownTransform>().position = pos; + m_Beams[i].GetComponent<TopDownTransform>().localPosition = pos; } } |