Better Coin Animation

This commit is contained in:
brausjonas
2023-02-05 22:07:41 +01:00
parent b0ddf261f4
commit 2abea8e99e
45 changed files with 1259 additions and 355 deletions
+10 -6
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public abstract class Player : MonoBehaviour
@@ -15,6 +16,7 @@ public abstract class Player : MonoBehaviour
protected Vector3 cameraOffset = new Vector3(-2.81f, 8.13f, 5.6f);
public int index;
public int coins = 0;
public TMP_Text textCoinsInfo;
//for coin animation
private AnimationHandler animationHandler;
@@ -41,16 +43,18 @@ public abstract class Player : MonoBehaviour
public void PlayAnimation(AnimationType animationType)
{
switch (animationType)
{
case AnimationType.Coin:
animationHandler.StartAnimation();
break;
}
animationHandler.StartAnimation(animationType);
}
public enum AnimationType
{
Coin
}
protected void AddCoins(int amount)
{
coins += amount;
textCoinsInfo.text = coins + "";
PlayAnimation(AnimationType.Coin);
}
}