Throw and Catch animation

This commit is contained in:
Pengu123
2022-05-01 20:22:00 +02:00
parent df73b33b99
commit fdfcbe8948
11 changed files with 1523 additions and 322 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 913a0b390fee11c478e9b3d8fc3857a1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View 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);
}
}
}

View File

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

View 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;
}
}
}

View File

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