Merge commit '6ea6324be3682488352df6ad8d26ba4f69d74475' into kosmogor
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a6502dc040177d419b70a6d548889c2
|
||||
guid: f1ba87c0234acfa4da251bb1bf3fe963
|
||||
ModelImporter:
|
||||
serializedVersion: 22200
|
||||
internalIDToNameTable: []
|
||||
|
||||
@@ -64,3 +64,5 @@ MonoBehaviour:
|
||||
enemies:
|
||||
- prefab: {fileID: 3602081654026665026, guid: 7ab59219438e4a241affd5e9441d9d9f, type: 3}
|
||||
weight: 1
|
||||
- prefab: {fileID: 3602081654026665026, guid: 7ab59219438e4a241affd5e9441d9d9f, type: 3}
|
||||
weight: 1
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20d12456f6b8d264dbc227a3e4c83468
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1398,6 +1398,70 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1311630986}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &2057016899
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2057016901}
|
||||
- component: {fileID: 2057016900}
|
||||
m_Layer: 0
|
||||
m_Name: NavMesh Surface
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &2057016900
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2057016899}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7a5ac11cc976e418e8d13136b07e1f52, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_SerializedVersion: 0
|
||||
m_AgentTypeID: 0
|
||||
m_CollectObjects: 0
|
||||
m_Size: {x: 10, y: 10, z: 10}
|
||||
m_Center: {x: 0, y: 2, z: 0}
|
||||
m_LayerMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 64
|
||||
m_UseGeometry: 0
|
||||
m_DefaultArea: 0
|
||||
m_GenerateLinks: 0
|
||||
m_IgnoreNavMeshAgent: 1
|
||||
m_IgnoreNavMeshObstacle: 1
|
||||
m_OverrideTileSize: 0
|
||||
m_TileSize: 256
|
||||
m_OverrideVoxelSize: 0
|
||||
m_VoxelSize: 0.16666667
|
||||
m_MinRegionArea: 2
|
||||
m_NavMeshData: {fileID: 23800000, guid: 94503c9617c3db6459977597f152b6f0, type: 2}
|
||||
m_BuildHeightMesh: 0
|
||||
--- !u!4 &2057016901
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2057016899}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &655697425354162324
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1772,3 +1836,4 @@ SceneRoots:
|
||||
- {fileID: 1481837882}
|
||||
- {fileID: 512102627}
|
||||
- {fileID: 1311630986}
|
||||
- {fileID: 2057016901}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94503c9617c3db6459977597f152b6f0
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 23800000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -9,7 +9,6 @@ public class EyeEnemy : Enemy
|
||||
public float offsetDistance = 1f;
|
||||
|
||||
[SerializeField] float currentDelay = 0;
|
||||
|
||||
[SerializeField] Player target;
|
||||
|
||||
void Start() {
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
public class MeleeEnemy : Enemy
|
||||
{
|
||||
public float speed = 1f;
|
||||
public float detectionRadius = 5f;
|
||||
public float patrollRadius = 3f;
|
||||
public float damage = 5f;
|
||||
public float attackRate = 1f;
|
||||
public float attackRadius = 1f;
|
||||
|
||||
[SerializeField] Player target;
|
||||
[SerializeField] MeleeEnemyState currentState = MeleeEnemyState.Patrolling;
|
||||
Vector3 patrollingTarget;
|
||||
NavMeshAgent navMeshAgent;
|
||||
|
||||
void Start() {
|
||||
target = FindFirstObjectByType<Player>();
|
||||
navMeshAgent = GetComponent<NavMeshAgent>();
|
||||
patrollingTarget = GetPatrollingTarget();
|
||||
}
|
||||
|
||||
void Update() {
|
||||
switch (currentState) {
|
||||
case MeleeEnemyState.Patrolling:
|
||||
Vector3 vectorToTarget = (target.transform.position - transform.position).normalized;
|
||||
bool canSee = false;
|
||||
if (Physics.Raycast(transform.position, vectorToTarget, out RaycastHit hit, detectionRadius)) {
|
||||
if (hit.transform.CompareTag("Player")) canSee = true;
|
||||
}
|
||||
if (canSee) currentState = MeleeEnemyState.Pursuing;
|
||||
else {
|
||||
if (Vector3.Distance(transform.position, patrollingTarget) <= 0.1f) patrollingTarget = GetPatrollingTarget();
|
||||
navMeshAgent.destination = patrollingTarget;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 GetPatrollingTarget() {
|
||||
return Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
enum MeleeEnemyState {
|
||||
Patrolling,
|
||||
Pursuing,
|
||||
Attacking
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53554f0e5c5ef3146a592d5dfe75e390
|
||||
Reference in New Issue
Block a user