Commit f75ad64f authored by mthiele2's avatar mthiele2
Browse files

Getter für Health und Anpassung für Patrolier-Script

parent 414b790c
......@@ -13,6 +13,7 @@ GameObject:
- component: {fileID: 61920140733709488}
- component: {fileID: 212219553255752332}
- component: {fileID: 114326583413855364}
- component: {fileID: 5987062824809259808}
- component: {fileID: 114716552753954768}
- component: {fileID: 114692363085912100}
- component: {fileID: 879798643589630551}
......@@ -148,6 +149,24 @@ MonoBehaviour:
detectionRange: 10
isInCombat: 0
desiredAction: []
--- !u!114 &5987062824809259808
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1634356314439590}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ba7900644f41dc6449121167e141a03b, type: 3}
m_Name:
m_EditorClassIdentifier:
weight: 0
isPerformingAction: 0
targetPos: {fileID: 0}
speed: 0
smoothTime: 0
groundDetection: {fileID: 0}
--- !u!114 &114716552753954768
MonoBehaviour:
m_ObjectHideFlags: 0
......
......@@ -564,12 +564,12 @@ SpriteShapeRenderer:
m_SortingOrder: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_MaskInteraction: 0
m_ShapeTexture: {fileID: 2800000, guid: a2c0eb8194d34ed4b9dc91a9195b3ddd, type: 3}
m_ShapeTexture: {fileID: 2800000, guid: bbbee504ca5b9034f94dbc6c64b62877, type: 3}
m_Sprites:
- {fileID: 21300000, guid: 4ad442db19b6f7c4d9397be474763f66, type: 3}
- {fileID: 21300000, guid: c00feabea0674474dbf751e72ae5f017, type: 3}
- {fileID: 21300000, guid: 23938a817d851b047b1ce17d72f2f02b, type: 3}
- {fileID: 21300000, guid: 4e19d2fc6d121fc48932202e46430f28, type: 3}
- {fileID: 21300000, guid: 2238c7878c4b23b48a3aa52f356962d2, type: 3}
- {fileID: 21300000, guid: 9e68dcf94290ab646af7072b23d8cd7f, type: 3}
- {fileID: 21300000, guid: f2f0cc268901fba43b70ea0b37036728, type: 3}
- {fileID: 21300000, guid: e898c995de9f2b345b1c2f2eb23b4e22, type: 3}
- {fileID: 21300000, guid: 1935b542e258bd64ea3915a1b59b3ef0, type: 3}
- {fileID: 21300000, guid: 0149f5afd2f419b4d9fd9e80a31a33a9, type: 3}
- {fileID: 21300000, guid: 5139251ed94400b40a574058b9ac7983, type: 3}
......@@ -579,8 +579,8 @@ SpriteShapeRenderer:
- {fileID: 0}
- {fileID: 0}
m_LocalAABB:
m_Center: {x: -57.418484, y: 23.11382, z: -0.007}
m_Extent: {x: 61.361393, y: 18.694569, z: 0.007}
m_Center: {x: -57.421417, y: 23.093266, z: -0.007}
m_Extent: {x: 61.332924, y: 18.640759, z: 0.007}
--- !u!4 &438036707
Transform:
m_ObjectHideFlags: 0
......@@ -650,6 +650,26 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114692363085912100, guid: 6cd7f8e10f89642fd88661db0d3f3827,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5987062824809259808, guid: 6cd7f8e10f89642fd88661db0d3f3827,
type: 3}
propertyPath: weight
value: 5
objectReference: {fileID: 0}
- target: {fileID: 5987062824809259808, guid: 6cd7f8e10f89642fd88661db0d3f3827,
type: 3}
propertyPath: targetPos
value:
objectReference: {fileID: 1156108369}
- target: {fileID: 5987062824809259808, guid: 6cd7f8e10f89642fd88661db0d3f3827,
type: 3}
propertyPath: smoothTime
value: 3
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6cd7f8e10f89642fd88661db0d3f3827, type: 3}
--- !u!1 &719626315
......@@ -803,12 +823,12 @@ SpriteShapeRenderer:
m_SortingOrder: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_MaskInteraction: 0
m_ShapeTexture: {fileID: 2800000, guid: a2c0eb8194d34ed4b9dc91a9195b3ddd, type: 3}
m_ShapeTexture: {fileID: 2800000, guid: bbbee504ca5b9034f94dbc6c64b62877, type: 3}
m_Sprites:
- {fileID: 21300000, guid: 4ad442db19b6f7c4d9397be474763f66, type: 3}
- {fileID: 21300000, guid: c00feabea0674474dbf751e72ae5f017, type: 3}
- {fileID: 21300000, guid: 23938a817d851b047b1ce17d72f2f02b, type: 3}
- {fileID: 21300000, guid: 4e19d2fc6d121fc48932202e46430f28, type: 3}
- {fileID: 21300000, guid: 2238c7878c4b23b48a3aa52f356962d2, type: 3}
- {fileID: 21300000, guid: 9e68dcf94290ab646af7072b23d8cd7f, type: 3}
- {fileID: 21300000, guid: f2f0cc268901fba43b70ea0b37036728, type: 3}
- {fileID: 21300000, guid: e898c995de9f2b345b1c2f2eb23b4e22, type: 3}
- {fileID: 21300000, guid: 1935b542e258bd64ea3915a1b59b3ef0, type: 3}
- {fileID: 21300000, guid: 0149f5afd2f419b4d9fd9e80a31a33a9, type: 3}
- {fileID: 21300000, guid: 5139251ed94400b40a574058b9ac7983, type: 3}
......@@ -818,8 +838,8 @@ SpriteShapeRenderer:
- {fileID: 0}
- {fileID: 0}
m_LocalAABB:
m_Center: {x: -19.186058, y: 10.159601, z: -0.0035}
m_Extent: {x: 34.539246, y: 15.721901, z: 0.0035}
m_Center: {x: -19.188976, y: 10.139042, z: -0.0035}
m_Extent: {x: 34.510788, y: 15.668093, z: 0.0035}
--- !u!4 &719626318
Transform:
m_ObjectHideFlags: 0
......@@ -1068,6 +1088,36 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 926b80f66a4f61b428fa10deff5f7842, type: 3}
--- !u!1 &1156108368
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1156108369}
m_Layer: 0
m_Name: PatrolSpot1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1156108369
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1156108368}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 15.84, y: 5.81, z: -0.21635683}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1475208694 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7340435369038607268, guid: 938701439f7d9654da1b920d73ccf2cc,
......@@ -1353,12 +1403,12 @@ SpriteShapeRenderer:
m_SortingOrder: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_MaskInteraction: 0
m_ShapeTexture: {fileID: 2800000, guid: a2c0eb8194d34ed4b9dc91a9195b3ddd, type: 3}
m_ShapeTexture: {fileID: 2800000, guid: bbbee504ca5b9034f94dbc6c64b62877, type: 3}
m_Sprites:
- {fileID: 21300000, guid: 4ad442db19b6f7c4d9397be474763f66, type: 3}
- {fileID: 21300000, guid: c00feabea0674474dbf751e72ae5f017, type: 3}
- {fileID: 21300000, guid: 23938a817d851b047b1ce17d72f2f02b, type: 3}
- {fileID: 21300000, guid: 4e19d2fc6d121fc48932202e46430f28, type: 3}
- {fileID: 21300000, guid: 2238c7878c4b23b48a3aa52f356962d2, type: 3}
- {fileID: 21300000, guid: 9e68dcf94290ab646af7072b23d8cd7f, type: 3}
- {fileID: 21300000, guid: f2f0cc268901fba43b70ea0b37036728, type: 3}
- {fileID: 21300000, guid: e898c995de9f2b345b1c2f2eb23b4e22, type: 3}
- {fileID: 21300000, guid: 1935b542e258bd64ea3915a1b59b3ef0, type: 3}
- {fileID: 21300000, guid: 0149f5afd2f419b4d9fd9e80a31a33a9, type: 3}
- {fileID: 21300000, guid: 5139251ed94400b40a574058b9ac7983, type: 3}
......@@ -1368,8 +1418,8 @@ SpriteShapeRenderer:
- {fileID: 0}
- {fileID: 0}
m_LocalAABB:
m_Center: {x: 0.015774608, y: 1.5293293, z: -0.002}
m_Extent: {x: 2.6183825, y: 1.1922958, z: 0.002}
m_Center: {x: 0.012822509, y: 1.5087739, z: -0.002}
m_Extent: {x: 2.589953, y: 1.1384853, z: 0.002}
--- !u!4 &1561658105
Transform:
m_ObjectHideFlags: 0
......@@ -1852,12 +1902,12 @@ SpriteShapeRenderer:
m_SortingOrder: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_MaskInteraction: 0
m_ShapeTexture: {fileID: 2800000, guid: a2c0eb8194d34ed4b9dc91a9195b3ddd, type: 3}
m_ShapeTexture: {fileID: 2800000, guid: bbbee504ca5b9034f94dbc6c64b62877, type: 3}
m_Sprites:
- {fileID: 21300000, guid: 4ad442db19b6f7c4d9397be474763f66, type: 3}
- {fileID: 21300000, guid: c00feabea0674474dbf751e72ae5f017, type: 3}
- {fileID: 21300000, guid: 23938a817d851b047b1ce17d72f2f02b, type: 3}
- {fileID: 21300000, guid: 4e19d2fc6d121fc48932202e46430f28, type: 3}
- {fileID: 21300000, guid: 2238c7878c4b23b48a3aa52f356962d2, type: 3}
- {fileID: 21300000, guid: 9e68dcf94290ab646af7072b23d8cd7f, type: 3}
- {fileID: 21300000, guid: f2f0cc268901fba43b70ea0b37036728, type: 3}
- {fileID: 21300000, guid: e898c995de9f2b345b1c2f2eb23b4e22, type: 3}
- {fileID: 21300000, guid: 1935b542e258bd64ea3915a1b59b3ef0, type: 3}
- {fileID: 21300000, guid: 0149f5afd2f419b4d9fd9e80a31a33a9, type: 3}
- {fileID: 21300000, guid: 5139251ed94400b40a574058b9ac7983, type: 3}
......@@ -1867,8 +1917,8 @@ SpriteShapeRenderer:
- {fileID: 0}
- {fileID: 0}
m_LocalAABB:
m_Center: {x: 32.08577, y: 5.665845, z: -0.008}
m_Extent: {x: 38.403244, y: 12.123242, z: 0.008}
m_Center: {x: 32.082836, y: 5.6452894, z: -0.008}
m_Extent: {x: 38.374775, y: 12.06943, z: 0.008}
--- !u!4 &2027679588
Transform:
m_ObjectHideFlags: 0
......
using UnityEngine;
public class AI_Patrol : WeightedAction
{
AI_Core myAI;
public Transform targetPos;
private Transform startPos;
private bool movingRight;
public float speed;
public float smoothTime;
private Vector3 velocity = Vector3.zero;
public Transform groundDetection;
// Use this for initialization
void Start()
{
startPos = transform;
myAI = GetComponent<AI_Core>();
}
void CheckConditions()
{
myAI.desiredAction.Add(this);
}
public override void performAction()
{
transform.position = Vector3.SmoothDamp(startPos.position, targetPos.position, ref velocity, smoothTime);
//transform.Translate(Vector2.right * Time.deltaTime * speed);
//RaycastHit2D groundInfo = Physics2D.Raycast(groundDetection.position, Vector2.down, distance);
//if(groundInfo.collider == false)
//{
// turn();
//}
}
public void turn()
{
if (movingRight == true)
{
transform.eulerAngles = new Vector3(0, -180, 0);
movingRight = false;
}
else
{
transform.eulerAngles = new Vector3(0, 0, 0);
movingRight = true;
}
}
}
fileFormatVersion: 2
guid: ba7900644f41dc6449121167e141a03b
timeCreated: 1536953209
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -44,13 +44,6 @@ public class AI_Wanders : WeightedAction
//AI wanders arround when its in detection range of the player
void CheckConditions()
{
nearestPlayer = myAI.findNearestPlayer();
if (Vector3.Distance(transform.position, nearestPlayer.transform.position) > myAI.detectionRange)
{
return;
}
myAI.desiredAction.Add(this);
}
......
......@@ -34,4 +34,9 @@ public class Life : MonoBehaviour {
Destroy(gameObject);
Debug.Log("Death");
}
}
\ No newline at end of file
public int getCurrentLife()
{
return currentLife;
}
}
fileFormatVersion: 2
guid: 83eb4399ff535ee4cbc76de3b8a32e46
timeCreated: 1536939600
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 87867fa499c44294f8c224ff00e99e73
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 064e9cc5b6bebf64abbd9a46df327724
timeCreated: 1536950083
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 995e9971f4a3eda4da6ce08b6fdffd42
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 83eb4399ff535ee4cbc76de3b8a32e46
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 064e9cc5b6bebf64abbd9a46df327724
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment