final commit

This commit is contained in:
2022-04-29 21:55:55 +07:00
parent 4172fc94ba
commit e90826e5bb
10 changed files with 247 additions and 20 deletions

View File

@ -115,7 +115,6 @@ MonoBehaviour:
maxStep: 0
hasUpgradedFromAgentParameters: 1
MaxStep: 100
moveController: {fileID: 778652956973742106}
--- !u!114 &7805954453358028498
MonoBehaviour:
m_ObjectHideFlags: 0

147
Assets/Prefabs/DumbBot.prefab generated Normal file
View File

@ -0,0 +1,147 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5088209617264965569
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5088209617264965581}
- component: {fileID: 5088209617264965582}
- component: {fileID: 5088209617264965583}
- component: {fileID: 5088209617264965568}
- component: {fileID: 1713535462286929696}
- component: {fileID: 7289981782903805169}
- component: {fileID: 2951723199850784043}
m_Layer: 0
m_Name: DumbBot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5088209617264965581
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5088209617264965569}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 28.310326, y: 13.98, z: 46.45}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &5088209617264965582
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5088209617264965569}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &5088209617264965583
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5088209617264965569}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
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_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
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!136 &5088209617264965568
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5088209617264965569}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!195 &1713535462286929696
NavMeshAgent:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5088209617264965569}
m_Enabled: 1
m_AgentTypeID: 0
m_Radius: 0.5
m_Speed: 3.5
m_Acceleration: 8
avoidancePriority: 50
m_AngularSpeed: 120
m_StoppingDistance: 0
m_AutoTraverseOffMeshLink: 1
m_AutoBraking: 1
m_AutoRepath: 1
m_Height: 2
m_BaseOffset: 1
m_WalkableMask: 4294967295
m_ObstacleAvoidanceType: 4
--- !u!114 &7289981782903805169
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5088209617264965569}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d3ebcf807a37f344998fd648dfc9376d, type: 3}
m_Name:
m_EditorClassIdentifier:
navMeshAgent: {fileID: 1713535462286929696}
--- !u!114 &2951723199850784043
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5088209617264965569}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c4554daed12bd65419fa0dc881c40eaf, type: 3}
m_Name:
m_EditorClassIdentifier:
_aiPathRaw: []

7
Assets/Prefabs/DumbBot.prefab.meta generated Normal file
View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 46663c9de0d7b54418d63b50d2ae3a72
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -5780,3 +5780,72 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &3813978155778551933
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 5088209617264965569, guid: 46663c9de0d7b54418d63b50d2ae3a72,
type: 3}
propertyPath: m_Name
value: DumbBot
objectReference: {fileID: 0}
- target: {fileID: 5088209617264965581, guid: 46663c9de0d7b54418d63b50d2ae3a72,
type: 3}
propertyPath: m_RootOrder
value: 7
objectReference: {fileID: 0}
- target: {fileID: 5088209617264965581, guid: 46663c9de0d7b54418d63b50d2ae3a72,
type: 3}
propertyPath: m_LocalPosition.x
value: 28.310326
objectReference: {fileID: 0}
- target: {fileID: 5088209617264965581, guid: 46663c9de0d7b54418d63b50d2ae3a72,
type: 3}
propertyPath: m_LocalPosition.y
value: 11.19
objectReference: {fileID: 0}
- target: {fileID: 5088209617264965581, guid: 46663c9de0d7b54418d63b50d2ae3a72,
type: 3}
propertyPath: m_LocalPosition.z
value: 46.45
objectReference: {fileID: 0}
- target: {fileID: 5088209617264965581, guid: 46663c9de0d7b54418d63b50d2ae3a72,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5088209617264965581, guid: 46663c9de0d7b54418d63b50d2ae3a72,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5088209617264965581, guid: 46663c9de0d7b54418d63b50d2ae3a72,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5088209617264965581, guid: 46663c9de0d7b54418d63b50d2ae3a72,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5088209617264965581, guid: 46663c9de0d7b54418d63b50d2ae3a72,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5088209617264965581, guid: 46663c9de0d7b54418d63b50d2ae3a72,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5088209617264965581, guid: 46663c9de0d7b54418d63b50d2ae3a72,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 46663c9de0d7b54418d63b50d2ae3a72, type: 3}

View File

@ -4,16 +4,23 @@ using UnityEngine;
public class DumbAI : MonoBehaviour
{
public Transform feetTransform;
// Start is called before the first frame update
[SerializeField]
private List<NavPoint> _aiPathRaw;
private Queue<NavPoint> _aiPath;
private int _nextPointId;
void Start()
{
var current_position = feetTransform.transform.position;
_aiPath = new Queue<NavPoint>(_aiPathRaw);
StepOnNavPoint();
}
// Update is called once per frame
void Update()
private void StepOnNavPoint()
{
if (_aiPath.Count != 0)
{
_nextPointId = _aiPath.Peek().PointId;
_aiPath.Dequeue();
}
}
}

View File

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
executionOrder: 200
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@ -16,13 +16,13 @@ public class MovementController : MonoBehaviour
public void MoveToRandomPoint()
{
Debug.Log(MapManager.navPoints == null);
goToNextNavPoint(MapManager.navPoints[Random.Range(0, MapManager.navPoints.Count)]);
Debug.Log(MapManager.NavPoints == null);
goToNextNavPoint(MapManager.NavPoints[Random.Range(0, MapManager.NavPoints.Count)]);
}
public List<NavPoint> getPointsCandidate()
{
return MapManager.navPoints
return MapManager.NavPoints
.Where(point => (currentPosition.position - point.position).magnitude <= SettingsReader.Instance.GetSettings.movementSpeed)
.ToList();
}

View File

@ -8,10 +8,8 @@ using System.Collections.Generic;
[RequireComponent(typeof(MovementController))]
public class NPC : Agent, ICharacter
{
[HideInInspector]
public Character AgentCharacter;
public CharacterCondition Condition;
private Character AgentCharacter;
private CharacterCondition Condition;
public NPC_BaseState NPC_State { get; private set; }
public Character GetCharacter => AgentCharacter;

View File

@ -3,17 +3,16 @@ using UnityEngine;
public class MapManager : MonoBehaviour
{
public static List<NavPoint> navPoints { get; private set; }
public static List<NavPoint> NavPoints { get; private set; }
private void Start()
{
var i = 0;
navPoints = new List<NavPoint>();
NavPoints = new List<NavPoint>();
var navPointsGameObj = GameObject.FindGameObjectsWithTag("Point");
foreach (var gameobj in navPointsGameObj)
{
var navpoint = gameobj.GetComponent<NavPoint>();
navpoint.PointId = i; i++;
navPoints.Add(navpoint);
NavPoints.Add(navpoint);
}
}
}

View File

@ -2,13 +2,14 @@
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(BoxCollider))]
public class NavPoint : MonoBehaviour
{
public Vector3 position => gameObject.transform.position;
public int PointId => this.GetInstanceID();
public float FlagDistance { get; private set; }
[HideInInspector]
public int? PointId;
public float DeathAttr = 0;
public List<Vector3> EnemiesSeen = new List<Vector3>();
//Here other attributes;