Commit ad06c622 authored by Sebastian Frey's avatar Sebastian Frey
Browse files

MovementStates für alle Elemente hinzugefügt

parent f5105c6c
fileFormatVersion: 2
guid: bb8c54259e3f99e4db55ef49ac5b5072
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c06767ded2b76f145919c9655e53c998, type: 3}
m_Name: AirMoveState
m_EditorClassIdentifier:
jumpForce: 0
smoothing: 0
airControl: 0
moveSpeed: 0
maxJumpCount: 0
mass: 0
gravity: 0
fileFormatVersion: 2
guid: d8ddf6924a883e94583c59a55fd11f8d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c06767ded2b76f145919c9655e53c998, type: 3}
m_Name: DefaultMoveState
m_EditorClassIdentifier:
jumpForce: 0
smoothing: 0
airControl: 0
moveSpeed: 0
maxJumpCount: 0
mass: 0
gravity: 0
fileFormatVersion: 2
guid: 11203796b90159848b6c5f4217eed3ec
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c06767ded2b76f145919c9655e53c998, type: 3}
m_Name: EarthMoveState
m_EditorClassIdentifier:
jumpForce: 0
smoothing: 0
airControl: 0
moveSpeed: 0
maxJumpCount: 0
mass: 0
gravity: 0
fileFormatVersion: 2
guid: 92286a125406f3643b98aa3f886d53b1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c06767ded2b76f145919c9655e53c998, type: 3}
m_Name: FireMoveState
m_EditorClassIdentifier:
jumpForce: 0
smoothing: 0
airControl: 0
moveSpeed: 0
maxJumpCount: 0
mass: 0
gravity: 0
fileFormatVersion: 2
guid: 805f35d42b113b841b2c8f64adf50f4a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c06767ded2b76f145919c9655e53c998, type: 3}
m_Name: WaterMoveState
m_EditorClassIdentifier:
jumpForce: 0
smoothing: 0
airControl: 0
moveSpeed: 0
maxJumpCount: 0
mass: 0
gravity: 0
fileFormatVersion: 2
guid: b76e74a09da3f224f99559ac3d31fc0c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
......@@ -132,9 +132,18 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e310ba2b65602490894409ff217e2731, type: 3}
m_Name:
m_EditorClassIdentifier:
speed: 5
GroundDist: 0.5
layer: 0
m_JumpForce: 400
m_MovementSmoothing: 0.05
m_AirControl: 0
m_WhatIsGround:
serializedVersion: 2
m_Bits: 0
m_GroundCheck: {fileID: 0}
OnLandEvent:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &5143124933316929978
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -147,7 +156,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2f8415a7fda2c084e87b3caa1b43ffbf, type: 3}
m_Name:
m_EditorClassIdentifier:
state: {fileID: 11400000, guid: c5777bcc7b64ce24c9bd65d2c4b7c639, type: 2}
onAirInfused: {fileID: 11400000, guid: b0928121a3619584c9612f68610a97a5, type: 2}
onFireInfused: {fileID: 11400000, guid: f553df1a50d464e48837fbb6cb99b7e5, type: 2}
onEarthInfused: {fileID: 11400000, guid: 59d96edea2ecb434999c09413da7449a, type: 2}
onFireInfused: {fileID: 11400000, guid: f553df1a50d464e48837fbb6cb99b7e5, type: 2}
onWaterInfused: {fileID: 11400000, guid: ca31b08da78cb134086d7688bbb50628, type: 2}
......@@ -24,23 +24,23 @@ namespace _Game.Scripts.Player
switch (_currentObject.tag)
{
case "Air":
state.currentElement = InfusedElement.Air;
state.currentInfusedElement = InfusedElement.Air;
onAirInfused.Raise();
break;
case "Earth":
state.currentElement = InfusedElement.Earth;
state.currentInfusedElement = InfusedElement.Earth;
onEarthInfused.Raise();
break;
case "Fire":
state.currentElement = InfusedElement.Fire;
state.currentInfusedElement = InfusedElement.Fire;
onFireInfused.Raise();
break;
case "Water":
state.currentElement = InfusedElement.Water;
state.currentInfusedElement = InfusedElement.Water;
onWaterInfused.Raise();
break;
default:
state.currentElement = InfusedElement.None;
state.currentInfusedElement = InfusedElement.None;
break;
}
_targetScript.InfuseElement();
......
using System;
using UnityEngine;
namespace _Game.Scripts.Scriptable_Object
{
[CreateAssetMenu(fileName = "New Movement State", menuName = "Movement State", order = 53)]
public class MovementState : ScriptableObject
{
[SerializeField] public float jumpForce;
[SerializeField] public float smoothing;
[SerializeField] public bool airControl;
[SerializeField] public float moveSpeed;
[SerializeField] public int maxJumpCount;
[SerializeField] public float mass;
[SerializeField] public float gravity;
}
}
fileFormatVersion: 2
guid: c06767ded2b76f145919c9655e53c998
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
namespace _Game.Scripts.Scriptable_Object
{
[CreateAssetMenu(fileName = "New Player State", menuName = "PlayerState", order = 51)]
[CreateAssetMenu(fileName = "New Player State", menuName = "Player State", order = 51)]
public class PlayerState : ScriptableObject
{
public InfusedElement currentElement;
[SerializeField] public InfusedElement currentInfusedElement;
[SerializeField] private MovementState currentMoveState;
[SerializeField] private MovementState airMoveState;
[SerializeField] private MovementState earthMoveState;
[SerializeField] private MovementState fireMoveState;
[SerializeField] private MovementState waterMoveState;
[SerializeField] private MovementState defaultMoveState;
[SerializeField] private float currentJumpForce;
[SerializeField] private float currentSmoothing;
[SerializeField] private bool currentAirControl;
[SerializeField] private float currentMoveSpeed;
[SerializeField] private int currentMaxJumpCount;
[SerializeField] private float currentMass;
[SerializeField] private float currentGravity;
public void UpdateMoveState(InfusedElement newElement)
{
switch (newElement)
{
case InfusedElement.Air:
currentMoveState = airMoveState;
UpdateMovementState();
break;
case InfusedElement.Earth:
currentMoveState = earthMoveState;
UpdateMovementState();
break;
case InfusedElement.Fire:
currentMoveState = fireMoveState;
UpdateMovementState();
break;
case InfusedElement.Water:
currentMoveState = waterMoveState;
UpdateMovementState();
break;
case InfusedElement.None:
currentMoveState = defaultMoveState;
UpdateMovementState();
break;
default:
throw new ArgumentOutOfRangeException("newElement", newElement, null);
}
}
private void UpdateMovementState()
{
currentJumpForce = currentMoveState.jumpForce;
currentSmoothing = currentMoveState.smoothing;
currentAirControl = currentMoveState.airControl;
currentMoveSpeed = currentMoveState.moveSpeed;
currentMaxJumpCount = currentMoveState.maxJumpCount;
currentMass = currentMoveState.mass;
currentGravity = currentMoveState.gravity;
}
}
public enum InfusedElement
......@@ -18,4 +76,4 @@ namespace _Game.Scripts.Scriptable_Object
Earth,
Air
}
}
\ No newline at end of file
}
Supports Markdown
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