Commit 2fba50f7 authored by Christopher Benes's avatar Christopher Benes

Merge branch 'master' of gitlab.fsi.hochschule-trier.de:GameDevWeek/ws-18_19/unity/suck-it

parents bab35a2d 5b34a7ba
Pipeline #2780 canceled with stages
......@@ -16,6 +16,7 @@ GameObject:
- component: {fileID: 5987062824809259808}
- component: {fileID: 114716552753954768}
- component: {fileID: 114692363085912100}
- component: {fileID: 8582909611794385439}
- component: {fileID: 879798643589630551}
m_Layer: 0
m_Name: Wind-Gegner
......@@ -156,7 +157,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1634356314439590}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ba7900644f41dc6449121167e141a03b, type: 3}
m_Name:
......@@ -189,7 +190,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1634356314439590}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 631c949a39ab5644f91bc6ef5158d2d4, type: 3}
m_Name:
......@@ -199,6 +200,25 @@ MonoBehaviour:
startWaitTime: 0
patrolRange: 4
speed: 3
--- !u!114 &8582909611794385439
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: dc36894bc57123a46b6aff239612cfda, type: 3}
m_Name:
m_EditorClassIdentifier:
weight: 6
isPerformingAction: 0
startWaitTime: 0
patrolRange: 4
speed: 0
targetPos: {fileID: 0}
smoothTime: 3
--- !u!114 &879798643589630551
MonoBehaviour:
m_ObjectHideFlags: 0
......
......@@ -670,7 +670,44 @@ PrefabInstance:
propertyPath: smoothTime
value: 3
objectReference: {fileID: 0}
m_RemovedComponents: []
- target: {fileID: 5987062824809259808, guid: 6cd7f8e10f89642fd88661db0d3f3827,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8582909611794385439, guid: 6cd7f8e10f89642fd88661db0d3f3827,
type: 3}
propertyPath: targetPos
value:
objectReference: {fileID: 1156108369}
- target: {fileID: 8582909611794385439, guid: 6cd7f8e10f89642fd88661db0d3f3827,
type: 3}
propertyPath: smoothTime
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8582909611794385439, guid: 6cd7f8e10f89642fd88661db0d3f3827,
type: 3}
propertyPath: speed
value: 2
objectReference: {fileID: 0}
- target: {fileID: 8582909611794385439, guid: 6cd7f8e10f89642fd88661db0d3f3827,
type: 3}
propertyPath: patrolRange
value: 5
objectReference: {fileID: 0}
- target: {fileID: 8582909611794385439, guid: 6cd7f8e10f89642fd88661db0d3f3827,
type: 3}
propertyPath: moveTime
value: 2
objectReference: {fileID: 0}
- target: {fileID: 8582909611794385439, guid: 6cd7f8e10f89642fd88661db0d3f3827,
type: 3}
propertyPath: chillTime
value: 0.5
objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 114692363085912100, guid: 6cd7f8e10f89642fd88661db0d3f3827, type: 3}
- {fileID: 5987062824809259808, guid: 6cd7f8e10f89642fd88661db0d3f3827, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 6cd7f8e10f89642fd88661db0d3f3827, type: 3}
--- !u!1 &719626315
GameObject:
......
using UnityEngine;
using System.Collections;
public class AI_WandersV2 : WeightedAction
{
AI_Core myAI;
Vector3 patrolSpot;
float minX, maxX, minY, maxY;
public float patrolRange;
public Transform targetPos;
private Transform startPos;
private Vector3 velocity = Vector3.zero;
public float moveTime;
public float chillTime;
private Vector3 dist;
// Use this for initialization
void Start()
{
myAI = GetComponent<AI_Core>();
minX = transform.position.x - patrolRange;
maxX = transform.position.x + patrolRange;
minY = transform.position.y - patrolRange;
maxY = transform.position.y + patrolRange;
nextPatrolPoint();
}
void CheckConditions()
{
myAI.desiredAction.Add(this);
}
public override void performAction()
{
transform.position = Vector3.SmoothDamp(transform.position, targetPos.position, ref velocity, moveTime);
}
void nextPatrolPoint()
{
do
{
patrolSpot = new Vector3(Random.Range(minX, maxX), Random.Range(minY, maxY), -1);
dist = transform.position - patrolSpot;
Debug.Log("penis");
} while (dist.magnitude < 4f);
targetPos.position = patrolSpot;
Invoke("nextPatrolPoint", moveTime+chillTime);
}
private void OnCollisionStay2D(Collision2D collision)
{
nextPatrolPoint();
}
}
fileFormatVersion: 2
guid: dc36894bc57123a46b6aff239612cfda
timeCreated: 1535725440
licenseType: Free
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