Commit c9db1811 authored by Christopher Benes's avatar Christopher Benes

commit versuch 2 du dumme sau

parents 1769b1c1 57ad37d7
......@@ -9,7 +9,7 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: LiberationSans SDF Material
m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3}
m_ShaderKeywords: _EMISSION
m_ShaderKeywords: UNDERLAY_ON _EMISSION
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
......@@ -102,7 +102,7 @@ Material:
- _OutlineSoftness: 0
- _OutlineUVSpeedX: 0
- _OutlineUVSpeedY: 0
- _OutlineWidth: 0
- _OutlineWidth: 0.113
- _Parallax: 0.02
- _PerspectiveFilter: 0.875
- _Reflectivity: 10
......@@ -20,40 +20,40 @@ MonoBehaviour:
moveSpeed: 30
maxJumpCount: 5
mass: 0.1
gravity: 0.1
gravity: 0.5
earthMoveState:
jumpForce: 2
jumpForce: 10
smoothing: 0.03
airControl: 0
airControl: 1
canSwim: 0
moveSpeed: 15
maxJumpCount: 1
mass: 10
gravity: 1
mass: 20
gravity: 3
fireMoveState:
jumpForce: 10
jumpForce: 15
smoothing: 0.03
airControl: 1
canSwim: 0
canSwim: 1
moveSpeed: 20
maxJumpCount: 1
maxJumpCount: 2
mass: 1
gravity: 1
gravity: 3
waterMoveState:
jumpForce: 7
jumpForce: 10
smoothing: 0.03
airControl: 1
canSwim: 0
moveSpeed: 15
canSwim: 1
moveSpeed: 20
maxJumpCount: 1
mass: 3
gravity: 0
mass: 1
gravity: 3
defaultMoveState:
jumpForce: 10
jumpForce: 15
smoothing: 0.03
airControl: 1
canSwim: 0
moveSpeed: 20
canSwim: 1
moveSpeed: 30
maxJumpCount: 1
mass: 1
gravity: 1
gravity: 3
......@@ -14,12 +14,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
currentInfusedElement: 2
currentMoveState:
jumpForce: 0
smoothing: 0
airControl: 0
moveSpeed: 0
maxJumpCount: 0
mass: 0
gravity: 0
jumpForce: 10
smoothing: 0.03
airControl: 1
canSwim: 1
moveSpeed: 20
maxJumpCount: 1
mass: 1
gravity: 3
movementStates: {fileID: 11400000, guid: c757aad6925b37a46b916f609fa9012b, type: 2}
charges: 4
charges: 1
fileFormatVersion: 2
guid: 2007383666d03dc4da582cfeb693f08a
MonoImporter:
guid: b44debfd3316a0343859348beec8652b
folderAsset: yes
DefaultImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
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:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingLayerID: 1206248169
m_SortingLayer: 3
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 8b8155e0c48fa0c479794a7820e522b9, type: 3}
m_Color: {r: 0.16932298, g: 0.1273585, b: 1, a: 1}
......@@ -102,7 +102,7 @@ Rigidbody2D:
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
m_Constraints: 4
--- !u!61 &6258883857105394474
BoxCollider2D:
m_ObjectHideFlags: 0
......
This diff is collapsed.
fileFormatVersion: 2
guid: d74592df6e4e9db4eb84dfa86227d553
guid: 5b5951e593e0fc1419f6e0dbb2ba1682
PrefabImporter:
externalObjects: {}
userData:
......
This diff is collapsed.
This diff is collapsed.
......@@ -7,6 +7,7 @@ public class DestroyObjectByEarth : MonoBehaviour
{
void OnCollisionEnter2D(Collision2D other)
{
if (!other.gameObject.CompareTag("Player")) return;
if (other.gameObject.GetComponent<PlayerEarthAttack>().isStomping)
{
Destroy(gameObject);
......
......@@ -6,6 +6,7 @@ using UnityEngine;
public class MovingPlattform : MonoBehaviour {
public List<Vector2> m_Points;
public List<string> m_Tags;
[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 int m_StartIndex = 0; //Index in der Liste an der die Plattform starten soll
......@@ -94,22 +95,32 @@ public class MovingPlattform : MonoBehaviour {
}
//CollisionEnter mit Spieler kann um Gegner erweitert werden
void OnCollisionEnter2D (Collision2D col2D) {
if (col2D.transform.gameObject.tag.Equals ("Player")) {
void OnCollisionEnter2D (Collision2D col2D)
{
for (int i = 0; i < m_Tags.Count; i++)
{
if (col2D.gameObject.tag.Equals(m_Tags[i]) || col2D.gameObject.tag.Equals("Player"))
{
//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
void OnCollisionExit2D (Collision2D col2D) {
if (col2D.transform.gameObject.tag.Equals ("Player")) {
for (int i = 0; i < m_Tags.Count; i++)
{
if (col2D.gameObject.tag.Equals(m_Tags[i]) || col2D.gameObject.tag.Equals("Player"))
{
//Sets Spieler Parent zu niemand
col2D.transform.SetParent (null);
}
}
}
void OnDrawGizmosSelected () {
Vector2 pos = transform.position;
......
......@@ -110,6 +110,7 @@ public class MovementController : MonoBehaviour
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
if (m_Grounded || (m_AirControl && (m_Airborn && !m_Grounded)) || (m_Swimming && m_CanSwim))
{
......@@ -140,23 +141,23 @@ public class MovementController : MonoBehaviour
if (((m_Grounded) || (m_TempJumpCount > 1) || (m_Swimming && m_CanSwim)) && !m_Jumped)
{
// Add a vertical force to the player.
OnJumpEvent.Invoke();
m_Grounded = false;
m_TempJumpCount--;
//m_Rigidbody2D.AddForce (new Vector2 (0f, m_JumpForce));
m_Rigidbody2D.velocity = Vector2.up * m_JumpForce;
OnJumpEvent.Invoke();
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;
}
else if (m_Rigidbody2D.velocity.y > 0 && !Input.GetButton("Jump"))
{
m_Rigidbody2D.velocity += Vector2.up * Physics2D.gravity.y * (m_lowJumpMultiplier - 1) * Time.deltaTime;
}
//else if (m_Rigidbody2D.velocity.y > 0 && !Input.GetButton("Jump"))
//{
// m_Rigidbody2D.velocity += Vector2.up * Physics2D.gravity.y * (m_lowJumpMultiplier - 1) * Time.deltaTime;
//}
}
public void SetSwimming(bool value)
......@@ -204,11 +205,13 @@ public class MovementController : MonoBehaviour
private void OnCollisionEnter2D(Collision2D other)
{
if(other.gameObject.layer == m_WhatIsGround)
m_Airborn = false;
}
private void OnCollisionExit2D(Collision2D other)
{
if(other.gameObject.layer == m_WhatIsGround)
m_Airborn = true;
}
......
......@@ -6,30 +6,54 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth
public class PlayerEarthAttack : MonoBehaviour
{
private float nextFire;
public float Cooldown;
public float cooldown;
public float massIncrease;
public bool isStomping;
MovementController controller;
private RaycastHit2D[] RaycastHits2D = new RaycastHit2D[8];
private LayerMask whatIsDestroyable;
private ContactFilter2D contactFilter2D;
private bool _ready;
private bool _activated;
// Start is called before the first frame update
void Start()
{
controller = GetComponentInParent<MovementController>();
contactFilter2D.SetLayerMask(whatIsDestroyable);
_ready = true;
_activated = false;
}
public bool Attack()
{
if (_ready)
{
_activated = true;
}
return _ready;
}
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Fire1") && Time.time > nextFire && !controller.Grounded)
{
nextFire = Time.time + Cooldown;
_ready = Time.time > nextFire;
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()
......
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;
public class Player_FireAttack : MonoBehaviour
{
private float nextFire;
public float Cooldown;
public float cooldown;
public int volleySize;
public float launchPower;
public float attackSpeed;
......@@ -14,23 +14,45 @@ public class Player_FireAttack : MonoBehaviour
public GameObject fireBall;
private Rigidbody2D body;
private bool _ready;
private bool _activated;
private void Start()
{
nextFire = 0;
_ready = true;
_activated = false;
}
private void Update()
{
if (Input.GetButtonDown("Fire1") && Time.time > nextFire)
{
nextFire = Time.time + Cooldown;
_ready = Time.time > nextFire;
if (!_activated) return;
print("Fire_Attack");
nextFire = Time.time + cooldown;
StartCoroutine(fire());
}
_activated = false;
//if (Input.GetButtonDown("Fire1") && Time.time > nextFire)
//{
// nextFire = Time.time + Cooldown;
// StartCoroutine(fire());
//}
}
public bool Attack()
{
if (_ready)
{
_activated = true;
}
return _ready;
}
IEnumerator fire()
{
......
using System.Collections;
using System.Collections;
using UnityEngine;
namespace _Game.Scripts.Player.PlayerAttacks.Water
......@@ -36,6 +36,8 @@ namespace _Game.Scripts.Player.PlayerAttacks.Water
_nextFire = Time.time + cooldown;
StartCoroutine(Fire());
_activated = false;
}
public bool Attack()
......@@ -64,8 +66,6 @@ namespace _Game.Scripts.Player.PlayerAttacks.Water
projectile.GetComponent<Rigidbody2D>().velocity = direction * launchPower;
yield return new WaitForSeconds(attackSpeed);
}
_activated = false;
}
}
}
using System;
using System;
using UnityEngine;
using _Game.Scripts.Elements;
using _Game.Scripts.Player.PlayerAttacks.Air;
......@@ -38,6 +38,13 @@ namespace _Game.Scripts.Player
_waterAttack = this.gameObject.GetComponent<PlayerWaterAttack>();
_controller = this.gameObject.GetComponent<MovementController>();
state.UpdateElement(InfusedElement.None);
_airAttack.enabled = false;
_earthAttack.enabled = false;
_fireAttack.enabled = false;
_waterAttack.enabled = false;
_controller.SetMovementParameters(state.GetCurrentMovementState());
}
private void Update()
......@@ -46,27 +53,27 @@ namespace _Game.Scripts.Player
{
switch (state.GetCurrentElement())
{
case InfusedElement.Air:
//case InfusedElement.Air:
// if(_waterAttack.Attack())
// {
// state.ChangeCharges(-1);
// onChargeChange.Raise();
// }
break;
//break;
case InfusedElement.Earth:
// if(_waterAttack.Attack())
// {
// state.ChangeCharges(-1);
// onChargeChange.Raise();
// }
if (_earthAttack.Attack())
{
state.ChangeCharges(-1);
onChargeChange.Raise();
}
break;
case InfusedElement.Fire:
// if(_waterAttack.Attack())
// {
// state.ChangeCharges(-1);
// onChargeChange.Raise();
// }
// break;
if (_fireAttack.Attack())
{
state.ChangeCharges(-1);
onChargeChange.Raise();
}
break;
case InfusedElement.Water:
print("done");
if(_waterAttack.Attack())
......
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
......@@ -19,13 +19,13 @@ namespace _Game.Scripts.Scriptable_Object
[SerializeField][Range(0, 5)] private int charges;
// [SerializeField] private float currentJumpForce;
// [SerializeField] private float currentSmoothing;
// [SerializeField] private bool currentAirControl;
// [SerializeField] private float currentMoveSpeed;
// [SerializeField] private int currentMaxJumpCount;
// [SerializeField] private float currentMass;