hit effect start, kick charge

This commit is contained in:
minenice55 2022-07-29 22:25:48 -04:00
parent 28b5cc71d7
commit 996354946a
10 changed files with 1997 additions and 25 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,96 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: HitMark
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: -348202296468608855, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- time: 0.033333335
value: {fileID: 0}
attribute: m_Sprite
path: Bottom
classID: 212
script: {fileID: 0}
- curve:
- time: 0
value: {fileID: -348202296468608855, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- time: 0.033333335
value: {fileID: 0}
attribute: m_Sprite
path: Top
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: 2398320530
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
- serializedVersion: 2
path: 647256362
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: -348202296468608855, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- {fileID: 0}
- {fileID: -348202296468608855, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3}
- {fileID: 0}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.050000004
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_Events:
- time: 0.033333335
functionName: KillHitMark
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 614e5734fc0dc9e4cb8ebaf207e465f8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,72 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1102 &-7178668093368379828
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: HitMark
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: 614e5734fc0dc9e4cb8ebaf207e465f8, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1107 &-5074555497065744670
AnimatorStateMachine:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: -7178668093368379828}
m_Position: {x: 200, y: 0, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -7178668093368379828}
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: HitMark
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: -5074555497065744670}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e4ec861ddbb579445854754649520ef1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,96 @@
fileFormatVersion: 2
guid: 223bb24c40a67fa4aa0a9c1d23dcc149
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,12 @@
using UnityEngine;
namespace HeavenStudio.Games.Scripts_KarateMan
{
public class KarateManHitMark : MonoBehaviour
{
void KillHitMark()
{
Destroy(gameObject);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d73c427be556896499214ab4666ff3b3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -25,6 +25,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public int GetComboId() { return inComboId; }
public int GetShouldComboId() { return shouldComboId; }
public bool wantKick = false;
public bool inKick = false;
float lastChargeTime = Single.MinValue;
bool inSpecial { get { return inCombo || inKick; } }
private void Awake()
{
@ -44,6 +50,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (missProg >= 0f && missProg < 1f)
{
anim.DoScaledAnimation("LowKickMiss", lastComboMissTime, 3f);
bop.startBeat = lastComboMissTime + 3f;
}
else if (missProg >= 1f)
{
@ -56,7 +63,24 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}
}
if (PlayerInput.Pressed(true) && !inCombo)
if (inKick)
{
float chargeProg = cond.GetPositionFromBeat(lastChargeTime, 2.75f);
if (chargeProg >= 0f && chargeProg < 1f)
{
anim.DoScaledAnimation("ManCharge", lastChargeTime, 2.75f);
bop.startBeat = lastChargeTime + 2.75f;
}
else if (chargeProg >= 1f)
{
anim.speed = 1f;
bop.startBeat = lastChargeTime + 2.75f;
lastChargeTime = Single.MinValue;
inKick = false;
}
}
if (PlayerInput.Pressed(true) && !inSpecial)
{
if (!KarateMan.instance.IsExpectingInputNow())
{
@ -64,7 +88,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
Jukebox.PlayOneShotGame("karateman/swingNoHit", forcePlay: true);
}
}
else if (PlayerInput.AltPressed() && !inCombo)
else if (PlayerInput.AltPressed() && !inSpecial)
{
if (!KarateMan.instance.IsExpectingInputNow())
{
@ -82,6 +106,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}
}
}
if ((!GameManager.instance.autoplay) && (PlayerInput.PressedUp(true) && wantKick && !PlayerInput.Pressing(true)))
{
//stopped holding, don't charge
wantKick = false;
}
}
public bool Punch(int forceHand = 0)
@ -95,20 +125,20 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (cond.songPositionInBeats - lastPunchTime < 0.25f + (Minigame.LateTime() - 1f))
{
lastPunchTime = Single.MinValue;
anim.Play("Straight", -1, 0);
anim.DoScaledAnimationAsync("Straight", 0.5f);
straight = true;
}
else
{
lastPunchTime = cond.songPositionInBeats;
anim.Play("Jab", -1, 0);
anim.DoScaledAnimationAsync("Jab", 0.5f);
}
break;
case 1:
anim.Play("Jab", -1, 0);
anim.DoScaledAnimationAsync("Jab", 0.5f);
break;
case 2:
anim.Play("Straight", -1, 0);
anim.DoScaledAnimationAsync("Straight", 0.5f);
straight = true;
break;
}
@ -172,5 +202,29 @@ namespace HeavenStudio.Games.Scripts_KarateMan
new MultiSound.Sound("karateman/comboMiss", beat + 0.75f),
}, forcePlay: true);
}
public void StartKickCharge(float beat)
{
wantKick = true;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate {
if (wantKick)
{
wantKick = false;
inKick = true;
lastChargeTime = beat;
bop.startBeat = beat + 2.75f;
}
})
});
}
public void Kick(float beat)
{
if (!inKick) return;
inKick = false;
bop.startBeat = beat + 2f;
}
}
}

