El ataque a melee funcionaaa!!!

parent f398900b
Showing with 138 additions and 65 deletions
......@@ -20,19 +20,16 @@ AnimationClip:
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 8724373332404428253, guid: 0c3279f55b54d94449d876234b89e965,
type: 3}
- time: 0.2
value: {fileID: 6392728175395987437, guid: 0c3279f55b54d94449d876234b89e965,
value: {fileID: 1711192532778030261, guid: 0c3279f55b54d94449d876234b89e965,
type: 3}
- time: 0.38333333
- time: 0.25
value: {fileID: -983869874967241593, guid: 0c3279f55b54d94449d876234b89e965,
type: 3}
- time: 0.56666666
value: {fileID: 1711192532778030261, guid: 0c3279f55b54d94449d876234b89e965,
- time: 0.45
value: {fileID: 6392728175395987437, guid: 0c3279f55b54d94449d876234b89e965,
type: 3}
- time: 0.98333335
value: {fileID: 1711192532778030261, guid: 0c3279f55b54d94449d876234b89e965,
- time: 0.6666667
value: {fileID: 8724373332404428253, guid: 0c3279f55b54d94449d876234b89e965,
type: 3}
attribute: m_Sprite
path:
......@@ -53,17 +50,16 @@ AnimationClip:
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 8724373332404428253, guid: 0c3279f55b54d94449d876234b89e965, type: 3}
- {fileID: 6392728175395987437, guid: 0c3279f55b54d94449d876234b89e965, type: 3}
- {fileID: -983869874967241593, guid: 0c3279f55b54d94449d876234b89e965, type: 3}
- {fileID: 1711192532778030261, guid: 0c3279f55b54d94449d876234b89e965, type: 3}
- {fileID: 1711192532778030261, guid: 0c3279f55b54d94449d876234b89e965, type: 3}
- {fileID: -983869874967241593, guid: 0c3279f55b54d94449d876234b89e965, type: 3}
- {fileID: 6392728175395987437, guid: 0c3279f55b54d94449d876234b89e965, type: 3}
- {fileID: 8724373332404428253, guid: 0c3279f55b54d94449d876234b89e965, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 1
m_StopTime: 0.68333334
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
......
......@@ -12,12 +12,13 @@ public class Player2D : MonoBehaviour
[Range(0f, 5f)] public float ratioAtaqueFlauta = 2f;
[Range(0f, 5f)] public float ratioAtaqueGuitarra = 2f;
[Range(0f, 3f)] public float ratioAtaqueMelee = 1;
public GameObject hitBoxMeleeR; //Right
public GameObject hitBoxMeleeL; //Left
float timeSiguienteAtaque = 0f;
public GameObject spawnDisparosDerecha;
public GameObject spawnDisparosIzquierda;
public GameObject disparoFlauta;
public GameObject disparoGuitarra;
public LayerMask layersEnemigos;
Rigidbody2D rb2d;
SpriteRenderer spriteRenderer;
Animator animator;
......@@ -37,6 +38,9 @@ public class Player2D : MonoBehaviour
spriteRenderer = GetComponent<SpriteRenderer>();
animator = GetComponent<Animator>();
rb2d = GetComponent<Rigidbody2D>();
hitBoxMeleeL.SetActive(false);
hitBoxMeleeR.SetActive(false);
}
// Update is called once per frame
......@@ -177,11 +181,27 @@ public class Player2D : MonoBehaviour
private void AtaqueMelee() {
animator.SetTrigger("GolpeandoMelee");
if (!spriteRenderer.flipX)
{
//Activar hitbox derecha
hitBoxMeleeR.SetActive(true);
}
else
{
//Activar hitbox izquierda
hitBoxMeleeL.SetActive(true);
}
StartCoroutine(DesactivarHitBoxMelee());
timeSiguienteAtaque = Time.time + 1f / ratioAtaqueMelee;
}
IEnumerator DesactivarHitBoxMelee() {
yield return new WaitForSeconds(0.8f);
hitBoxMeleeL.SetActive(false);
hitBoxMeleeR.SetActive(false);
}
/*NO OLVIDAR poner a todas las plataformas que sean suelo la etiqueta "Suelo"*/
private void OnCollisionStay2D(Collision2D collision)
{
......
......@@ -78,5 +78,27 @@ public class Enemigo1Move : MonoBehaviour
}
}
if (collision.tag == "HitBoxMelee")
{
vida--;
if (vida == 0)
{
//Aqui se cuenta cuantos enemigos quedan para entregar el coleccionable que te dan por derrotar a todos los enemigos
if (Coleccionables.eDerrotados[Coleccionables.niActual] != Coleccionables.eTotales[Coleccionables.niActual])
{
if (Coleccionables.eDerrotados[Coleccionables.niActual] == Coleccionables.eTotales[Coleccionables.niActual] - 1)
{
//AQUI SE INSTANCIA EL PREFAB DEL COLECCIONABLE
Instantiate(prefabColeccionable, collision.transform.position, Quaternion.identity);
}
Coleccionables.eDerrotados[Coleccionables.niActual]++;
}
Destroy(this.gameObject);
}
}
}
}
......@@ -21,7 +21,7 @@ MonoBehaviour:
m_ShowMode: 4
m_Title:
m_RootView: {fileID: 6}
m_MinSize: {x: 950, y: 544}
m_MinSize: {x: 950, y: 300}
m_MaxSize: {x: 10000, y: 10000}
--- !u!114 &2
MonoBehaviour:
......@@ -44,10 +44,10 @@ MonoBehaviour:
y: 30
width: 1920
height: 947
m_MinSize: {x: 679, y: 494}
m_MaxSize: {x: 14002, y: 14044}
m_MinSize: {x: 683, y: 494}
m_MaxSize: {x: 14004, y: 14044}
vertical: 0
controlID: 71
controlID: 91
--- !u!114 &3
MonoBehaviour:
m_ObjectHideFlags: 52
......@@ -67,11 +67,11 @@ MonoBehaviour:
y: 0
width: 389
height: 947
m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 14}
m_MinSize: {x: 277, y: 72}
m_MaxSize: {x: 4002, y: 4022}
m_ActualView: {fileID: 15}
m_Panes:
- {fileID: 14}
- {fileID: 15}
m_Selected: 0
m_LastSelected: 0
--- !u!114 &4
......@@ -93,11 +93,11 @@ MonoBehaviour:
y: 0
width: 379
height: 573
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 15}
m_MinSize: {x: 202, y: 222}
m_MaxSize: {x: 4002, y: 4022}
m_ActualView: {fileID: 16}
m_Panes:
- {fileID: 15}
- {fileID: 16}
m_Selected: 0
m_LastSelected: 0
--- !u!114 &5
......@@ -121,10 +121,11 @@ MonoBehaviour:
height: 374
m_MinSize: {x: 232, y: 272}
m_MaxSize: {x: 10002, y: 10022}
m_ActualView: {fileID: 13}
m_ActualView: {fileID: 14}
m_Panes:
- {fileID: 13}
- {fileID: 18}
- {fileID: 14}
- {fileID: 19}
- {fileID: 12}
m_Selected: 0
m_LastSelected: 1
--- !u!114 &6
......@@ -215,10 +216,10 @@ MonoBehaviour:
y: 0
width: 1531
height: 947
m_MinSize: {x: 404, y: 494}
m_MinSize: {x: 406, y: 494}
m_MaxSize: {x: 10002, y: 14044}
vertical: 1
controlID: 72
controlID: 68
--- !u!114 &10
MonoBehaviour:
m_ObjectHideFlags: 52
......@@ -240,10 +241,10 @@ MonoBehaviour:
y: 0
width: 1531
height: 573
m_MinSize: {x: 404, y: 222}
m_MaxSize: {x: 8004, y: 4022}
m_MinSize: {x: 406, y: 222}
m_MaxSize: {x: 8006, y: 4022}
vertical: 0
controlID: 73
controlID: 69
--- !u!114 &11
MonoBehaviour:
m_ObjectHideFlags: 52
......@@ -265,11 +266,11 @@ MonoBehaviour:
height: 573
m_MinSize: {x: 204, y: 222}
m_MaxSize: {x: 4004, y: 4022}
m_ActualView: {fileID: 16}
m_ActualView: {fileID: 17}
m_Panes:
- {fileID: 16}
- {fileID: 17}
- {fileID: 12}
- {fileID: 18}
- {fileID: 13}
m_Selected: 0
m_LastSelected: 1
--- !u!114 &12
......@@ -280,6 +281,35 @@ MonoBehaviour:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 12071, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_MinSize: {x: 100, y: 100}
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Animation
m_Image: {fileID: 1561878555887300916, guid: 0000000000000000d000000000000000,
type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 0
y: 646
width: 1531
height: 355
m_ViewDataDictionary: {fileID: 0}
m_LockTracker:
m_IsLocked: 0
m_LastSelectedObjectID: -2996
--- !u!114 &13
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12111, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
......@@ -298,7 +328,7 @@ MonoBehaviour:
width: 973
height: 501
m_ViewDataDictionary: {fileID: 0}
--- !u!114 &13
--- !u!114 &14
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
......@@ -336,20 +366,20 @@ MonoBehaviour:
m_ShowAllHits: 0
m_SearchArea: 1
m_Folders:
- Assets/Scripts
- Assets/Player/Sprites
m_ViewMode: 1
m_StartGridSize: 64
m_LastFolders:
- Assets/Scripts
- Assets/Player/Sprites
m_LastFoldersGridSize: -1
m_LastProjectPath: C:\Users\Colme\Documents\UnityProjects\ProyectoVideojuegos\Videojuegos_Proyecto
m_LockTracker:
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: de330000
m_LastClickedID: 13278
m_ExpandedIDs: 00000000082c0000243400004635000000ca9a3b
m_SelectedIDs: 4c340000
m_LastClickedID: 13388
m_ExpandedIDs: 000000006c2a0000aa330000d433000000ca9a3b
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
......@@ -377,7 +407,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 00000000082c000046350000
m_ExpandedIDs: 000000006c2a0000aa330000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
......@@ -405,7 +435,7 @@ MonoBehaviour:
m_SelectedInstanceIDs:
m_LastClickedInstanceID: 0
m_HadKeyboardFocusLastEvent: 1
m_ExpandedInstanceIDs: c6230000
m_ExpandedInstanceIDs: c6230000a8320000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
......@@ -432,7 +462,7 @@ MonoBehaviour:
m_ScrollPosition: {x: 0, y: 0}
m_GridSize: 64
m_DirectoriesAreaWidth: 115
--- !u!114 &14
--- !u!114 &15
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
......@@ -468,7 +498,7 @@ MonoBehaviour:
m_ControlHash: -371814159
m_PrefName: Preview_InspectorPreview
m_PreviewWindow: {fileID: 0}
--- !u!114 &15
--- !u!114 &16
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
......@@ -497,23 +527,23 @@ MonoBehaviour:
m_SceneHierarchy:
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 38faffff743e00006c3f0000943f0000a83f0000
m_SelectedIDs: 4cf4ffff
m_LastClickedID: -2996
m_ExpandedIDs: 8cfbffff
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name: CanvasMuerte
m_OriginalName: CanvasMuerte
m_Name:
m_OriginalName:
m_EditFieldRect:
serializedVersion: 2
x: 0
y: 0
width: 0
height: 0
m_UserData: 16236
m_UserData: 0
m_IsWaitingForDelay: 0
m_IsRenaming: 0
m_OriginalEventType: 0
m_OriginalEventType: 11
m_IsRenamingFilename: 0
m_ClientGUIView: {fileID: 4}
m_SearchString:
......@@ -523,7 +553,7 @@ MonoBehaviour:
m_IsLocked: 0
m_CurrentSortingName: TransformSorting
m_WindowGUID: defd79de2c582ea45ab6fa9ed58148b9
--- !u!114 &16
--- !u!114 &17
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
......@@ -559,9 +589,9 @@ MonoBehaviour:
m_PlayAudio: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: 574.8234, y: 170.78032, z: -100.875}
m_Target: {x: -6.7260084, y: -1.7376392, z: -1.5839844}
speed: 2
m_Value: {x: 574.8234, y: 170.78032, z: -100.875}
m_Value: {x: -6.7260084, y: -1.7376392, z: -1.5839844}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
......@@ -594,9 +624,9 @@ MonoBehaviour:
speed: 2
m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size:
m_Target: 833.83777
m_Target: 4.500365
speed: 2
m_Value: 833.83777
m_Value: 4.500365
m_Ortho:
m_Target: 1
speed: 2
......@@ -621,7 +651,7 @@ MonoBehaviour:
m_SceneVisActive: 1
m_LastLockedObject: {fileID: 0}
m_ViewIsLockedToObject: 0
--- !u!114 &17
--- !u!114 &18
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
......@@ -702,7 +732,7 @@ MonoBehaviour:
m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 01000000000000000000
m_XRRenderMode: 0
--- !u!114 &18
--- !u!114 &19
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
......
{"m_ExpandedPrefabGameObjectFileIDs":[],"m_ExpandedSceneGameObjectInstanceIDs":[],"m_ScrollY":0.0,"m_LastClickedFileID":3326548381514800793,"m_LastClickedInstanceID":0}
\ No newline at end of file
{"cameraMode":{"drawMode":0,"name":"Shaded","section":"Shading Mode"},"sceneLighting":false,"audioPlay":false,"sceneViewState":{"showFog":true,"showMaterialUpdate":false,"showSkybox":false,"showFlares":true,"showImageEffects":true,"showParticleSystems":true},"in2DMode":true,"pivot":{"x":-10.024999618530274,"y":-2.1080000400543215,"z":0.0},"rotation":{"x":0.0,"y":0.0,"z":0.0,"w":1.0},"size":3.0049948692321779,"orthographic":true}
\ No newline at end of file
{"cameraMode":{"drawMode":0,"name":"Shaded","section":"Shading Mode"},"sceneLighting":true,"audioPlay":false,"sceneViewState":{"showFog":true,"showMaterialUpdate":false,"showSkybox":true,"showFlares":true,"showImageEffects":true,"showParticleSystems":true},"in2DMode":true,"pivot":{"x":574.8234252929688,"y":170.7803192138672,"z":-100.875},"rotation":{"x":0.0,"y":0.0,"z":0.0,"w":1.0},"size":833.8377685546875,"orthographic":true}
\ No newline at end of file
{"cameraMode":{"drawMode":0,"name":"Shaded","section":"Shading Mode"},"sceneLighting":true,"audioPlay":false,"sceneViewState":{"showFog":true,"showMaterialUpdate":false,"showSkybox":true,"showFlares":true,"showImageEffects":true,"showParticleSystems":true},"in2DMode":true,"pivot":{"x":-6.726008415222168,"y":-1.7376391887664796,"z":-1.583984375},"rotation":{"x":0.0,"y":0.0,"z":0.0,"w":1.0},"size":4.500364780426025,"orthographic":true}
\ No newline at end of file
......@@ -15,6 +15,7 @@ TagManager:
- Caida
- PowerUpEffect
- PU_Ataque
- HitBoxMelee
layers:
- Default
- TransparentFX
......
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 sign in to comment