Commit c9db1811 authored by Christopher Benes's avatar Christopher Benes

commit versuch 2 du dumme sau

parents 1769b1c1 57ad37d7
...@@ -9,7 +9,7 @@ Material: ...@@ -9,7 +9,7 @@ Material:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: LiberationSans SDF Material m_Name: LiberationSans SDF Material
m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3} m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3}
m_ShaderKeywords: _EMISSION m_ShaderKeywords: UNDERLAY_ON _EMISSION
m_LightmapFlags: 1 m_LightmapFlags: 1
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 0
...@@ -102,7 +102,7 @@ Material: ...@@ -102,7 +102,7 @@ Material:
- _OutlineSoftness: 0 - _OutlineSoftness: 0
- _OutlineUVSpeedX: 0 - _OutlineUVSpeedX: 0
- _OutlineUVSpeedY: 0 - _OutlineUVSpeedY: 0
- _OutlineWidth: 0 - _OutlineWidth: 0.113
- _Parallax: 0.02 - _Parallax: 0.02
- _PerspectiveFilter: 0.875 - _PerspectiveFilter: 0.875
- _Reflectivity: 10 - _Reflectivity: 10
...@@ -20,40 +20,40 @@ MonoBehaviour: ...@@ -20,40 +20,40 @@ MonoBehaviour:
moveSpeed: 30 moveSpeed: 30
maxJumpCount: 5 maxJumpCount: 5
mass: 0.1 mass: 0.1
gravity: 0.1 gravity: 0.5
earthMoveState: earthMoveState:
jumpForce: 2 jumpForce: 10
smoothing: 0.03 smoothing: 0.03
airControl: 0 airControl: 1
canSwim: 0 canSwim: 0
moveSpeed: 15 moveSpeed: 15
maxJumpCount: 1 maxJumpCount: 1
mass: 10 mass: 20
gravity: 1 gravity: 3
fireMoveState: fireMoveState:
jumpForce: 10 jumpForce: 15
smoothing: 0.03 smoothing: 0.03
airControl: 1 airControl: 1
canSwim: 0 canSwim: 1
moveSpeed: 20 moveSpeed: 20
maxJumpCount: 1 maxJumpCount: 2
mass: 1 mass: 1
gravity: 1 gravity: 3
waterMoveState: waterMoveState:
jumpForce: 7 jumpForce: 10
smoothing: 0.03 smoothing: 0.03
airControl: 1 airControl: 1
canSwim: 0 canSwim: 1
moveSpeed: 15 moveSpeed: 20
maxJumpCount: 1 maxJumpCount: 1
mass: 3 mass: 1
gravity: 0 gravity: 3
defaultMoveState: defaultMoveState:
jumpForce: 10 jumpForce: 15
smoothing: 0.03 smoothing: 0.03
airControl: 1 airControl: 1
canSwim: 0 canSwim: 1
moveSpeed: 20 moveSpeed: 30
maxJumpCount: 1 maxJumpCount: 1
mass: 1 mass: 1
gravity: 1 gravity: 3
...@@ -14,12 +14,13 @@ MonoBehaviour: ...@@ -14,12 +14,13 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
currentInfusedElement: 2 currentInfusedElement: 2
currentMoveState: currentMoveState:
jumpForce: 0 jumpForce: 10
smoothing: 0 smoothing: 0.03
airControl: 0 airControl: 1
moveSpeed: 0 canSwim: 1
maxJumpCount: 0 moveSpeed: 20
mass: 0 maxJumpCount: 1
gravity: 0 mass: 1
gravity: 3
movementStates: {fileID: 11400000, guid: c757aad6925b37a46b916f609fa9012b, type: 2} movementStates: {fileID: 11400000, guid: c757aad6925b37a46b916f609fa9012b, type: 2}
charges: 4 charges: 1
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2007383666d03dc4da582cfeb693f08a guid: b44debfd3316a0343859348beec8652b
MonoImporter: folderAsset: yes
DefaultImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 14c656a7951b64b469033bb82afe030d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7b49a238c2ae40648abf67030ad58927
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontName: Brady Bunch Remastered
fontNames:
- Brady Bunch Remastered
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 35f90f7ca8ffd914585831ef16294a4c
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
...@@ -68,8 +68,8 @@ SpriteRenderer: ...@@ -68,8 +68,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5 m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89 m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 1206248169
m_SortingLayer: 0 m_SortingLayer: 3
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 8b8155e0c48fa0c479794a7820e522b9, type: 3} m_Sprite: {fileID: 21300000, guid: 8b8155e0c48fa0c479794a7820e522b9, type: 3}
m_Color: {r: 0.16932298, g: 0.1273585, b: 1, a: 1} m_Color: {r: 0.16932298, g: 0.1273585, b: 1, a: 1}
...@@ -102,7 +102,7 @@ Rigidbody2D: ...@@ -102,7 +102,7 @@ Rigidbody2D:
m_Interpolate: 0 m_Interpolate: 0
m_SleepingMode: 1 m_SleepingMode: 1
m_CollisionDetection: 0 m_CollisionDetection: 0
m_Constraints: 0 m_Constraints: 4
--- !u!61 &6258883857105394474 --- !u!61 &6258883857105394474
BoxCollider2D: BoxCollider2D:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
This diff is collapsed.
fileFormatVersion: 2 fileFormatVersion: 2
guid: d74592df6e4e9db4eb84dfa86227d553 guid: 5b5951e593e0fc1419f6e0dbb2ba1682
PrefabImporter: PrefabImporter:
externalObjects: {} externalObjects: {}
userData: userData:
......
This diff is collapsed.
This diff is collapsed.
...@@ -7,6 +7,7 @@ public class DestroyObjectByEarth : MonoBehaviour ...@@ -7,6 +7,7 @@ public class DestroyObjectByEarth : MonoBehaviour
{ {
void OnCollisionEnter2D(Collision2D other) void OnCollisionEnter2D(Collision2D other)
{ {
if (!other.gameObject.CompareTag("Player")) return;
if (other.gameObject.GetComponent<PlayerEarthAttack>().isStomping) if (other.gameObject.GetComponent<PlayerEarthAttack>().isStomping)
{ {
Destroy(gameObject); Destroy(gameObject);
......
...@@ -6,6 +6,7 @@ using UnityEngine; ...@@ -6,6 +6,7 @@ using UnityEngine;
public class MovingPlattform : MonoBehaviour { public class MovingPlattform : MonoBehaviour {
public List<Vector2> m_Points; public List<Vector2> m_Points;
public List<string> m_Tags;
[SerializeField] private float m_Speed = 0.3f; //plattform geschwindigkeit [SerializeField] private float m_Speed = 0.3f; //plattform geschwindigkeit
[SerializeField] private float m_Wait = 2f; //zeit in Sekunden wie lange die Plattform wartet [SerializeField] private float m_Wait = 2f; //zeit in Sekunden wie lange die Plattform wartet
[SerializeField] private int m_StartIndex = 0; //Index in der Liste an der die Plattform starten soll [SerializeField] private int m_StartIndex = 0; //Index in der Liste an der die Plattform starten soll
...@@ -94,21 +95,31 @@ public class MovingPlattform : MonoBehaviour { ...@@ -94,21 +95,31 @@ public class MovingPlattform : MonoBehaviour {
} }
//CollisionEnter mit Spieler kann um Gegner erweitert werden //CollisionEnter mit Spieler kann um Gegner erweitert werden
void OnCollisionEnter2D (Collision2D col2D) { void OnCollisionEnter2D (Collision2D col2D)
if (col2D.transform.gameObject.tag.Equals ("Player")) { {
//Setzt parent object des Spielers zu dieser Plattform somit wird die transformation der Plattform auf den Spieler Übertragen for (int i = 0; i < m_Tags.Count; i++)
col2D.transform.SetParent (gameObject.transform); {
if (m_MoveingByTouching) if (col2D.gameObject.tag.Equals(m_Tags[i]) || col2D.gameObject.tag.Equals("Player"))
Patrol (); {
} //Setzt parent object des Spielers zu dieser Plattform somit wird die transformation der Plattform auf den Spieler Übertragen
col2D.transform.SetParent (gameObject.transform);
if (m_MoveingByTouching)
Patrol ();
}
}
} }
//CollisionExit mit Spieler kann um Gegner erweitert werden //CollisionExit mit Spieler kann um Gegner erweitert werden
void OnCollisionExit2D (Collision2D col2D) { void OnCollisionExit2D (Collision2D col2D) {
if (col2D.transform.gameObject.tag.Equals ("Player")) {
//Sets Spieler Parent zu niemand for (int i = 0; i < m_Tags.Count; i++)
col2D.transform.SetParent (null); {
} if (col2D.gameObject.tag.Equals(m_Tags[i]) || col2D.gameObject.tag.Equals("Player"))
{
//Sets Spieler Parent zu niemand
col2D.transform.SetParent (null);
}
}
} }
void OnDrawGizmosSelected () { void OnDrawGizmosSelected () {
...@@ -128,4 +139,4 @@ public class MovingPlattform : MonoBehaviour { ...@@ -128,4 +139,4 @@ public class MovingPlattform : MonoBehaviour {
} }
} }
} }
} }
\ No newline at end of file
...@@ -110,6 +110,7 @@ public class MovementController : MonoBehaviour ...@@ -110,6 +110,7 @@ public class MovementController : MonoBehaviour
public void Move(Vector2 move, bool jump) public void Move(Vector2 move, bool jump)
{ {
Debug.Log("grounded: " + m_Grounded + " aircontrol: " + m_AirControl);
//only control the player if grounded or airControl is turned on //only control the player if grounded or airControl is turned on
if (m_Grounded || (m_AirControl && (m_Airborn && !m_Grounded)) || (m_Swimming && m_CanSwim)) if (m_Grounded || (m_AirControl && (m_Airborn && !m_Grounded)) || (m_Swimming && m_CanSwim))
{ {
...@@ -140,23 +141,23 @@ public class MovementController : MonoBehaviour ...@@ -140,23 +141,23 @@ public class MovementController : MonoBehaviour
if (((m_Grounded) || (m_TempJumpCount > 1) || (m_Swimming && m_CanSwim)) && !m_Jumped) if (((m_Grounded) || (m_TempJumpCount > 1) || (m_Swimming && m_CanSwim)) && !m_Jumped)
{ {
// Add a vertical force to the player. // Add a vertical force to the player.
OnJumpEvent.Invoke();
m_Grounded = false; m_Grounded = false;
m_TempJumpCount--; m_TempJumpCount--;
//m_Rigidbody2D.AddForce (new Vector2 (0f, m_JumpForce)); //m_Rigidbody2D.AddForce (new Vector2 (0f, m_JumpForce));
m_Rigidbody2D.velocity = Vector2.up * m_JumpForce; m_Rigidbody2D.velocity = Vector2.up * m_JumpForce;
OnJumpEvent.Invoke();
StartCoroutine(Wait(m_SecondsWaitToJump)); StartCoroutine(Wait(m_SecondsWaitToJump));
} }
} }
if (m_Rigidbody2D.velocity.y < 0 && !m_Swimming) if (m_Rigidbody2D.velocity.y < 0 && !m_Swimming && !m_Grounded)
{ {
m_Rigidbody2D.velocity += Vector2.up * Physics2D.gravity.y * (m_fallMultiplier - 1) * Time.deltaTime; m_Rigidbody2D.velocity += Vector2.up * Physics2D.gravity.y * (m_fallMultiplier - 1) * Time.deltaTime;
} }
else if (m_Rigidbody2D.velocity.y > 0 && !Input.GetButton("Jump")) //else if (m_Rigidbody2D.velocity.y > 0 && !Input.GetButton("Jump"))
{ //{
m_Rigidbody2D.velocity += Vector2.up * Physics2D.gravity.y * (m_lowJumpMultiplier - 1) * Time.deltaTime; // m_Rigidbody2D.velocity += Vector2.up * Physics2D.gravity.y * (m_lowJumpMultiplier - 1) * Time.deltaTime;
} //}
} }
public void SetSwimming(bool value) public void SetSwimming(bool value)
...@@ -204,11 +205,13 @@ public class MovementController : MonoBehaviour ...@@ -204,11 +205,13 @@ public class MovementController : MonoBehaviour
private void OnCollisionEnter2D(Collision2D other) private void OnCollisionEnter2D(Collision2D other)
{ {
if(other.gameObject.layer == m_WhatIsGround)
m_Airborn = false; m_Airborn = false;
} }
private void OnCollisionExit2D(Collision2D other) private void OnCollisionExit2D(Collision2D other)
{ {
if(other.gameObject.layer == m_WhatIsGround)
m_Airborn = true; m_Airborn = true;
} }
......
...@@ -6,30 +6,54 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth ...@@ -6,30 +6,54 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth
public class PlayerEarthAttack : MonoBehaviour public class PlayerEarthAttack : MonoBehaviour
{ {
private float nextFire; private float nextFire;
public float Cooldown; public float cooldown;
public float massIncrease; public float massIncrease;
public bool isStomping; public bool isStomping;
MovementController controller; MovementController controller;
private RaycastHit2D[] RaycastHits2D = new RaycastHit2D[8]; private RaycastHit2D[] RaycastHits2D = new RaycastHit2D[8];
private LayerMask whatIsDestroyable; private LayerMask whatIsDestroyable;
private ContactFilter2D contactFilter2D; private ContactFilter2D contactFilter2D;
private bool _ready;
private bool _activated;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
controller = GetComponentInParent<MovementController>(); controller = GetComponentInParent<MovementController>();
contactFilter2D.SetLayerMask(whatIsDestroyable); contactFilter2D.SetLayerMask(whatIsDestroyable);
_ready = true;
_activated = false;
}
public bool Attack()
{
if (_ready)
{
_activated = true;
}
return _ready;
} }
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if (Input.GetButtonDown("Fire1") && Time.time > nextFire && !controller.Grounded) _ready = Time.time > nextFire;
{
nextFire = Time.time + Cooldown;
StartCoroutine(fire()); if (!_activated) return;
}
print("Fire_Attack");
nextFire = Time.time + cooldown;
StartCoroutine(fire());
_activated = false;
//if (Input.GetButtonDown("Fire1") && Time.time > nextFire && !controller.Grounded)
//{
// nextFire = Time.time + Cooldown;
// StartCoroutine(fire());
//}
} }
IEnumerator fire() IEnumerator fire()
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerEarthProjectile : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
...@@ -5,7 +5,7 @@ using System.Collections; ...@@ -5,7 +5,7 @@ using System.Collections;
public class Player_FireAttack : MonoBehaviour public class Player_FireAttack : MonoBehaviour
{ {
private float nextFire; private float nextFire;
public float Cooldown; public float cooldown;
public int volleySize; public int volleySize;
public float launchPower; public float launchPower;
public float attackSpeed; public float attackSpeed;
...@@ -14,23 +14,45 @@ public class Player_FireAttack : MonoBehaviour ...@@ -14,23 +14,45 @@ public class Player_FireAttack : MonoBehaviour
public GameObject fireBall; public GameObject fireBall;
private Rigidbody2D body; private Rigidbody2D body;
private bool _ready;
private bool _activated;
private void Start() private void Start()
{ {
nextFire = 0; nextFire = 0;
_ready = true;
_activated = false;
} }