gegner berabietet
This commit is contained in:
@@ -96,6 +96,12 @@ PrefabInstance:
|
|||||||
- targetCorrespondingSourceObject: {fileID: 5633379113638269974, guid: 6ea5f5e913c0b774fbcc2503ce1f5351, type: 3}
|
- targetCorrespondingSourceObject: {fileID: 5633379113638269974, guid: 6ea5f5e913c0b774fbcc2503ce1f5351, type: 3}
|
||||||
insertIndex: -1
|
insertIndex: -1
|
||||||
addedObject: {fileID: 180122570269065527}
|
addedObject: {fileID: 180122570269065527}
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 5633379113638269974, guid: 6ea5f5e913c0b774fbcc2503ce1f5351, type: 3}
|
||||||
|
insertIndex: -1
|
||||||
|
addedObject: {fileID: 180122570269065528}
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 5633379113638269974, guid: 6ea5f5e913c0b774fbcc2503ce1f5351, type: 3}
|
||||||
|
insertIndex: -1
|
||||||
|
addedObject: {fileID: 180122570269065529}
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 6ea5f5e913c0b774fbcc2503ce1f5351, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 6ea5f5e913c0b774fbcc2503ce1f5351, type: 3}
|
||||||
--- !u!1 &3184574949717094923 stripped
|
--- !u!1 &3184574949717094923 stripped
|
||||||
GameObject:
|
GameObject:
|
||||||
@@ -124,3 +130,31 @@ NavMeshAgent:
|
|||||||
m_BaseOffset: 0
|
m_BaseOffset: 0
|
||||||
m_WalkableMask: 4294967295
|
m_WalkableMask: 4294967295
|
||||||
m_ObstacleAvoidanceType: 4
|
m_ObstacleAvoidanceType: 4
|
||||||
|
--- !u!114 &180122570269065528
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3184574949717094923}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: e2665e725aa6c7642bb84ea1a671970a, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::EnemyHealth
|
||||||
|
maxHP: 100
|
||||||
|
--- !u!114 &180122570269065529
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3184574949717094923}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 29f907e38ca44e3495ce692733ada681, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::EnemyShooter
|
||||||
|
shootRange: 25
|
||||||
|
shootDelay: 1
|
||||||
|
damage: 10
|
||||||
|
|||||||
+121
-1
@@ -1579,7 +1579,7 @@ RectTransform:
|
|||||||
m_GameObject: {fileID: 1597635426}
|
m_GameObject: {fileID: 1597635426}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1783601023}
|
- {fileID: 1783601023}
|
||||||
@@ -2082,6 +2082,124 @@ Transform:
|
|||||||
m_CorrespondingSourceObject: {fileID: 7448449092846401218, guid: 46014def5fa85504abb9cc3190ae45e3, type: 3}
|
m_CorrespondingSourceObject: {fileID: 7448449092846401218, guid: 46014def5fa85504abb9cc3190ae45e3, type: 3}
|
||||||
m_PrefabInstance: {fileID: 79145418}
|
m_PrefabInstance: {fileID: 79145418}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!1001 &3100000001
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 666541161848099966, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 515
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 666541161848099966, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 666541161848099966, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 120
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8869766472872964854, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Test Geisel 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8869766472872964854, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
propertyPath: m_TagString
|
||||||
|
value: Untagged
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents:
|
||||||
|
- {fileID: 180122570269065527, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
- {fileID: 180122570269065528, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
- {fileID: 180122570269065529, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents:
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 3184574949717094923, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
insertIndex: -1
|
||||||
|
addedObject: {fileID: 3100000003}
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
--- !u!1 &3100000002 stripped
|
||||||
|
GameObject:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 3184574949717094923, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 3100000001}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!114 &3100000003
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3100000002}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 62ea7866e4d846e2b5d207c6a3ec8afa, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::HostageRescue
|
||||||
|
rescueDistance: 3
|
||||||
|
escapeDistance: 15
|
||||||
|
runSpeed: 5
|
||||||
|
--- !u!1001 &3100000011
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 666541161848099966, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 500
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 666541161848099966, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 666541161848099966, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 130
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8869766472872964854, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Test Geisel 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8869766472872964854, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
propertyPath: m_TagString
|
||||||
|
value: Untagged
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents:
|
||||||
|
- {fileID: 180122570269065527, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
- {fileID: 180122570269065528, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
- {fileID: 180122570269065529, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents:
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 3184574949717094923, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
insertIndex: -1
|
||||||
|
addedObject: {fileID: 3100000013}
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
--- !u!1 &3100000012 stripped
|
||||||
|
GameObject:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 3184574949717094923, guid: c7fd2b64609ae0a4ba9c9021ccf720b7, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 3100000011}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!114 &3100000013
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3100000012}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 62ea7866e4d846e2b5d207c6a3ec8afa, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::HostageRescue
|
||||||
|
rescueDistance: 3
|
||||||
|
escapeDistance: 15
|
||||||
|
runSpeed: 5
|
||||||
--- !u!1660057539 &9223372036854775807
|
--- !u!1660057539 &9223372036854775807
|
||||||
SceneRoots:
|
SceneRoots:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -2095,3 +2213,5 @@ SceneRoots:
|
|||||||
- {fileID: 896204980}
|
- {fileID: 896204980}
|
||||||
- {fileID: 535044337}
|
- {fileID: 535044337}
|
||||||
- {fileID: 1597635430}
|
- {fileID: 1597635430}
|
||||||
|
- {fileID: 3100000001}
|
||||||
|
- {fileID: 3100000011}
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class EnemyShooter : MonoBehaviour
|
||||||
|
{
|
||||||
|
public float shootRange = 25f;
|
||||||
|
public float shootDelay = 1f;
|
||||||
|
public int damage = 10;
|
||||||
|
|
||||||
|
private PlayerHealth player;
|
||||||
|
private float nextShotTime;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
player = FindFirstObjectByType<PlayerHealth>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (PauseMenu.GameIsPaused || player == null) return;
|
||||||
|
|
||||||
|
Vector3 direction = player.transform.position - transform.position;
|
||||||
|
if (direction.magnitude > shootRange) return;
|
||||||
|
|
||||||
|
direction.y = 0f;
|
||||||
|
if (direction != Vector3.zero)
|
||||||
|
transform.rotation = Quaternion.LookRotation(direction);
|
||||||
|
|
||||||
|
if (Time.time >= nextShotTime && CanSeePlayer())
|
||||||
|
{
|
||||||
|
player.TakeDamage(damage);
|
||||||
|
nextShotTime = Time.time + shootDelay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CanSeePlayer()
|
||||||
|
{
|
||||||
|
Vector3 start = transform.position + Vector3.up;
|
||||||
|
Vector3 target = player.transform.position + Vector3.up;
|
||||||
|
Vector3 direction = target - start;
|
||||||
|
|
||||||
|
if (Physics.Raycast(start, direction.normalized, out RaycastHit hit, shootRange))
|
||||||
|
return hit.collider.GetComponentInParent<PlayerHealth>() != null;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 29f907e38ca44e3495ce692733ada681
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class HostageRescue : MonoBehaviour
|
||||||
|
{
|
||||||
|
public float rescueDistance = 3f;
|
||||||
|
public float escapeDistance = 15f;
|
||||||
|
public float runSpeed = 5f;
|
||||||
|
|
||||||
|
private Transform player;
|
||||||
|
private bool rescued;
|
||||||
|
private Vector3 escapeDirection;
|
||||||
|
private Vector3 startPosition;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
PlayerHealth playerHealth = FindFirstObjectByType<PlayerHealth>();
|
||||||
|
if (playerHealth != null) player = playerHealth.transform;
|
||||||
|
|
||||||
|
startPosition = transform.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (PauseMenu.GameIsPaused || player == null) return;
|
||||||
|
|
||||||
|
if (rescued)
|
||||||
|
{
|
||||||
|
transform.position += escapeDirection * runSpeed * Time.deltaTime;
|
||||||
|
if (Vector3.Distance(startPosition, transform.position) >= escapeDistance)
|
||||||
|
enabled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Vector3.Distance(transform.position, player.position) <= rescueDistance &&
|
||||||
|
Input.GetKeyDown(KeyCode.E))
|
||||||
|
{
|
||||||
|
RunAway();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunAway()
|
||||||
|
{
|
||||||
|
rescued = true;
|
||||||
|
startPosition = transform.position;
|
||||||
|
escapeDirection = (transform.position - player.position).normalized;
|
||||||
|
escapeDirection.y = 0f;
|
||||||
|
transform.rotation = Quaternion.LookRotation(escapeDirection);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 62ea7866e4d846e2b5d207c6a3ec8afa
|
||||||
Reference in New Issue
Block a user