mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 13:37:40 +02:00
Throw and Catch animation
This commit is contained in:
8
Assets/Scripts/Games/CoinToss.meta
Normal file
8
Assets/Scripts/Games/CoinToss.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 913a0b390fee11c478e9b3d8fc3857a1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
56
Assets/Scripts/Games/CoinToss/Arm.cs
Normal file
56
Assets/Scripts/Games/CoinToss/Arm.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using NaughtyBezierCurves;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_CoinToss
|
||||
{
|
||||
public class Arm : PlayerActionObject
|
||||
{
|
||||
|
||||
private Boolean isThrowing;
|
||||
private Animator handAnimator;
|
||||
|
||||
private CoinToss game;
|
||||
|
||||
// Start is called before the first frame update
|
||||
private void Awake()
|
||||
{
|
||||
isThrowing = false;
|
||||
game = CoinToss.instance;
|
||||
handAnimator = game.handAnimator;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
private void Update()
|
||||
{
|
||||
if (PlayerInput.Pressed() && state.perfect)
|
||||
{
|
||||
if (isThrowing)
|
||||
{
|
||||
Catch_Success();
|
||||
isThrowing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
{
|
||||
if(isThrowing)
|
||||
{
|
||||
Catch_Success();
|
||||
isThrowing = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Catch_Success()
|
||||
{
|
||||
Jukebox.PlayOneShotGame("coinToss/catch");
|
||||
handAnimator.Play("Catch_success", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
11
Assets/Scripts/Games/CoinToss/Arm.cs.meta
Normal file
11
Assets/Scripts/Games/CoinToss/Arm.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 064f8eb876b68ff448e085a8c3df2db7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
61
Assets/Scripts/Games/CoinToss/CoinToss.cs
Normal file
61
Assets/Scripts/Games/CoinToss/CoinToss.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using DG.Tweening;
|
||||
using NaughtyBezierCurves;
|
||||
using HeavenStudio.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
using static Minigames;
|
||||
public static class NtrCoinLoader
|
||||
{
|
||||
public static Minigame AddGame(EventCaller eventCaller)
|
||||
{
|
||||
return new Minigame("coinToss", "Coin Toss", "B4E6F6", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("toss", delegate { CoinToss.instance.TossCoin(eventCaller.currentEntity.beat); }, 7, false),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
using Scripts_CoinToss;
|
||||
public class CoinToss : Minigame
|
||||
{
|
||||
|
||||
public static CoinToss instance { get; set; }
|
||||
|
||||
public Boolean isThrowing;
|
||||
|
||||
[Header("Animators")]
|
||||
public Animator handAnimator;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
isThrowing = false;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
//pass
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
//pass
|
||||
}
|
||||
|
||||
public void TossCoin(float beat)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("coinToss/throw");
|
||||
handAnimator.Play("Throw", 0, 0);
|
||||
|
||||
isThrowing = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/CoinToss/CoinToss.cs.meta
Normal file
11
Assets/Scripts/Games/CoinToss/CoinToss.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e3903a882e6af341896ffb744aae583
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user