View file

@ -2,6 +2,8 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NaughtyBezierCurves;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_KarateMan
@ -15,6 +17,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public GameObject Shadow;
public GameObject ShadowInstance;
public GameObject HitMark;
public string awakeAnim;
FlyStatus status = FlyStatus.Fly;
Color effectTint = Color.white;
@ -57,6 +61,9 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public float[] HitPositionOffset;
public Vector3[] StartPositionOffset;
public float[] ItemSlipRt;
public BezierCurve3D[] ItemCurves;
public BezierCurve3D CurrentCurve;
public float curveTargetBeat;
public SpriteRenderer BulbLight;
@ -131,8 +138,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
path = 5;
break;
case ItemType.KickBarrel:
//todo: needs own action for spawning the bomb
KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ItemJustOrNg, ItemThrough, ItemOut);
KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, KickChargeJustOrNg, ItemThrough, ItemOut);
KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ItemWrongAction, ItemOut, ItemOut);
path = 1;
comboId = -1;
@ -161,7 +167,6 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
var cond = Conductor.instance;
float floorHeight = HitPosition[0].position.y;
ShadowInstance.transform.position = new Vector3(transform.position.x, floorHeight - 0.5f, transform.position.z);
switch (status)
{
case FlyStatus.Fly:
@ -177,10 +182,24 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}
break;
case FlyStatus.Hit:
//TEMPORARY
GameObject.Destroy(ShadowInstance.gameObject);
GameObject.Destroy(gameObject);
return;
prog = cond.GetPositionFromBeat(startBeat, curveTargetBeat);
if (cond.songPositionInBeats >= startBeat + 2f || CurrentCurve == null) {
GameObject.Destroy(ShadowInstance.gameObject);
GameObject.Destroy(gameObject);
return;
}
else {
if (prog <= 1f)
{
transform.position = CurrentCurve.GetPoint(prog);
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-180f * Time.deltaTime * (1/cond.pitchedSecPerBeat)));
}
else
{
transform.position = CurrentCurve.GetPoint(1f);
}
}
break;
case FlyStatus.NG:
//TEMPORARY
GameObject.Destroy(ShadowInstance.gameObject);
@ -189,45 +208,82 @@ namespace HeavenStudio.Games.Scripts_KarateMan
case FlyStatus.HitWeak:
break;
}
ShadowInstance.transform.position = new Vector3(transform.position.x, floorHeight - 0.5f, transform.position.z);
}
void CreateHitMark(bool useLocalPos = false)
{
GameObject hitMark = GameObject.Instantiate(HitMark, KarateMan.instance.ItemHolder);
if (useLocalPos)
hitMark.transform.localPosition = transform.position;
else
hitMark.transform.position = HitPosition[path].position;
hitMark.SetActive(true);
}
//handles hitsound and particles
void ItemHitEffect()
void ItemHitEffect(bool straight = false)
{
startBeat = Conductor.instance.songPositionInBeats;
CreateHitMark(type == ItemType.KickBomb);
switch (type)
{
case ItemType.Bulb:
CurrentCurve = ItemCurves[straight ? 1 : 0];
curveTargetBeat = 2f;
Jukebox.PlayOneShotGame("karateman/lightbulbHit", forcePlay: true);
break;
case ItemType.Rock:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 2f;
Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true);
break;
case ItemType.Ball:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 2f;
Jukebox.PlayOneShotGame("karateman/soccerHit", forcePlay: true);
break;
case ItemType.Cooking:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 2f;
Jukebox.PlayOneShotGame("karateman/cookingPot", forcePlay: true);
//todo: pot lid
break;
case ItemType.Alien:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 2f;
Jukebox.PlayOneShotGame("karateman/alienHit", forcePlay: true);
break;
case ItemType.TacoBell:
CurrentCurve = ItemCurves[1];
curveTargetBeat = 2f;
Jukebox.PlayOneShotGame("karateman/rockHit", forcePlay: true);
Jukebox.PlayOneShotGame("karateman/tacobell", forcePlay: true);
break;
case ItemType.ComboPot1:
CurrentCurve = ItemCurves[straight ? 1 : 0];
curveTargetBeat = 2f;
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
break;
case ItemType.ComboPot2:
CurrentCurve = ItemCurves[0];
curveTargetBeat = 2f;
Jukebox.PlayOneShotGame("karateman/comboHit1", forcePlay: true);
break;
case ItemType.ComboPot3:
CurrentCurve = ItemCurves[2];
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/comboHit2", forcePlay: true);
break;
case ItemType.ComboPot4:
CurrentCurve = ItemCurves[3];
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
break;
case ItemType.ComboPot5:
CurrentCurve = ItemCurves[4];
curveTargetBeat = 1f;
Jukebox.PlayOneShotGame("karateman/comboHit3", forcePlay: true);
break;
case ItemType.ComboBarrel:
@ -237,6 +293,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
Jukebox.PlayOneShotGame("karateman/barrelBreak", forcePlay: true);
break;
default:
CurrentCurve = ItemCurves[straight ? 1 : 0];
curveTargetBeat = 2f;
Jukebox.PlayOneShotGame("karateman/potHit", forcePlay: true);
break;
}
@ -316,13 +374,13 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (GameManager.instance.currentGame != "karateman") return;
var joe = KarateMan.instance.Joe;
if (status == FlyStatus.Fly && !joe.inCombo) {
joe.Punch(ItemPunchHand());
bool straight = joe.Punch(ItemPunchHand());
if (state <= -1f || state >= 1f) {
Jukebox.PlayOneShot("miss");
status = FlyStatus.NG;
}
else {
ItemHitEffect();
ItemHitEffect(straight);
status = FlyStatus.Hit;
}
}
@ -365,7 +423,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{
if (GameManager.instance.currentGame != "karateman") return;
var joe = KarateMan.instance.Joe;
if (status == FlyStatus.Fly && !joe.inCombo) {
if (status == FlyStatus.Fly && !(joe.inKick || joe.wantKick || joe.inCombo)) {
joe.inCombo = true;
joe.Punch(1);
joe.SetComboId(comboId);
@ -393,13 +451,13 @@ namespace HeavenStudio.Games.Scripts_KarateMan
//WHEN SCORING THIS IS A MISS
var joe = KarateMan.instance.Joe;
if (status == FlyStatus.Fly && !joe.inCombo) {
joe.Punch(ItemPunchHand());
bool straight = joe.Punch(ItemPunchHand());
if (state <= -1f || state >= 1f) {
Jukebox.PlayOneShot("miss");
status = FlyStatus.NG;
}
else {
ItemHitEffect();
ItemHitEffect(straight);
}
}
}
@ -452,5 +510,39 @@ namespace HeavenStudio.Games.Scripts_KarateMan
if (GameManager.instance.currentGame != "karateman") return;
KarateMan.instance.Joe.ForceFailCombo(Conductor.instance.songPositionInBeats);
}
public void KickChargeJustOrNg(PlayerActionEvent caller, float state)
{
if (GameManager.instance.currentGame != "karateman") return;
var joe = KarateMan.instance.Joe;
if (status == FlyStatus.Fly && !(joe.inKick || joe.wantKick || joe.inCombo)) {
joe.Punch(ItemPunchHand());
if (state <= -1f || state >= 1f) {
Jukebox.PlayOneShot("miss");
status = FlyStatus.NG;
}
else {
//spawn the bomb
joe.StartKickCharge(startBeat + 1.25f);
ItemHitEffect();
status = FlyStatus.Hit;
}
}
}
public void KickChargeOut(PlayerActionEvent caller) {}
public void KickChargeThrough(PlayerActionEvent caller)
{
if (GameManager.instance.currentGame != "karateman") return;
if (status != FlyStatus.Fly || gameObject == null) return;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(startBeat + 2f, delegate {
//TODO: play miss sound
//deduct flow if applicable
})
});
}
}
}