Commit 014aa210 authored by Sebastian Frey's avatar Sebastian Frey
Browse files

Wasserattacke hinzugefügt

parent 9026cd55
......@@ -9,7 +9,7 @@ MonoBehaviour:
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 0}
m_Script: {fileID: 11500000, guid: d3ce1e10b2e79864eb493cdf9d78e741, type: 3}
m_Name: Movement States
m_EditorClassIdentifier: Assembly-CSharp:_Game.Scripts.Scriptable_Object:MovementStates
airMoveState:
......
......@@ -12,13 +12,15 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 353b156b7c59b1c45a8767d7500b31fb, type: 3}
m_Name: PlayerState
m_EditorClassIdentifier:
currentInfusedElement: 0
currentMoveState: {fileID: 11400000, guid: 11203796b90159848b6c5f4217eed3ec, type: 2}
airMoveState: {fileID: 11400000, guid: d8ddf6924a883e94583c59a55fd11f8d, type: 2}
earthMoveState: {fileID: 11400000, guid: 92286a125406f3643b98aa3f886d53b1, type: 2}
fireMoveState: {fileID: 11400000, guid: 805f35d42b113b841b2c8f64adf50f4a, type: 2}
waterMoveState: {fileID: 11400000, guid: b76e74a09da3f224f99559ac3d31fc0c, type: 2}
defaultMoveState: {fileID: 11400000, guid: 11203796b90159848b6c5f4217eed3ec, type: 2}
currentMoveState:
jumpForce: 0
smoothing: 0
airControl: 0
moveSpeed: 0
maxJumpCount: 0
mass: 0
gravity: 0
movementStates: {fileID: 11400000, guid: c757aad6925b37a46b916f609fa9012b, type: 2}
currentJumpForce: 0
currentSmoothing: 0
currentAirControl: 0
......
......@@ -12,9 +12,10 @@ GameObject:
- component: {fileID: 8382647395794564539}
- component: {fileID: 707565156377968333}
- component: {fileID: 6258883857105394474}
m_Layer: 0
- component: {fileID: 3289220650684677341}
m_Layer: 12
m_Name: WaterAttack
m_TagString: Untagged
m_TagString: Water
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......@@ -126,5 +127,18 @@ BoxCollider2D:
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.0001, y: 0.0001}
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
--- !u!114 &3289220650684677341
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7588789901055592565}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: de4023dc2d7d96345a45b29dd765644a, type: 3}
m_Name:
m_EditorClassIdentifier:
destroyTime: 2
......@@ -378,6 +378,36 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 615b74be12ac7ec4e9b491a7ef5cbbe1, type: 3}
--- !u!1 &392034771
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 392034772}
m_Layer: 0
m_Name: WaterAttackSpawner
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &392034772
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 392034771}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.5, y: -0.25, z: 0}
m_LocalScale: {x: 1, y: 0.5, z: 1}
m_Children: []
m_Father: {fileID: 1876157337}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &531909445
GameObject:
m_ObjectHideFlags: 0
......@@ -769,17 +799,18 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1876157326}
m_Enabled: 1
m_Enabled: 0
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}
cooldown: 3
volleySize: 1
launchPower: 20
attackSpeed: 0.1
shotSpawn: {fileID: 392034772}
elementalAttack: {fileID: 7588789901055592565, guid: c916ffaff3c476b448f67d9d827b3e7e,
type: 3}
--- !u!114 &1876157328
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -787,17 +818,18 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1876157326}
m_Enabled: 1
m_Enabled: 0
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}
elementalAttack: {fileID: 0}
cooldown: 2
volleySize: 10
launchPower: 20
attackSpeed: 0.1
shotSpawn: {fileID: 1992150795}
elementalAttack: {fileID: 1870586037468468, guid: 61411254df3161c4e81f6c0a4f2cd33c,
type: 3}
--- !u!114 &1876157329
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -805,7 +837,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1876157326}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ad90db0185377664288543ce4696c6b8, type: 3}
m_Name:
......@@ -817,7 +849,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1876157326}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5a8392b2d467dfc428ede6cd785337f2, type: 3}
m_Name:
......@@ -842,3 +874,39 @@ MonoBehaviour:
m_EditorClassIdentifier:
state: {fileID: 11400000, guid: c5777bcc7b64ce24c9bd65d2c4b7c639, type: 2}
onElementInfused: {fileID: 11400000, guid: 7e5b80a8353af1846a878c3a997bdb4a, type: 2}
--- !u!4 &1876157337 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 52145075018362285, guid: 2e3528907311e438dab0d393127aa332,
type: 3}
m_PrefabInstance: {fileID: 1711059647}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1992150794
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1992150795}
m_Layer: 0
m_Name: FireAttackSpawner
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1992150795
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1992150794}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 1.05, y: 0.1, z: 0}
m_LocalScale: {x: 1, y: 0.5, z: 1}
m_Children: []
m_Father: {fileID: 1876157337}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -6,7 +6,7 @@ namespace _Game.Scripts.Elements
{
public void InfuseElement()
{
this.GetComponent<SpriteRenderer>().color = Color.green;
//this.GetComponent<SpriteRenderer>().color = Color.green;
Debug.Log("Infused " + this.gameObject.tag);
}
}
......
......@@ -70,15 +70,5 @@ namespace _Game.Scripts.Player.PlayerAttacks.Air
{
Gizmos.color = Color.red;
}
public void Enable()
{
this.enabled = true;
}
public void Disable()
{
this.enabled = false;
}
}
}
......@@ -15,15 +15,5 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth
{
}
public void Enable()
{
this.enabled = true;
}
public void Disable()
{
this.enabled = false;
}
}
}
......@@ -25,7 +25,7 @@ namespace _Game.Scripts.Player.PlayerAttacks.Fire
{
if (!Input.GetButtonDown("Fire1") || !(Time.time > _nextFire)) return;
Debug.Log("pla");
Debug.Log("Fire_Attack");
_nextFire = _nextFire + cooldown;
StartCoroutine(Fire());
......@@ -42,15 +42,5 @@ namespace _Game.Scripts.Player.PlayerAttacks.Fire
yield return new WaitForSeconds(attackSpeed);
}
}
public void Enable()
{
this.enabled = true;
}
public void Disable()
{
this.enabled = false;
}
}
}
......@@ -37,20 +37,15 @@ namespace _Game.Scripts.Player.PlayerAttacks.Water
{
var position = shotSpawn.position;
var projectile = Instantiate(elementalAttack, position, shotSpawn.rotation);
var direction = position - transform.position;
var direction = new Vector3(position.x - transform.position.x, 0.0f, 0.0f);
if (direction.x < 0)
{
projectile.transform.localScale = new Vector3(-projectile.transform.localScale.x,
projectile.transform.localScale.y, 0.0f);
}
projectile.GetComponent<Rigidbody2D>().velocity = direction * launchPower;
yield return new WaitForSeconds(attackSpeed);
}
}
public void Enable()
{
this.enabled = true;
}
public void Disable()
{
this.enabled = false;
}
}
}
......@@ -4,7 +4,7 @@ namespace _Game.Scripts.Player.PlayerAttacks.Water
{
public class PlayerWaterProjectile : MonoBehaviour
{
public float destroyTime;
public float destroyTime = 2.0f;
private void OnEnable()
{
......
......@@ -40,42 +40,42 @@ namespace _Game.Scripts.Player
case "Air":
state.UpdateElement(InfusedElement.Air);
onElementInfused.Raise(InfusedElement.Air);
_airAttack.Enable();
_earthAttack.Disable();
_fireAttack.Disable();
_waterAttack.Disable();
_airAttack.enabled = true;
_earthAttack.enabled = false;
_fireAttack.enabled = false;
_waterAttack.enabled = false;
break;
case "Earth":
state.UpdateElement(InfusedElement.Earth);
onElementInfused.Raise(InfusedElement.Earth);
_airAttack.Disable();
_earthAttack.Enable();
_fireAttack.Disable();
_waterAttack.Disable();
_airAttack.enabled = false;
_earthAttack.enabled = true;
_fireAttack.enabled = false;
_waterAttack.enabled = false;
break;
case "Fire":
state.UpdateElement(InfusedElement.Fire);
onElementInfused.Raise(InfusedElement.Fire);
_airAttack.Disable();
_earthAttack.Disable();
_fireAttack.Enable();
_waterAttack.Disable();
_airAttack.enabled = false;
_earthAttack.enabled = false;
_fireAttack.enabled = true;
_waterAttack.enabled = false;
break;
case "Water":
state.UpdateElement(InfusedElement.Water);
onElementInfused.Raise(InfusedElement.Water);
_airAttack.Disable();
_earthAttack.Disable();
_fireAttack.Disable();
_waterAttack.Enable();
_airAttack.enabled = false;
_earthAttack.enabled = false;
_fireAttack.enabled = false;
_waterAttack.enabled = true;
break;
default:
state.UpdateElement(InfusedElement.None);
onElementInfused.Raise(InfusedElement.None);
_airAttack.Disable();
_earthAttack.Disable();
_fireAttack.Disable();
_waterAttack.Disable();
_airAttack.enabled = false;
_earthAttack.enabled = false;
_fireAttack.enabled = false;
_waterAttack.enabled = false;
break;
}
_targetScript.InfuseElement();
......
......@@ -11,7 +11,7 @@ namespace _Game.Scripts.Scriptable_Object
[CreateAssetMenu(fileName = "New Player State", menuName = "Player State", order = 51)]
public class PlayerState : ScriptableObject
{
[SerializeField] private InfusedElement currentInfusedElement;
//[SerializeField] private InfusedElement currentInfusedElement;
[SerializeField] private MovementState currentMoveState;
[SerializeField] private MovementStates movementStates;
......@@ -26,25 +26,13 @@ namespace _Game.Scripts.Scriptable_Object
public void UpdateElement(InfusedElement newElement)
{
currentInfusedElement = newElement;
//currentInfusedElement = newElement;
currentMoveState = movementStates.GetMovementState(newElement);
UpdateMovement();
}
private void UpdateMovement()
public MovementState GetCurrentMovementState()
{
currentJumpForce = currentMoveState.jumpForce;
currentSmoothing = currentMoveState.smoothing;
currentAirControl = currentMoveState.airControl;
currentMoveSpeed = currentMoveState.moveSpeed;
currentMaxJumpCount = currentMoveState.maxJumpCount;
currentMass = currentMoveState.mass;
currentGravity = currentMoveState.gravity;
}
public void ChangeElementalAttack()
{
return currentMoveState;
}
}
......
......@@ -23,7 +23,7 @@ TagManager:
-
- PostProcessing
- Ground
- Character
- Player
- Elements
- ElementalAttacks
-
......
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