Commit 64559c62 authored by Philipp Rademacher's avatar Philipp Rademacher
Browse files

Add RangeAttack

parent a9dee103
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_SourcePrefab: {fileID: 0}
m_RootGameObject: {fileID: 1335813217632262}
m_IsPrefabAsset: 1
--- !u!1 &1335813217632262
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 4932396647364996}
- component: {fileID: 212123963447951286}
- component: {fileID: 58364751344523594}
- component: {fileID: 114536901692521968}
m_Layer: 0
m_Name: BatProjectile
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4932396647364996
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1335813217632262}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.47753838, y: 0.35658446, z: -0.0037841797}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!58 &58364751344523594
CircleCollider2D:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1335813217632262}
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}
serializedVersion: 2
m_Radius: 0.1
--- !u!114 &114536901692521968
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1335813217632262}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b829e9b6907fda440bc3380f6e662b9f, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!212 &212123963447951286
SpriteRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1335813217632262}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
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: 0
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: 10913, guid: 0000000000000000f000000000000000, type: 0}
m_Color: {r: 1, g: 1, b: 1, 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
fileFormatVersion: 2
guid: b27d5060344b9e14c9bb42067021c232
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6b8bdb01e18b8004daa00fe244454b5d, type: 3}
m_Name: RangeAttack
m_EditorClassIdentifier:
ButtonBinding:
Cooldown: 0
channeling: 0
fileFormatVersion: 2
guid: de0f2fea41904b64c98b722cf04e71c9
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
......@@ -5,22 +5,66 @@ using UnityEngine;
public class BatBoomerang : MonoBehaviour
{
private Vector2 spawnPosition,targetPosition;
private PlayerStateManager pStateManager;
private GameObject self;
private float delta;
private bool isDone;
//private GameObject
// Use this for initialization
void Start ()
// Use this for initialization
private void Start()
{
delta = 0.0f;
isDone = false;
}
}
// Update is called once per frame
void Update ()
private void Update()
{
delta += Time.deltaTime;
}
self.transform.rotation *= Quaternion.AngleAxis(Time.deltaTime*1000, Vector3.forward);
if (isDone == false)
{
if (delta < 1.0f)
{
self.transform.position = Vector2.Lerp(spawnPosition, targetPosition, delta);
}
else
{
isDone = true;
delta = 0.0f;
spawnPosition = self.transform.position;
}
}
else
{
if (delta < 1.0f)
{
self.transform.position = Vector2.Lerp(spawnPosition, pStateManager.rigidb.position, delta);
}
else
{
pStateManager.isBatActiv = false;
Destroy(self);
}
}
}
public void InitBatBoomerang(GameObject self,PlayerStateManager pStateManager)
{
this.spawnPosition = pStateManager.rigidb.position;
if(pStateManager.lookingLeft == true)
this.targetPosition = spawnPosition + Vector2.left*3;
else
this.targetPosition = spawnPosition + Vector2.right *3;
this.self = self;
this.pStateManager = pStateManager;
}
}
......@@ -24,8 +24,8 @@ public class InputManager : MonoBehaviour {
void GetInput()
{
vertical = Input.GetAxis("Vertical");
horizontal = Input.GetAxis("Horizontal");
vertical = Input.GetAxisRaw("Vertical");
horizontal = Input.GetAxisRaw("Horizontal");
jump_Input = Input.GetButton("Jump");
interact_input = Input.GetButton("Interact");
meleeAttack_input = Input.GetButton("MeleeAttack");
......
......@@ -25,11 +25,13 @@ public class PlayerStateManager : MonoBehaviour {
public bool isWalking;
public bool lookingLeft;
public bool isSlowed;
public bool isBatActiv;
[HideInInspector] public Rigidbody2D rigidb;
public Animator anim;
public SpriteRenderer sprite;
public BoxCollider2D collider;
public GameObject batProjectile;
private ContactFilter2D interactableFilter;
......@@ -53,6 +55,7 @@ public class PlayerStateManager : MonoBehaviour {
isWalking = false;
interactableFilter.SetLayerMask(LayerMask.GetMask("Interactable"));
interactableFilter.useTriggers = true;
isBatActiv = false;
}
public void Update() {
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "RangeAttack",menuName = "Skills/RangeAttack")]
public class RangeAttack : SkillBase
{
protected override void OnAddToCharacter()
{
}
protected override bool OnButtonDown()
{
PlayerStateManager pStateManager = character.GetComponent<PlayerStateManager>();
if (pStateManager.isBatActiv == false)
{
pStateManager.isBatActiv = true;
GameObject projectile = Instantiate(pStateManager.batProjectile, pStateManager.rigidb.position, Quaternion.identity);
projectile.GetComponent<BatBoomerang>().InitBatBoomerang(projectile, pStateManager);
}
return false;
}
protected override void OnChannelEnd()
{
}
protected override bool OnChannelUpdate()
{
return false;
}
}
fileFormatVersion: 2
guid: 6b8bdb01e18b8004daa00fe244454b5d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -6,7 +6,7 @@ TextureImporter:
serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
......@@ -34,13 +34,13 @@ TextureImporter:
filterMode: 0
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
......@@ -51,7 +51,7 @@ TextureImporter:
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
......@@ -91,6 +91,28 @@ TextureImporter:
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
......
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