From a65596aab8f89a2921574c216a27e57152ab1a2b Mon Sep 17 00:00:00 2001 From: Alee Date: Fri, 31 May 2019 18:26:09 -0400 Subject: Woo! Movement is done! --- Assets/Scenes/TestSimulation.unity | 110 ++++----------------------- Assets/Scenes/TestSimulation/NavMesh.asset | Bin 6004 -> 5444 bytes Assets/Scripts/Player.meta | 8 ++ Assets/Scripts/Player/PlayerMovement.cs | 48 ++++++++++++ Assets/Scripts/Player/PlayerMovement.cs.meta | 11 +++ Assets/Scripts/PlayerMovement.cs | 39 ---------- Assets/Scripts/PlayerMovement.cs.meta | 11 --- 7 files changed, 83 insertions(+), 144 deletions(-) create mode 100644 Assets/Scripts/Player.meta create mode 100644 Assets/Scripts/Player/PlayerMovement.cs create mode 100644 Assets/Scripts/Player/PlayerMovement.cs.meta delete mode 100644 Assets/Scripts/PlayerMovement.cs delete mode 100644 Assets/Scripts/PlayerMovement.cs.meta diff --git a/Assets/Scenes/TestSimulation.unity b/Assets/Scenes/TestSimulation.unity index fd4aab3..5e743b5 100644 --- a/Assets/Scenes/TestSimulation.unity +++ b/Assets/Scenes/TestSimulation.unity @@ -352,97 +352,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &510763447 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 510763451} - - component: {fileID: 510763450} - - component: {fileID: 510763449} - - component: {fileID: 510763448} - m_Layer: 0 - m_Name: Object - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 1 - m_StaticEditorFlags: 8 - m_IsActive: 1 ---- !u!65 &510763448 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 510763447} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!23 &510763449 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 510763447} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10303, 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_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 0 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 ---- !u!33 &510763450 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 510763447} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &510763451 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 510763447} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.10504675, y: 0.79, z: 0.16} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 4 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &534669902 GameObject: m_ObjectHideFlags: 0 @@ -537,6 +446,7 @@ GameObject: - component: {fileID: 1353580678} - component: {fileID: 1353580677} - component: {fileID: 1353580676} + - component: {fileID: 1353580681} - component: {fileID: 1353580680} m_Layer: 0 m_Name: Sim @@ -616,7 +526,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!195 &1353580680 NavMeshAgent: @@ -640,6 +550,18 @@ NavMeshAgent: m_BaseOffset: 1 m_WalkableMask: 4294967295 m_ObstacleAvoidanceType: 4 +--- !u!114 &1353580681 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1353580675} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 12d4d72b91b49f045a12f8c1a7cac845, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1485259022 GameObject: m_ObjectHideFlags: 0 @@ -704,7 +626,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 7 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2071580727 GameObject: @@ -799,5 +721,5 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 6 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scenes/TestSimulation/NavMesh.asset b/Assets/Scenes/TestSimulation/NavMesh.asset index 916eb64..a7a3d41 100644 Binary files a/Assets/Scenes/TestSimulation/NavMesh.asset and b/Assets/Scenes/TestSimulation/NavMesh.asset differ diff --git a/Assets/Scripts/Player.meta b/Assets/Scripts/Player.meta new file mode 100644 index 0000000..ccf888b --- /dev/null +++ b/Assets/Scripts/Player.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0105863dc7a4f6745a1c39a94fafb479 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs new file mode 100644 index 0000000..f82a325 --- /dev/null +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -0,0 +1,48 @@ +/******************************************************************************* +* +* Project SimLife: A Sims clone written in Unity C# +* Copyright (C) 2019 AleeCorp + Software Elevated +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +*********************************************************************************/ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.AI; + +public class PlayerMovement : MonoBehaviour +{ + NavMeshAgent agent; + + // Start is called before the first frame update + void Start() + { + agent = GetComponent (); + } + + // Update is called once per frame + void Update() + { + if(Input.GetMouseButtonDown(0)) + { + RaycastHit hit; + Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); + if(Physics.Raycast(ray, out hit, Mathf.Infinity)) + { + agent.SetDestination(hit.point); + } + } + } +} diff --git a/Assets/Scripts/Player/PlayerMovement.cs.meta b/Assets/Scripts/Player/PlayerMovement.cs.meta new file mode 100644 index 0000000..30793c0 --- /dev/null +++ b/Assets/Scripts/Player/PlayerMovement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 12d4d72b91b49f045a12f8c1a7cac845 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs deleted file mode 100644 index 6b2346a..0000000 --- a/Assets/Scripts/PlayerMovement.cs +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* -* -* Project SimLife: A Sims clone written in Unity C# -* Copyright (C) 2019 AleeCorp + Software Elevated -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -*********************************************************************************/ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.AI; - -public class PlayerMovement : MonoBehaviour -{ - void Update() - { - if (Input.GetButtonDown("Fire1")) - { - Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); - RaycastHit hitInfo; - if (Physics.Raycast(ray, out hitInfo)) - { - GetComponent().SetDestination(hitInfo.point); - } - } - } -} diff --git a/Assets/Scripts/PlayerMovement.cs.meta b/Assets/Scripts/PlayerMovement.cs.meta deleted file mode 100644 index 30793c0..0000000 --- a/Assets/Scripts/PlayerMovement.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 12d4d72b91b49f045a12f8c1a7cac845 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: -- cgit v1.2.3