Commit 29e5f60a authored by Christopher Benes's avatar Christopher Benes
Browse files

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

parents 04d6b1db 7cf6460a
......@@ -15,7 +15,7 @@ GameObject:
- component: {fileID: 5372445436103654034}
m_Layer: 0
m_Name: Destroyable_Thing
m_TagString: Untagged
m_TagString: DestroyableByFire
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......@@ -68,8 +68,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingLayerID: -614652393
m_SortingLayer: 4
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: d0cee4e8b659c5646ac1e205b88a3256, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
......
......@@ -13,7 +13,12 @@ GameObject:
- component: {fileID: 2055293003418080559}
- component: {fileID: 52145075018362291}
- component: {fileID: 52145075018362284}
- component: {fileID: 52145075018362287}
- component: {fileID: 779623631694574805}
- component: {fileID: 352228602}
- component: {fileID: 352228603}
- component: {fileID: 352228604}
- component: {fileID: 352228605}
- component: {fileID: 352228606}
m_Layer: 10
m_Name: Player
m_TagString: Player
......@@ -30,7 +35,7 @@ Transform:
m_GameObject: {fileID: 52145075018362288}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 2, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
......@@ -72,7 +77,7 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: d0cee4e8b659c5646ac1e205b88a3256, type: 3}
m_Sprite: {fileID: 21300000, guid: c8a742c1f2ebb43b9afe34a47304c051, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
......@@ -109,25 +114,35 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Speed: 30
m_JumpForce: 10
m_fallMultiplier: 2.5
m_lowJumpMultiplier: 2
m_MovementSmoothing: 0.05
m_AirControl: 1
m_CanSwim: 1
m_WhatIsGround:
serializedVersion: 2
m_Bits: 512
m_GroundCheck: {fileID: 52145075018362285}
m_GroundCheckDistance: 1
m_GroundCheckDistance: 0.6
m_GroundedRadius: 0.25
m_GroundedOffset: {x: 0, y: 0}
m_GroundMaxSlopeAngle: 45
m_GroundedOffset: {x: -0.09, y: -0.5}
m_SecondsWaitToJump: 0.5
m_MaxJumpCount: 1
m_fallMultiplier: 2.5
m_lowJumpMultiplier: 2
OnLandEvent:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
OnSwimEvent:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
OnJumpEvent:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!50 &52145075018362284
Rigidbody2D:
serializedVersion: 4
......@@ -149,8 +164,8 @@ Rigidbody2D:
m_SleepingMode: 1
m_CollisionDetection: 1
m_Constraints: 4
--- !u!61 &52145075018362287
BoxCollider2D:
--- !u!70 &779623631694574805
CapsuleCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
......@@ -162,16 +177,86 @@ BoxCollider2D:
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 1, y: 1}
newSize: {x: 0.16, y: 0.16}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
m_Offset: {x: -0.03, y: -0.36}
m_Size: {x: 1.05, y: 1.39}
m_Direction: 0
--- !u!114 &352228602
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 52145075018362288}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2f8415a7fda2c084e87b3caa1b43ffbf, type: 3}
m_Name:
m_EditorClassIdentifier:
state: {fileID: 11400000, guid: c5777bcc7b64ce24c9bd65d2c4b7c639, type: 2}
onElementInfused: {fileID: 11400000, guid: 7e5b80a8353af1846a878c3a997bdb4a, type: 2}
--- !u!114 &352228603
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 52145075018362288}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: adc21094da13d8649a490855a137565f, type: 3}
m_Name:
m_EditorClassIdentifier:
cooldown: 0
volleySize: 0
launchPower: 0
attackSpeed: 0
shotSpawn: {fileID: 0}
elementalAttack: {fileID: 0}
--- !u!114 &352228604
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 52145075018362288}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ad90db0185377664288543ce4696c6b8, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &352228605
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 52145075018362288}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 83eb4399ff535ee4cbc76de3b8a32e46, type: 3}
m_Name:
m_EditorClassIdentifier:
Cooldown: 0
volleySize: 0
launchPower: 0
attackSpeed: 0
shotSpawn: {fileID: 0}
fireBall: {fileID: 0}
--- !u!114 &352228606
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 52145075018362288}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5a8392b2d467dfc428ede6cd785337f2, type: 3}
m_Name:
m_EditorClassIdentifier:
weight: 0
isPerformingAction: 0
windAttack: {fileID: 0}
Cooldown: 0
attackRange: 0
firePower: 0
......@@ -278,12 +278,12 @@ PrefabInstance:
- target: {fileID: 7340435369038607274, guid: 938701439f7d9654da1b920d73ccf2cc,
type: 3}
propertyPath: m_LocalPosition.x
value: 8.68
value: 1.33
objectReference: {fileID: 0}
- target: {fileID: 7340435369038607274, guid: 938701439f7d9654da1b920d73ccf2cc,
type: 3}
propertyPath: m_LocalPosition.y
value: 3.5
value: 2.03
objectReference: {fileID: 0}
- target: {fileID: 7340435369038607274, guid: 938701439f7d9654da1b920d73ccf2cc,
type: 3}
......@@ -313,7 +313,7 @@ PrefabInstance:
- target: {fileID: 7340435369038607274, guid: 938701439f7d9654da1b920d73ccf2cc,
type: 3}
propertyPath: m_RootOrder
value: 4
value: 5
objectReference: {fileID: 0}
- target: {fileID: 7340435369038607274, guid: 938701439f7d9654da1b920d73ccf2cc,
type: 3}
......@@ -666,7 +666,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4738352637052488, guid: 6cd7f8e10f89642fd88661db0d3f3827, type: 3}
propertyPath: m_RootOrder
value: 5
value: 4
objectReference: {fileID: 0}
- target: {fileID: 4738352637052488, guid: 6cd7f8e10f89642fd88661db0d3f3827, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
......@@ -1181,16 +1181,6 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3962879857309384165, guid: 926b80f66a4f61b428fa10deff5f7842,
type: 3}
propertyPath: m_SortingLayerID
value: -614652393
objectReference: {fileID: 0}
- target: {fileID: 3962879857309384165, guid: 926b80f66a4f61b428fa10deff5f7842,
type: 3}
propertyPath: m_SortingLayer
value: 4
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 926b80f66a4f61b428fa10deff5f7842, type: 3}
--- !u!1 &1156108368
......
......@@ -628,6 +628,148 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4512b8eb550115443bbba2ecd59a960c, type: 3}
--- !u!1 &1644657071
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1644657076}
- component: {fileID: 1644657075}
- component: {fileID: 1644657073}
- component: {fileID: 1644657072}
- component: {fileID: 1644657074}
m_Layer: 0
m_Name: Obstacle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1644657072
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1644657071}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d5c135c3fe901cf4696abeebd2ac1f28, type: 3}
m_Name:
m_EditorClassIdentifier:
force: 1
--- !u!61 &1644657073
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1644657071}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 1, y: 1}
newSize: {x: 1, y: 1}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
--- !u!50 &1644657074
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1644657071}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!212 &1644657075
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1644657071}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, 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_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: d0325f4b5843676408fd1f628635d218, type: 3}
m_Color: {r: 0.41509432, g: 0.108125485, b: 0.06852971, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &1644657076
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1644657071}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3, y: 1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1685552533
GameObject:
m_ObjectHideFlags: 0
......
......@@ -4,22 +4,36 @@ using UnityEngine;
public class CameraController : MonoBehaviour
{
public GameObject player; //Public variable to store a reference to the player game object
public Transform target; //Public variable to store a reference to the player game object
public float smoothSpeed = 0.5f;
public bool lookAt = false;
public float maxDistance = 5f;
private Vector3 offset; //Private variable to store the offset distance between the player and camera
// Use this for initialization
void Start()
{
target = GameObject.FindGameObjectWithTag("Player").transform;
//Calculate and store the offset value by getting the distance between the player's position and camera's position.
offset = transform.position - player.transform.position;
offset = transform.position - target.transform.position;
if (offset.sqrMagnitude > maxDistance * maxDistance)
{
offset.x = 0f;
offset.y = 0f;
}
}
// LateUpdate is called after Update each frame
void LateUpdate()
void FixedUpdate()
{
// Set the position of the camera's transform to be the same as the player's, but offset by the calculated offset distance.
transform.position = player.transform.position + offset;
//transform.position = player.transform.position + offset;
Vector3 desiredPosition = target.position + offset;
Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed);
transform.position = smoothedPosition;
if(lookAt)transform.LookAt(target);
}
}
......@@ -14,6 +14,9 @@ public class AI_WindAttack : WeightedAction
public float Cooldown;
public float attackRange;
public float firePower;
public int damage;
public float destroyTime;
public float thrust;
// Use this for initialization
void Start()
......@@ -33,10 +36,6 @@ public class AI_WindAttack : WeightedAction
return;
}
Vector2 dir = Vector2.zero;
direction = dir;
myAI.desiredAction.Add(this);
}
......@@ -65,9 +64,4 @@ public class AI_WindAttack : WeightedAction
Vector3 rotatedVector = Quaternion.AngleAxis(0, Vector3.forward) * attackdir;
body.velocity = new Vector2(rotatedVector.x * firePower, rotatedVector.y * firePower);
}
private void OnDrawGizmosSelected()
{
Gizmos.color = Color.red;
}
}
......@@ -3,10 +3,17 @@ using UnityEngine;
public class AI_WindProjectile : MonoBehaviour
{
public float destroyTime = 1f;
public float thrust;
private float destroyTime;
private float thrust;
private int damage;
private void Start()
{
AI_WindAttack windattack = GetComponentInParent<AI_WindAttack>();
destroyTime = windattack.destroyTime;
thrust = windattack.thrust;
damage = windattack.damage;
}
void OnEnable()
{
......@@ -27,7 +34,7 @@ public class AI_WindProjectile : MonoBehaviour
dir.Normalize();
dir *= thrust;
other.attachedRigidbody.AddForce(dir, ForceMode2D.Impulse);
//other.attachedRigidbody.AddForce(Vector2.right*thrust, ForceMode2D.Impulse);
other.GetComponentInParent<Life>().Damage(damage);
}
Destroy();
}
......
......@@ -8,10 +8,11 @@ public class AI_FireAttack : WeightedAction
AI_Core myAI;
private float restCooldown;
public float Cooldown;
public float attackRange;
public float destroyTime;
public int damage;
public GameObject shot;
List<GameObject> shots;
public GameObject fireBall;
public float fireSpeed = 2f;
public int volleySize;
public int pooledAmount = 10;
......@@ -69,7 +70,7 @@ public class AI_FireAttack : WeightedAction
for (int i = 0; i < volleySize; i++)
{
launchPower += 3;
GameObject projectile = Instantiate(shot, shotspawn.position, shotspawn.rotation);
GameObject projectile = Instantiate(fireBall, shotspawn.position, shotspawn.rotation);
if (nearestPlayer.transform.position.x > this.transform.position.x)
{
projectile.GetComponent<Rigidbody2D>().velocity = new Vector2(launchPower, launchPower);
......
......@@ -2,46 +2,31 @@ using UnityEngine;
public class AI_FireProjectile : MonoBehaviour
{
public double damage;
public GameObject nearestPlayer;
private float destroyTime;
private float thrust;
private int damage;
/// <summary>
/// Bisher werden die Shots nach einer Sekunde auf inactive gesetzt
/// hier muss noch was mit Collidern eingefügt werden um
/// auf Zusammenstöße reagieren zu können, damit der Shot dann
/// auf inactive gesetzt wird
/// </summary>
public float destroyTime = 1f;
/// <summary>
/// Wenn das Geschoss auf active gesetzt wird, wird nach 2 Sekunden
/// die Destroy Methode aufgerufen
/// </summary>
private void Start()
{
AI_FireAttack fireAttack = GetComponentInParent<AI_FireAttack>();
destroyTime = fireAttack.destroyTime;
damage = fireAttack.damage;
}
void OnEnable()
{
Invoke("Destroy", destroyTime);
}
/// <summary>
/// Setzt das Geschoss auf 'inactive'
/// </summary>
void Destroy()
{
Destroy(gameObject);
}
/// <summary>
/// Beim Zusammenstoß mit einem anderen GameObject
/// </summary>
/// <param name="collision"></param>
private void OnTriggerEnter2D(Collider2D target)
private void OnTriggerEnter2D(Collider2D other)
{
if (target.CompareTag("Enemy"))
if (other.CompareTag("Player"))
{