2022-04-10 21:37:37 +00:00
|
|
|
using DG.Tweening;
|
|
|
|
using NaughtyBezierCurves;
|
2022-04-04 14:48:37 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
2022-04-10 21:37:37 +00:00
|
|
|
using HeavenStudio.Util;
|
|
|
|
|
2022-04-04 14:48:37 +00:00
|
|
|
namespace HeavenStudio.Games
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
mob_Trick
|
|
|
|
**/
|
2022-04-10 21:37:37 +00:00
|
|
|
|
|
|
|
using Scripts_TrickClass;
|
2022-04-04 14:48:37 +00:00
|
|
|
public class TrickClass : MonoBehaviour
|
|
|
|
{
|
2022-04-10 21:37:37 +00:00
|
|
|
public enum TrickObjType {
|
|
|
|
Plane,
|
|
|
|
Shock,
|
|
|
|
Ball,
|
|
|
|
Chair,
|
|
|
|
Phone
|
|
|
|
}
|
|
|
|
|
|
|
|
[Header("References")]
|
|
|
|
public GameObject ballPrefab;
|
|
|
|
public GameObject planePrefab;
|
|
|
|
public GameObject shockPrefab;
|
|
|
|
public Transform objHolder;
|
|
|
|
|
|
|
|
[Header("Curves")]
|
|
|
|
public BezierCurve3D ballTossCurve;
|
|
|
|
public BezierCurve3D ballMissCurve;
|
|
|
|
public BezierCurve3D planeTossCurve;
|
|
|
|
public BezierCurve3D planeMissCurve;
|
|
|
|
public BezierCurve3D shockTossCurve;
|
2022-04-04 14:48:37 +00:00
|
|
|
|
|
|
|
public static TrickClass instance;
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
instance = this;
|
|
|
|
}
|
2022-04-10 21:37:37 +00:00
|
|
|
|
|
|
|
public void TossObject(float beat, int type)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case (int) TrickObjType.Plane:
|
|
|
|
Jukebox.PlayOneShotGame("trickClass/girl_toss_plane");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Jukebox.PlayOneShotGame("trickClass/girl_toss_ball");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
SpawnObject(beat, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void SpawnObject(float beat, int type)
|
|
|
|
{
|
|
|
|
GameObject objectToSpawn;
|
|
|
|
BezierCurve3D curve;
|
|
|
|
bool isPlane = false;
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case (int) TrickObjType.Plane:
|
|
|
|
objectToSpawn = planePrefab;
|
|
|
|
curve = planeTossCurve;
|
|
|
|
isPlane = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
objectToSpawn = ballPrefab;
|
|
|
|
curve = ballTossCurve;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
var mobj = GameObject.Instantiate(objectToSpawn, objHolder);
|
|
|
|
var thinker = mobj.GetComponent<MobTrickObj>();
|
|
|
|
|
|
|
|
thinker.startBeat = beat;
|
|
|
|
thinker.flyType = isPlane;
|
|
|
|
thinker.curve = curve;
|
|
|
|
}
|
2022-04-04 14:48:37 +00:00
|
|
|
}
|
|
|
|
}
|