Commit 0ce36b9f authored by BlckTgr's avatar BlckTgr
Browse files

Added flying platform, basic movement and spore breath (TODO: make platform...

Added flying platform, basic movement and spore breath (TODO: make platform stop breathing, go up/down and react to player)
parent d6f3dc59
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: FlyingPlatform
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers: []
fileFormatVersion: 2
guid: f2d744ced3cd30c44971bf6a82f6dd2c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6241724066737184100
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6241724066737184101}
- component: {fileID: 6241724066737184026}
- component: {fileID: 6241724066737184024}
- component: {fileID: 6241724066737184027}
m_Layer: 8
m_Name: Flying Platform
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6241724066737184101
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6241724066737184100}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 3, y: 1, z: 1}
m_Children:
- {fileID: 6241724066686691532}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &6241724066737184026
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6241724066737184100}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, 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: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 191ca67cc9f7fdc419104c53f032ef3e, type: 3}
m_Color: {r: 0.055875294, g: 0.745283, b: 0, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!95 &6241724066737184024
Animator:
serializedVersion: 3
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6241724066737184100}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: f2d744ced3cd30c44971bf6a82f6dd2c, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!61 &6241724066737184027
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6241724066737184100}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 1, y: 1}
newSize: {x: 1, y: 1}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
--- !u!1001 &903980468320547485
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 6241724066737184101}
m_Modifications:
- target: {fileID: 6490983961685056084, guid: e42b5206757167a4eb0de34f54ab98ed,
type: 3}
propertyPath: m_Name
value: SporeBreath
objectReference: {fileID: 0}
- target: {fileID: 6490983961685056081, guid: e42b5206757167a4eb0de34f54ab98ed,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6490983961685056081, guid: e42b5206757167a4eb0de34f54ab98ed,
type: 3}
propertyPath: m_LocalPosition.y
value: -1
objectReference: {fileID: 0}
- target: {fileID: 6490983961685056081, guid: e42b5206757167a4eb0de34f54ab98ed,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6490983961685056081, guid: e42b5206757167a4eb0de34f54ab98ed,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6490983961685056081, guid: e42b5206757167a4eb0de34f54ab98ed,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6490983961685056081, guid: e42b5206757167a4eb0de34f54ab98ed,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6490983961685056081, guid: e42b5206757167a4eb0de34f54ab98ed,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6490983961685056081, guid: e42b5206757167a4eb0de34f54ab98ed,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6490983961685056081, guid: e42b5206757167a4eb0de34f54ab98ed,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6490983961685056081, guid: e42b5206757167a4eb0de34f54ab98ed,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6490983961685056081, guid: e42b5206757167a4eb0de34f54ab98ed,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e42b5206757167a4eb0de34f54ab98ed, type: 3}
--- !u!4 &6241724066686691532 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6490983961685056081, guid: e42b5206757167a4eb0de34f54ab98ed,
type: 3}
m_PrefabInstance: {fileID: 903980468320547485}
m_PrefabAsset: {fileID: 0}
fileFormatVersion: 2
guid: 6033595a9ea70aa4a9700651719dc866
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: e42b5206757167a4eb0de34f54ab98ed
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -663,7 +663,7 @@ ParticleSystem:
angle: 25
length: 5
boxThickness: {x: 0, y: 0, z: 0}
radiusThickness: 0.25
radiusThickness: 0
donutRadius: 0.2
m_Position: {x: 0, y: 0, z: 0}
m_Rotation: {x: 0, y: 0, z: 0}
......
This diff is collapsed.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FlyingPlatformBreathBehaviour : StateMachineBehaviour
{
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
//override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
//{
//
//}
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
//override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
//{
//
//}
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
//override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
//{
//
//}
// OnStateMove is called right after Animator.OnAnimatorMove()
//override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
//{
// // Implement code that processes and affects root motion
//}
// OnStateIK is called right after Animator.OnAnimatorIK()
//override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
//{
// // Implement code that sets up animation IK (inverse kinematics)
//}
}
fileFormatVersion: 2
guid: 2bdc77d911c3e7b4da61d8d4d67f7e53
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FlyingPlatformIdleBehaviour : StateMachineBehaviour
{
//Referenz auf den Spieler
private GameObject player;
//Referenzen auf den Gegner
private Transform myTransform;
private Vector3 myPosition;
private float myWidth;
private float myHeight;
//horizontale Geschwindigkeit wenn nicht alarmiert
public float speed;
//alle Ebenen, mit denen der Gegner kollidieren soll
public LayerMask whatIsGround;
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
player = GameObject.FindGameObjectWithTag("Player");
myTransform = animator.transform;
SpriteRenderer sprite = animator.GetComponent<SpriteRenderer>();
myWidth = sprite.bounds.extents.x;
myHeight = sprite.bounds.extents.y;
}
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
Vector2 lineCastPosition = myTransform.position + myTransform.right * myWidth;
Vector2 right = new Vector2(myTransform.right.x, myTransform.right.y);
//wenn isBlocked nichts trifft, dann kann sich der Gegner noch bewegen
bool isBlocked = Physics2D.Linecast(lineCastPosition + right * 0.01f, lineCastPosition + right * 0.1f, whatIsGround);
//Visualisierung der linecasts mit Linien im Szene-Modus
Debug.DrawLine(lineCastPosition + right * 0.01f, lineCastPosition + right * 0.1f);
//schaut, ob Gegner sich noch bewegen kann
if (isBlocked)
{
//wechselt die Bewegungsrichtung
Vector3 currentRotation = myTransform.eulerAngles;
currentRotation.y += 180;
myTransform.eulerAngles = currentRotation;
}
//wenn ja
else
{
myTransform.position = Vector3.MoveTowards(myTransform.position, myTransform.position + myTransform.right, speed * Time.deltaTime);
}
}
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
//override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
//{
//
//}
}
fileFormatVersion: 2
guid: 3399ba5f62dd4834fb345010f14da1ee
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
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