Commit 6a74cc45 authored by 18손재민's avatar 18손재민

Merge remote-tracking branch 'tetra-tower/combo'

parents 4a2a1515 8574ee86
...@@ -257,6 +257,31 @@ AnimatorState: ...@@ -257,6 +257,31 @@ AnimatorState:
m_MirrorParameter: m_MirrorParameter:
m_CycleOffsetParameter: m_CycleOffsetParameter:
m_TimeParameter: m_TimeParameter:
--- !u!1102 &1102225149719626110
AnimatorState:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: PlayerAttackAnim
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: 9e6ebf939e606a340a0df3ac416b0cb8, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &1102466624416092410 --- !u!1102 &1102466624416092410
AnimatorState: AnimatorState:
serializedVersion: 5 serializedVersion: 5
...@@ -411,6 +436,9 @@ AnimatorStateMachine: ...@@ -411,6 +436,9 @@ AnimatorStateMachine:
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: 1102466624416092410} m_State: {fileID: 1102466624416092410}
m_Position: {x: 203, y: 185, z: 0} m_Position: {x: 203, y: 185, z: 0}
- serializedVersion: 1
m_State: {fileID: 1102225149719626110}
m_Position: {x: 238, y: 250, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: m_AnyStateTransitions:
- {fileID: 1101150420884930214} - {fileID: 1101150420884930214}
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: PlayerAttackAnim
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves: []
m_SampleRate: 60
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings: []
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 1
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_GenerateMotionCurves: 0
m_Events: []
fileFormatVersion: 2
guid: 9e6ebf939e606a340a0df3ac416b0cb8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:
...@@ -265,6 +265,26 @@ GameObject: ...@@ -265,6 +265,26 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 1623439448163086, guid: 3d077a5f727dd1e4780e9265ed26e036, m_CorrespondingSourceObject: {fileID: 1623439448163086, guid: 3d077a5f727dd1e4780e9265ed26e036,
type: 2} type: 2}
m_PrefabInternal: {fileID: 1618052740} m_PrefabInternal: {fileID: 1618052740}
--- !u!114 &489222434
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 489222433}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4ab58a64164eb984d8683df370ddce96, type: 3}
m_Name:
m_EditorClassIdentifier:
state: 0
attackA: 0
attackB: 0
attackC: 0
cancel: 0
time: {fileID: 1333585343}
combo: {fileID: 1159748691}
keyCoolDown: 1
anim: {fileID: 0}
--- !u!1001 &677608594 --- !u!1001 &677608594
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -499,6 +519,95 @@ Transform: ...@@ -499,6 +519,95 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 6 m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1159748689
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1159748690}
- component: {fileID: 1159748692}
- component: {fileID: 1159748691}
- component: {fileID: 1159748693}
m_Layer: 5
m_Name: comboString
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1159748690
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1159748689}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1708140759}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 100, y: 100}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1159748691
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1159748689}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 'test
'
--- !u!222 &1159748692
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1159748689}
m_CullTransparentMesh: 0
--- !u!114 &1159748693
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1159748689}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 67f69504559e3ec4fbecc50b8f44c44a, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &1184292066 --- !u!1001 &1184292066
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -633,6 +742,93 @@ Prefab: ...@@ -633,6 +742,93 @@ Prefab:
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 668207ef06c134e40b24375977c2c930, type: 2} m_SourcePrefab: {fileID: 100100000, guid: 668207ef06c134e40b24375977c2c930, type: 2}
m_IsPrefabAsset: 0 m_IsPrefabAsset: 0
--- !u!1 &1333585340
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1333585341}
- component: {fileID: 1333585344}
- component: {fileID: 1333585343}
- component: {fileID: 1333585342}
m_Layer: 5
m_Name: comboTime
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1333585341
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1333585340}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1708140759}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 100, y: 120}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1333585342
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1333585340}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cff5b06354e433c449df95b85dcc3fe9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1333585343
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1333585340}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: New Text
--- !u!222 &1333585344
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1333585340}
m_CullTransparentMesh: 0
--- !u!4 &1604462410 stripped --- !u!4 &1604462410 stripped
Transform: Transform:
m_CorrespondingSourceObject: {fileID: 4884929250924374, guid: e6794ab8e2e4c6340a23b382e9497cbb, m_CorrespondingSourceObject: {fileID: 4884929250924374, guid: e6794ab8e2e4c6340a23b382e9497cbb,
...@@ -727,6 +923,11 @@ Prefab: ...@@ -727,6 +923,11 @@ Prefab:
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e6794ab8e2e4c6340a23b382e9497cbb, type: 2} m_SourcePrefab: {fileID: 100100000, guid: e6794ab8e2e4c6340a23b382e9497cbb, type: 2}
m_IsPrefabAsset: 0 m_IsPrefabAsset: 0
--- !u!224 &1708140759 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 224395958577644168, guid: e6794ab8e2e4c6340a23b382e9497cbb,
type: 2}
m_PrefabInternal: {fileID: 1708140758}
--- !u!1001 &1711972807 --- !u!1001 &1711972807
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......

