Commit f7f57ba8 authored by mthiele2's avatar mthiele2
parents 4da68b05 9ffcc730
......@@ -13,8 +13,8 @@ GameObject:
- component: {fileID: 70840632841850180}
- component: {fileID: 212152556601460820}
- component: {fileID: 5567333940966867164}
m_Layer: 0
m_Name: Pre_PlayerFireAttack
m_Layer: 12
m_Name: FireAttack
m_TagString: Fire
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
......
......@@ -142,3 +142,4 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
destroyTime: 3
pushFactor: 5
This diff is collapsed.
......@@ -258,7 +258,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
cooldown: 1
massIncrease: 30
massIncrease: 5
isStomping: 0
--- !u!114 &352228605
MonoBehaviour:
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2108024439
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2108024440}
- component: {fileID: 2108024442}
- component: {fileID: 2108024441}
m_Layer: 0
m_Name: Options
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &2108024440
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2108024439}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 3.22, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 395035932932740992}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!23 &2108024442
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2108024439}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10100, guid: 0000000000000000e000000000000000, 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: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!102 &2108024441
TextMesh:
serializedVersion: 3
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2108024439}
m_Text: 'E - Speichern
T - Teleport'
m_OffsetZ: 0
m_CharacterSize: 0.46
m_LineSpacing: 1
m_Anchor: 7
m_Alignment: 1
m_TabSize: 4
m_FontSize: 0
m_FontStyle: 0
m_RichText: 1
m_Font: {fileID: 0}
m_Color:
serializedVersion: 2
rgba: 4294967295
--- !u!1 &395035932932740994
GameObject:
m_ObjectHideFlags: 0
......@@ -122,8 +29,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2108024440}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......
This diff is collapsed.
This diff is collapsed.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SliderObject : MonoBehaviour
namespace _Game.Scripts.Level_Hazards
{
private Rigidbody2D rb;
public float force;
/*private void OnTriggerEnter2D(Collider2D collision)
public class SliderObject : MonoBehaviour
{
if (!GetComponent<Rigidbody2D>())
{
rb = GetComponent<Rigidbody2D>();
}
else
private Vector2 _position;
private Rigidbody2D _rigidbody2D;
private void Start()
{
Debug.Log("Kein Rigidbody");
_rigidbody2D = this.GetComponentInParent<Rigidbody2D>();
}
if (collision.gameObject.CompareTag("Water"))
private void OnCollisionEnter2D(Collision2D other)
{
if(collision.transform.position.x > GetComponent<Transform>().position.x)
{
rb.AddForce(new Vector2(-force, 0));
}else if (collision.transform.position.x < GetComponent<Transform>().position.x)
if (other.gameObject.layer == LayerMask.NameToLayer("Player") || other.gameObject.layer == LayerMask.NameToLayer("Enemy") ||
other.gameObject.CompareTag("Fire"))
{
rb.AddForce(new Vector2(force, 0));
_rigidbody2D.velocity = Vector2.zero;
_rigidbody2D.bodyType = RigidbodyType2D.Static;
}
}
}*/
private void OnCollisionEnter2D(Collision2D other)
{
if (other.transform.gameObject.tag.Equals("Water"))
{
gameObject.GetComponent<Rigidbody2D>().velocity = other.gameObject.GetComponent<Rigidbody2D>().velocity;
}
}
private void OnCollisionExit2D(Collision2D other)
{
if (other.transform.gameObject.tag.Equals("Water"))
private void OnCollisionExit2D(Collision2D other)
{
gameObject.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
if (other.gameObject.layer == LayerMask.NameToLayer("Player") || other.gameObject.layer == LayerMask.NameToLayer("Enemy") ||
other.gameObject.CompareTag("Fire"))
{
_rigidbody2D.velocity = Vector2.zero;
_rigidbody2D.bodyType = RigidbodyType2D.Dynamic;
}
}
}
}
......@@ -5,6 +5,7 @@ namespace _Game.Scripts.Player.PlayerAttacks.Water
public class PlayerWaterProjectile : MonoBehaviour
{
public float destroyTime = 2.0f;
public float pushFactor = 1.0f;
private float _startTime;
private float _deltaTime;
private float _newScaleFactor;
......@@ -18,7 +19,6 @@ namespace _Game.Scripts.Player.PlayerAttacks.Water
_startTime = Time.time;
_startingScale = this.gameObject.transform.localScale;
_rigidbody2D = GetComponent<Rigidbody2D>();
_startingVelocity = _rigidbody2D.velocity;
}
private void Update()
......@@ -38,6 +38,24 @@ namespace _Game.Scripts.Player.PlayerAttacks.Water
this.gameObject.transform.localScale = _newScaleVector;
}
public void OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.layer != LayerMask.NameToLayer("Ground"))
{
if (other.gameObject.layer == LayerMask.NameToLayer("MovableObject"))
{
if (Mathf.Abs(_rigidbody2D.velocity.x) > 0.0001f)
{
var projectileVelocityX = _rigidbody2D.velocity.x / Mathf.Abs(_rigidbody2D.velocity.x);
print(projectileVelocityX);
other.gameObject.GetComponent<Rigidbody2D>().velocity = new Vector3(projectileVelocityX * pushFactor, 0.0f, 0.0f);
}
}
Destroy();
}
}
private void OnEnable()
{
Invoke(nameof(Destroy), destroyTime);
......
......@@ -24,5 +24,10 @@ namespace PlayerSpawnPointScript
SavePointData savePosition = SaveSystem.LoadSavePoint();
transform.position = new Vector3(savePosition.position[0], savePosition.position[1], 0);
}
public void SetPlayerToSafePoint(Vector3 SafePoint)
{
transform.position = SafePoint;
}
}
}
......@@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LevelauswahlScript;
using PlayerSpawnPointScript;
public class SavePoint : MonoBehaviour
{
......@@ -45,4 +46,10 @@ public class SavePoint : MonoBehaviour
{
isUsed = var;
}
public void LoadSafePoint()
{
SaveSystem.SavePointUpdate(this);
PlayerSpawnPoint.psp.SetPlayerToSafePoint(gameObject.transform.position);
}
}
......@@ -24,7 +24,6 @@ public class SavePointData
Debug.Log(e);
savePointIsActiv = null;
}
}
public SavePointData(Vector2 save)
......
......@@ -13,6 +13,7 @@ namespace SavePointListScript
{
spl = this;
savePointList = GameObject.FindGameObjectsWithTag("Respawn");
Debug.Log(savePointList.Length);
}
public bool[] GetIsActivList()
......@@ -20,6 +21,7 @@ namespace SavePointListScript
if (savePointList.Length > 0)
{
bool[] savePointIsActiv = new bool[savePointList.Length];
Debug.Log(savePointIsActiv.Length);
int i = 0;
foreach (GameObject var in savePointList)
{
......@@ -34,8 +36,10 @@ namespace SavePointListScript
public void SetIsActivList(bool[] savePointIsActiv)
{
int i = 0;
Debug.Log(savePointIsActiv.Length);
foreach (GameObject var in savePointList)
{
Debug.Log(var);
SavePoint temp = savePointList[i].GetComponent<SavePoint>();
temp.SetIsUsed(savePointIsActiv[i]);
i++;
......
......@@ -12,6 +12,8 @@ namespace LevelauswahlScript
public GameObject Auswahl;
private EventSystem _myEventSystem;
public Button firstSelect;
private SavePoint[] savePoints;
// Start is called before the first frame update
void Start()
{
......
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