Commit 0fbf3a4e authored by 18류지석's avatar 18류지석

콤보 거의 완성, 공격 거의 완성

parent dfcc65bd
......@@ -50,6 +50,12 @@ AnimatorController:
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: attack
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
......@@ -63,6 +69,66 @@ AnimatorController:
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!114 &114435780364136698
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 286184da5cd0ee1499e5e585698f25de, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114686822015001908
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 60bdd8700d3860e4c9a3d3d60b82a0ea, type: 3}
m_Name:
m_EditorClassIdentifier:
playercontroller: {fileID: 0}
playerattack: {fileID: 0}
player: {fileID: 1623439448163086, guid: 3d077a5f727dd1e4780e9265ed26e036, type: 2}
--- !u!206 &206450249066372984
BlendTree:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Blend Tree
m_Childs: []
m_BlendParameter: ropeUpDown
m_BlendParameterY: ropeUpDown
m_MinThreshold: 0
m_MaxThreshold: 1
m_UseAutomaticThresholds: 1
m_NormalizedBlendValues: 0
m_BlendType: 0
--- !u!1101 &1101077261484238540
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1102579710918655568}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1101150420884930214
AnimatorStateTransition:
m_ObjectHideFlags: 1
......@@ -87,6 +153,30 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1101330505740095668
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: attack
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1102225149719626110}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1101414817990210080
AnimatorStateTransition:
m_ObjectHideFlags: 1
......@@ -266,8 +356,10 @@ AnimatorState:
m_Name: PlayerAttackAnim
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Transitions:
- {fileID: 1101077261484238540}
m_StateMachineBehaviours:
- {fileID: 114686822015001908}
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
......@@ -282,31 +374,6 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &1102466624416092410
AnimatorState:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: attack
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: 04c5cf6d7a7e42e429178ba00bd59688, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &1102579710918655568
AnimatorState:
serializedVersion: 5
......@@ -397,13 +464,13 @@ AnimatorState:
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_SpeedParameterActive: 1
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 0}
m_Motion: {fileID: 7400000, guid: 4168ff00c9ea64b4897d4a32c26c3d1d, type: 2}
m_Tag:
m_SpeedParameter:
m_SpeedParameter: ropeUpDown
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
......@@ -433,12 +500,9 @@ AnimatorStateMachine:
- serializedVersion: 1
m_State: {fileID: 1102728463836494206}
m_Position: {x: 168, y: 120, z: 0}
- serializedVersion: 1
m_State: {fileID: 1102466624416092410}
m_Position: {x: 203, y: 185, z: 0}
- serializedVersion: 1
m_State: {fileID: 1102225149719626110}
m_Position: {x: 238, y: 250, z: 0}
m_Position: {x: 168, y: -132, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions:
- {fileID: 1101150420884930214}
......@@ -447,6 +511,7 @@ AnimatorStateMachine:
- {fileID: 1101824696373131616}
- {fileID: 1101470433672142044}
- {fileID: 1101414817990210080}
- {fileID: 1101330505740095668}
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
......
......@@ -35,7 +35,7 @@ AnimationClip:
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
......
%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: PlayerRopeAnim
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:
- curve:
- time: 0
value: {fileID: 21300000, guid: 4cad9b4bd77cfcd4c87648fa1a27740b, type: 3}
- time: 0.05
value: {fileID: 21300000, guid: 0f7fbcaf616518b4197f9b2fd1e4b812, type: 3}
- time: 0.1
value: {fileID: 21300000, guid: 36e21c0d3884fbf4c9cc75f5deac1c49, type: 3}
- time: 0.15
value: {fileID: 21300000, guid: 126739f3a7a16744dbbd38c691a83896, type: 3}
- time: 0.2
value: {fileID: 21300000, guid: 0f28207e378bcbc43ba5f3f25e27ad3e, type: 3}
- time: 0.25
value: {fileID: 21300000, guid: 9616f49c3f054c44196158cc37d32248, type: 3}
- time: 0.3
value: {fileID: 21300000, guid: 2ee307457fcfbcf4e8057c7db8bf6961, type: 3}
- time: 0.35
value: {fileID: 21300000, guid: d36737a3366623847a03bcc3552c112a, type: 3}
- time: 0.38333333
value: {fileID: 21300000, guid: d36737a3366623847a03bcc3552c112a, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
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:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 21300000, guid: 4cad9b4bd77cfcd4c87648fa1a27740b, type: 3}
- {fileID: 21300000, guid: 0f7fbcaf616518b4197f9b2fd1e4b812, type: 3}
- {fileID: 21300000, guid: 36e21c0d3884fbf4c9cc75f5deac1c49, type: 3}
- {fileID: 21300000, guid: 126739f3a7a16744dbbd38c691a83896, type: 3}
- {fileID: 21300000, guid: 0f28207e378bcbc43ba5f3f25e27ad3e, type: 3}
- {fileID: 21300000, guid: 9616f49c3f054c44196158cc37d32248, type: 3}
- {fileID: 21300000, guid: 2ee307457fcfbcf4e8057c7db8bf6961, type: 3}
- {fileID: 21300000, guid: d36737a3366623847a03bcc3552c112a, type: 3}
- {fileID: 21300000, guid: d36737a3366623847a03bcc3552c112a, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.4
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: 4168ff00c9ea64b4897d4a32c26c3d1d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:
......@@ -25,6 +25,7 @@ GameObject:
- component: {fileID: 61019994424895448}
- component: {fileID: 114906702720267008}
- component: {fileID: 95992411616135034}
- component: {fileID: 114880704145925944}
m_Layer: 0
m_Name: Player
m_TagString: Player
......@@ -32,6 +33,22 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1862495014651308
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 4710911479571038}
- component: {fileID: 61129044981816742}
m_Layer: 0
m_Name: AttackColider
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4549734214569802
Transform:
m_ObjectHideFlags: 1
......@@ -39,12 +56,26 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1623439448163086}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 24.9, y: 18, z: 0}
m_LocalPosition: {x: 2, y: 1.8, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Children:
- {fileID: 4710911479571038}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4710911479571038
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1862495014651308}
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: 4549734214569802}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &50325917162965942
Rigidbody2D:
serializedVersion: 4
......@@ -90,6 +121,31 @@ BoxCollider2D:
serializedVersion: 2
m_Size: {x: 0.7, y: 1.5}
m_EdgeRadius: 0
--- !u!61 &61129044981816742
BoxCollider2D:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1862495014651308}
m_Enabled: 0
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: -0.42, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.53, y: 1}
m_EdgeRadius: 0
--- !u!95 &95992411616135034
Animator:
serializedVersion: 3
......@@ -120,6 +176,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
rbGravityScale: 3
rbAttackGravityScale: 3
maxSpeed: 3
maxDashSpeed: 6
accerlation: 1200
......@@ -148,6 +205,39 @@ MonoBehaviour:
rayDistance: 1
ropeUp: 0.6
ropeDown: 0.8
playerState: 0
previousState: 0
--- !u!114 &114880704145925944
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1623439448163086}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4ab58a64164eb984d8683df370ddce96, type: 3}
m_Name:
m_EditorClassIdentifier:
state: 0
attackRaw:
- 0
- 0
- 0
attackKeyState: 000000000000000000000000
cancel: 0
playingSkill: 0
comboTime: 1
time: {fileID: 0}
combo: {fileID: 0}
comboArray:
StartTime: 0
anim: {fileID: 0}
aoc: {fileID: 0}
normalAttack:
- {fileID: 7400000, guid: be4bdbaff27cc7c46a79b3ef4e1fe3f6, type: 2}
- {fileID: 7400000, guid: be4bdbaff27cc7c46a79b3ef4e1fe3f6, type: 2}
- {fileID: 7400000, guid: be4bdbaff27cc7c46a79b3ef4e1fe3f6, type: 2}
inventoryManager: {fileID: 0}
--- !u!114 &114906702720267008
MonoBehaviour:
m_ObjectHideFlags: 1
......
fileFormatVersion: 2
guid: c36b41dcefe74fb49abfa633f75db5ca
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: be4bdbaff27cc7c46a79b3ef4e1fe3f6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AttackProperty : MonoBehaviour{
public float damage=0;
public float knockBackMultiplier = 1f;
public int debuffNum = 0;
public EnemyDebuffCase[] debuffType = new EnemyDebuffCase[10];
public int[] debuffTime = new int[10];
}
fileFormatVersion: 2
guid: 64f948f7c7aacab409fe963a6f9e0d2a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -19,10 +19,9 @@ public class Enemy : MonoBehaviour {
// debuff
float[] immunity_time = new float[5] { 0.0f, 3.0f, 6.0f, 6.0f, 6.0f };//면역 시간
bool[] immunity = new bool[] { false, }; //현재 에너미가 디버프 상태에 대해서 면역인지를 체크하는 변수
enum debuffCase { fire, ice, stun, blind, charm };
struct EnemyDebuffed
{
public debuffCase Case;
public EnemyDebuffCase Case;
public float debuffTime;
}
......@@ -96,36 +95,36 @@ public class Enemy : MonoBehaviour {
IEnumerator DebuffCase(EnemyDebuffed sCase)
{
if (sCase.Case == debuffCase.fire)
if (sCase.Case == EnemyDebuffCase.fire)
{
StartCoroutine(OnFire(sCase));
}
else if (sCase.Case == debuffCase.ice && !immunity[(int)debuffCase.ice])
else if (sCase.Case == EnemyDebuffCase.ice && !immunity[(int)EnemyDebuffCase.ice])
{
//Enemy 정지하는 코드 필요
immunity[(int)debuffCase.ice] = true;
immunity[(int)EnemyDebuffCase.ice] = true;
yield return StartCoroutine(DebuffDoing(sCase));
}
else if (sCase.Case == debuffCase.stun && !immunity[(int)debuffCase.stun])
else if (sCase.Case == EnemyDebuffCase.stun && !immunity[(int)EnemyDebuffCase.stun])
{
//Enemy 정지하는 코드 필요
immunity[(int)debuffCase.stun] = true;
immunity[(int)EnemyDebuffCase.stun] = true;
yield return StartCoroutine(DebuffDoing(sCase));
}
else if (sCase.Case == debuffCase.blind && !immunity[(int)debuffCase.blind])
else if (sCase.Case == EnemyDebuffCase.blind && !immunity[(int)EnemyDebuffCase.blind])
{
//Enemy의 공격이 적중하지 않는 코드 필요
immunity[(int)debuffCase.stun] = true;
immunity[(int)EnemyDebuffCase.stun] = true;
yield return StartCoroutine(DebuffDoing(sCase));
}
else if (sCase.Case == debuffCase.charm && !immunity[(int)debuffCase.charm])
else if (sCase.Case == EnemyDebuffCase.charm && !immunity[(int)EnemyDebuffCase.charm])
{
//Enemy 공격이 플레이어 회복하는 코드 필요
immunity[(int)debuffCase.stun] = true;
immunity[(int)EnemyDebuffCase.stun] = true;
yield return StartCoroutine(DebuffDoing(sCase));
}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
fileFormatVersion: 2
guid: 7f01b427f819dc74294c920de58ba15d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEditor.Animations;
using UnityEngine;
using UnityEngine.UI;
public class PlayerAttack : MonoBehaviour {
public ComboState state;
public float attackA,attackB,attackC;
public float cancel;
public float[] attackRaw = new float[3];
public int[] attackKeyState = new int[3]; //0: released 1: push 2: pushing
public float cancelRaw;
public int cancelKeyState;
public bool playingSkill;
public float comboTime;
public Text time, combo;
public static string comboArray;
public static float StartTime;
public bool keyCoolDown=true;
public string comboArray;
public float StartTime;
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();
public AnimatorOverrideController aoc;
public AnimationClip[] normalAttack = new AnimationClip[3];
public InventoryManager inventoryManager;
// Use this for initialization
void Start () {
StartTime = Time.time;
state = ComboState.Idle;
float comboEndTime;
bool comboTimeOn;
PlayerController playerController;
void Awake ()
{
playerController = GetComponent<PlayerController>();
anim = GetComponent<Animator>();
aoc = new AnimatorOverrideController(anim.runtimeAnimatorController);
anim.runtimeAnimatorController = aoc;
}
// Update is called once per frame
void Update()
{
SetTimeText(comboTime, comboEndTime - Time.time);
for (int i = 0; i < 3; i++)
attackRaw[i] = Input.GetAxisRaw("Fire" + (i+1));
cancelRaw = Input.GetAxisRaw("stop");
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)
for (int i = 0; i < 3; i++)
{
tempTime += c.getTime();
if (attackRaw[i] > 0 && attackKeyState[i] < 2)
attackKeyState[i]++;
else if (attackRaw[i] == 0)
attackKeyState[i] = 0;
}
time.text=Mathf.Round(tempTime*10f)/10f+"";
if (cancelRaw > 0 && cancelKeyState < 2)
cancelKeyState++;
else if (cancelRaw == 0)
cancelKeyState = 0;
if (attackA + attackB + attackC == 0)
if (cancelKeyState == 1)
{
keyCoolDown = true;
comboTimeOn = false;
}
if (state == ComboState.Idle)
{
if (attackA + attackB + attackC > 0 && keyCoolDown)
{
state = ComboState.Attack;
StartTime = Time.time;
ComboCheck();
}
}
else if (state == ComboState.Attack)
if (!playingSkill)
{
ComboCheck();
//공격중일때
if (Time.time > StartTime)
{
state = ComboState.Combo;
}
for (int i = 0; i < 3; i++)
if (attackKeyState[i] == 1)
{
comboArray += (char)('A' + i);
CheckCombo();
SetComboText();
break;
}
}
}
else if (state == ComboState.Combo)
public void SetComboText()
{
string conString = "";
if (comboArray.Equals(""))
{
ComboCheck();
if (comboQueue.Count > 0) //콤보가 남아있다면
{
combo.text = "";
return;
}
conString += comboArray[0];
for (int i = 1; i < comboArray.Length; i++)
conString += " " + comboArray[i];
combo.text = conString;
}
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)
public void SetTimeText(float fullTime, float currentTime)
{
if (comboTimeOn)
{
for (int i = 0; i < 20; i++)
{
//현재 시간이 마지막 콤보 끝나는 시점보다 1초 지났다면
state = ComboState.Idle;
comboArray = "";
if (currentTime / fullTime < (i + 1) * 0.05f)
{
string str = "";
for (int j = 0; j < i + 1; j++) str += "-";
time.text = str;
break;
}
}
}
if (attackA + attackB + attackC > 0)
else
{
keyCoolDown = false;
time.text = "";
}
}
public void SkillEnd()
{
if (CheckLongerCombo()) StartCoroutine(SkillEndCoroutine());
else
{
comboArray = "";
StartCoroutine(ComboTextReset());
}
}
IEnumerator ComboTextReset()
{
yield return new WaitForSeconds(1.5f);
SetComboText();
}
IEnumerator SkillEndCoroutine()
{
comboEndTime = Time.time + comboTime;
comboTimeOn = true;
while (Time.time < comboEndTime && comboTimeOn && !playingSkill)
{
yield return null;
}
if (!playingSkill)
{
comboArray = "";
SetComboText();
}
comboTimeOn = false;
}
void ComboCheck()
void CheckCombo()
{
//들어갈 콤보가 있는지 확인함
if (attackA + attackB + attackC > 0 && keyCoolDown)
List<Item> itemList = inventoryManager.itemList;
foreach(Item item in itemList)
{
if (attackA == 1)
{
comboArray += "A";
}
else if (attackB == 1)
for(int i=0; i< item.skillNum; i++)
{
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(item.combo[i].Equals(comboArray))
{
if (com2.Equals(temp))
{
comboQueue.Enqueue(com2);
}
playerController.playerState = PlayerState.Attack;
aoc["PlayerAttackAnim"] = item.animation[i];
anim.SetTrigger("attack");
item.ComboAction(i);
playingSkill = true;
GetComponent<Rigidbody2D>().velocity = new Vector2(Mathf.Clamp(GetComponent<Rigidbody2D>().velocity.x,-3f,3f), 0);
return;
}
}
}
playerController.playerState = PlayerState.Attack;
aoc["PlayerAttackAnim"] = normalAttack[comboArray[comboArray.Length - 1] - 'A'];
anim.SetTrigger("attack");
playingSkill = true;
GetComponent<Rigidbody2D>().velocity = new Vector2(Mathf.Clamp(GetComponent<Rigidbody2D>().velocity.x, -3f, 3f), 0);
if (!CheckLongerCombo()) comboArray = comboArray[comboArray.Length - 1] + "";
}
bool CheckLongerCombo()
{
List<Item> itemList = inventoryManager.itemList;
foreach(Item item in itemList)
for (int i = 0; i < item.skillNum; i++)
if (item.combo[i].Length > comboArray.Length && item.combo[i].Substring(0, comboArray.Length).Equals(comboArray))
return true;
return false;
}
}
public enum ItemQuality
public enum EnemyDebuffCase
{
fire,
ice,
stun,
blind,
charm
};
public enum ItemQuality
{
Study,
Ordinary,
......@@ -29,8 +38,7 @@ public enum ItemType
MasterpieceAdd
}
public enum PlayerState { Idle, Walk, Run, GoingUp, GoingDown, Rope }
public enum ComboState {Idle, Combo, Attack}
public enum PlayerState { Idle, Walk, Run, GoingUp, GoingDown, Rope, Attack }
/// <summary>
/// Enum for game's state.
......
......@@ -13,6 +13,7 @@ public class InventoryManager : MonoBehaviour {
private void Start()
{
ui = GameObject.Find("InventoryCanvas").GetComponent<InventoryUI>();
GameObject.Find("InventoryCanvas").SetActive(false);
//itemPool
itemPool.Add("Bow");
......@@ -30,7 +31,8 @@ public class InventoryManager : MonoBehaviour {
{
yield return null;
PushItem((Item)System.Activator.CreateInstance(System.Type.GetType(itemPool[0])));
yield return new WaitForSeconds(1f);
PushItem((Item)System.Activator.CreateInstance(System.Type.GetType(itemPool[2])));
/*yield return new WaitForSeconds(1f);
ItemSelect(0);
yield return new WaitForSeconds(1f);
PushItem((Item)System.Activator.CreateInstance(System.Type.GetType(itemPool[1])));
......@@ -43,7 +45,7 @@ public class InventoryManager : MonoBehaviour {
yield return new WaitForSeconds(1f);
AttachAddon(0, 0);
yield return new WaitForSeconds(1f);
*/
}
public void SetOnPosition()
{
......
......@@ -8,6 +8,7 @@ public abstract class Item {
public ItemQuality quality;
public int skillNum;
public string[] combo = new string[3]; //Capital Letters A B C
public AnimationClip[] animation = new AnimationClip[3];
public bool[] attachable = new bool[4]; //0: prop 1: matter 2: component 3:theory
public Addon[] addons = new Addon[4]; //0: prop 1: matter 2: component 3:theory
public Sprite sprite;
......@@ -27,6 +28,13 @@ public abstract class Item {
}
return false;
}
public bool ComboAction(int currenSkill)
{
if (currenSkill == 0) PlaySkill1();
else if (currenSkill == 1) PlaySkill2();
else if (currenSkill == 2) PlaySkill3();
return true;
}
public Item()
{
Declare();
......@@ -39,6 +47,9 @@ public abstract class Item {
combo = new string[3] { "", "", "" };
attachable = new bool[4] { false, false, false, false };
sprite = null;
animation[0] = null;
animation[1] = null;
animation[2] = null;
sizeInventory = new Vector2(0, 0);
}
protected virtual void PlaySkill1()
......
......@@ -15,6 +15,9 @@ public class Bow : Item {
combo = new string[3] { "BB", "BC", "" };
attachable = new bool[4] { true, true, true, true };
sprite = Resources.Load<Sprite>("Sprites/Items/bow");
animation[0] = Resources.Load<AnimationClip>("Animations/normalAttackA");
animation[1] = Resources.Load<AnimationClip>("Animations/normalAttackA");
animation[2] = null;
sizeInventory = new Vector2(90, 160);
}
}
......@@ -15,6 +15,9 @@ public class Ksanife : Item
combo = new string[3] { "A", "AABAA", "" };
attachable = new bool[4] { true, true, false, false };
sprite = Resources.Load<Sprite>("Sprites/Items/ksanife");
animation[0] = Resources.Load<AnimationClip>("Animations/normalAttackA");
animation[1] = Resources.Load<AnimationClip>("Animations/normalAttackA");
animation[2] = null;
sizeInventory = new Vector2(160, 160);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SkillPlay : StateMachineBehaviour {
public PlayerController playercontroller;
public PlayerAttack playerattack;
public GameObject player;
// 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.Find("Player");
playercontroller = player.GetComponent<PlayerController>();
playerattack = player.GetComponent<PlayerAttack>();
}
// 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) {
playercontroller.playerState = PlayerState.Idle;
playerattack.playingSkill = false;
playerattack.SkillEnd();
}
// OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here
//override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
// OnStateIK is called right after Animator.OnAnimatorIK(). Code that sets up animation IK (inverse kinematics) should be implemented here.
//override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
}
fileFormatVersion: 2
guid: 60bdd8700d3860e4c9a3d3d60b82a0ea
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -23,7 +23,7 @@ TagManager:
- OuterWall
- Item
- Tetris
-
- PlayerAttack
-
-
-
......
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