public class AttackCombo
{
float time;
//시전시간 1.5초
string name;
//화염발사!
string combo;
string comboAnim;
//"ABCACBAC"
public AttackCombo(string name, string combo, float time , string comboAnim)
{
this.time = time;
this.name = name;
this.combo = combo;
this.comboAnim = comboAnim;
}
public override string ToString()
{
return name;
}
public override bool Equals(object obj)
{
return combo.Equals(obj);
}
public override int GetHashCode()
{
return base.GetHashCode();
}
public float getTime()
{
return time;
}
public string getComboAnim()
{
return comboAnim;
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: edea51a314af27047a14dcdc911cf7ab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PlayerAttack : MonoBehaviour {
public ComboState state;
public float attackA,attackB,attackC;
public float cancel;
public Text time, combo;
public static string comboArray;
public static float StartTime;
public bool keyCoolDown=true;
public Animator anim;
public AttackCombo[] AttackArr= { new AttackCombo("화염발사", "ABC", 1.5f,"PlayerRunAnim"),
new AttackCombo("공격A", "A", 0.5f,"PlayerGoingDownAnim"),
new AttackCombo("공격B", "B", 0.5f,"PlayerWalkAnim"),
new AttackCombo("공격C", "C", 0.5f,"PlayerGoingUpAnim"),
new AttackCombo("콩", "AC", 1f,"PlayerIdleAnim"),
new AttackCombo("콩콩콩", "ACB", 2f,"PlayerIdleAnim"),
};
public Queue comboQueue = new Queue();
// Use this for initialization
void Start () {
StartTime = Time.time;
state = ComboState.Idle;
anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
attackA = Input.GetAxisRaw("Fire1");
attackB = Input.GetAxisRaw("Fire2");
attackC = Input.GetAxisRaw("Fire3");
cancel = Input.GetAxisRaw("stop");
combo.text = comboArray;
float tempTime = Mathf.Clamp(StartTime - Time.time+1f , 0f, 9999f) ;
foreach (AttackCombo c in comboQueue)
{
tempTime += c.getTime();
}
time.text=Mathf.Round(tempTime*10f)/10f+"";
if (attackA + attackB + attackC == 0)
{
keyCoolDown = true;
}
if (state == ComboState.Idle)
{
if (attackA + attackB + attackC > 0 && keyCoolDown)
{
state = ComboState.Attack;
StartTime = Time.time;
ComboCheck();
}
}
else if (state == ComboState.Attack)
{
ComboCheck();
//공격중일때
if (Time.time > StartTime)
{
state = ComboState.Combo;
}
}
else if (state == ComboState.Combo)
{
ComboCheck();
if (comboQueue.Count > 0) //콤보가 남아있다면
{
AttackCombo cur = (AttackCombo)comboQueue.Dequeue();
print(cur);
anim.Play(cur.getComboAnim());
//실제로는 애니메이션 가져옴
state = ComboState.Attack;
StartTime = Time.time + cur.getTime();
}
else if (Time.time > StartTime + 1f || cancel==1)
{
//현재 시간이 마지막 콤보 끝나는 시점보다 1초 지났다면
state = ComboState.Idle;
comboArray = "";
}
}
if (attackA + attackB + attackC > 0)
{
keyCoolDown = false;
}
}
void ComboCheck()
{
//들어갈 콤보가 있는지 확인함
if (attackA + attackB + attackC > 0 && keyCoolDown)
{
if (attackA == 1)
{
comboArray += "A";
}
else if (attackB == 1)
{
comboArray += "B";
}
else if (attackC == 1)
{
comboArray += "C";
}
bool success = false;
foreach (AttackCombo com in AttackArr)
{
if (com.Equals(comboArray))
{
comboQueue.Enqueue(com);
success = true;
}
}
if (success==false) //콤보 실행에 실패했다면
{
string temp = comboArray[comboArray.Length - 1]+"";
foreach (AttackCombo com2 in AttackArr) //기본 글자 콤보 실행
{
if (com2.Equals(temp))
{
comboQueue.Enqueue(com2);
}
}
}
}
}
}
fileFormatVersion: 2
guid: 4ab58a64164eb984d8683df370ddce96
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -30,12 +30,13 @@ public enum ItemType ...@@ -30,12 +30,13 @@ public enum ItemType
} }
public enum PlayerState { Idle, Walk, Run, GoingUp, GoingDown, Rope } public enum PlayerState { Idle, Walk, Run, GoingUp, GoingDown, Rope }
public enum ComboState {Idle, Combo, Attack}
/// <summary> /// <summary>
/// Enum for game's state. /// Enum for game's state.
/// </summary> /// </summary>
public enum GameState { MainMenu, Ingame, Tetris, Pause, Inventory, GameOver } public enum GameState { MainMenu, Ingame, Tetris, Pause, Inventory, GameOver }
/// <summary> /// <summary>
/// Enum for room types. /// Enum for room types.
/// </summary> /// </summary>
......
...@@ -42,9 +42,9 @@ InputManager: ...@@ -42,9 +42,9 @@ InputManager:
descriptiveName: descriptiveName:
descriptiveNegativeName: descriptiveNegativeName:
negativeButton: negativeButton:
positiveButton: left ctrl positiveButton: z
altNegativeButton: altNegativeButton:
altPositiveButton: mouse 0 altPositiveButton:
gravity: 1000 gravity: 1000
dead: 0.001 dead: 0.001
sensitivity: 1000 sensitivity: 1000
...@@ -58,9 +58,9 @@ InputManager: ...@@ -58,9 +58,9 @@ InputManager:
descriptiveName: descriptiveName:
descriptiveNegativeName: descriptiveNegativeName:
negativeButton: negativeButton:
positiveButton: left alt positiveButton: x
altNegativeButton: altNegativeButton:
altPositiveButton: mouse 1 altPositiveButton:
gravity: 1000 gravity: 1000
dead: 0.001 dead: 0.001
sensitivity: 1000 sensitivity: 1000
...@@ -74,9 +74,25 @@ InputManager: ...@@ -74,9 +74,25 @@ InputManager:
descriptiveName: descriptiveName:
descriptiveNegativeName: descriptiveNegativeName:
negativeButton: negativeButton:
positiveButton: left shift positiveButton: c
altNegativeButton: altNegativeButton:
altPositiveButton: mouse 2 altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: stop
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: v
altNegativeButton:
altPositiveButton:
gravity: 1000 gravity: 1000
dead: 0.001 dead: 0.001
sensitivity: 1000 sensitivity: 1000
......
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