elephant spawn and rotation values
This commit is contained in:
parent
a04215ab51
commit
e9b2c9e0bb
|
|
@ -1036,21 +1036,7 @@ MonoBehaviour:
|
||||||
SoundSequences: []
|
SoundSequences: []
|
||||||
EligibleHits: []
|
EligibleHits: []
|
||||||
scheduledInputs: []
|
scheduledInputs: []
|
||||||
firstEnable: 0
|
_elephant: {fileID: -5564384145903586768, guid: b3040fc162a3d6342971f82026e4335f, type: 3}
|
||||||
startCameraMoveLength: 3
|
_giraffe: {fileID: 5248028064811562821, guid: 72e69b6337a6bc04f86ffcf5bcedab92, type: 3}
|
||||||
elephantRef: {fileID: -5564384145903586768, guid: b3040fc162a3d6342971f82026e4335f, type: 3}
|
_monkeysLong: {fileID: -3114631264593203074, guid: f52ef60e472be3047bb77f54d5a3229d, type: 3}
|
||||||
elephantDistance: 10.304
|
_monkeysShort: {fileID: 7370747047491091311, guid: 0dfca7cb5fedf0d40aa26ffd9b4595ae, type: 3}
|
||||||
elephantStart: 0.004
|
|
||||||
elephantHangCameraMoveLength: 2
|
|
||||||
elephantHangMaxDip: 1
|
|
||||||
elephantReleaseMoveLength: 8.304
|
|
||||||
giraffeRef: {fileID: 5248028064811562821, guid: 72e69b6337a6bc04f86ffcf5bcedab92, type: 3}
|
|
||||||
giraffeDistance: 20
|
|
||||||
giraffeStart: 10
|
|
||||||
afterGiraffeExtraDistance: 25.04
|
|
||||||
monkeysRef: {fileID: -3114631264593203074, guid: f52ef60e472be3047bb77f54d5a3229d, type: 3}
|
|
||||||
monkeysDistance: 20
|
|
||||||
monkeysStart: 10
|
|
||||||
oneMonkeyRef: {fileID: 7370747047491091311, guid: 0dfca7cb5fedf0d40aa26ffd9b4595ae, type: 3}
|
|
||||||
oneMonkeyDistance: 10.304
|
|
||||||
oneMonkeyStart: 0.004
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,36 @@
|
||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &1961063600439490
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 2131794628642567477}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Grip
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &2131794628642567477
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1961063600439490}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: -2.014, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 2616646720197201304}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &74792210795109364
|
--- !u!1 &74792210795109364
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -113,6 +144,7 @@ Transform:
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3049806664453001319}
|
- {fileID: 3049806664453001319}
|
||||||
|
- {fileID: 2131794628642567477}
|
||||||
m_Father: {fileID: 6285390310926959546}
|
m_Father: {fileID: 6285390310926959546}
|
||||||
m_RootOrder: 3
|
m_RootOrder: 3
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
|
@ -526,11 +558,12 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 2f9ee457016acdc4eb5dbfdc03be0d6f, type: 3}
|
m_Script: {fileID: 11500000, guid: 2f9ee457016acdc4eb5dbfdc03be0d6f, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
holdLength: 2
|
_fullRotRange: 120
|
||||||
fullRotateAngle: 160
|
_spawnDistance: 2.602
|
||||||
anim: {fileID: 6198430257364661693}
|
_holdLength: 2
|
||||||
type: 0
|
_ease: 4
|
||||||
rotatePivot: {fileID: 2616646720197201304}
|
_rotateRoot: {fileID: 2616646720197201304}
|
||||||
|
_gripPoint: {fileID: 2131794628642567477}
|
||||||
--- !u!1 &7805847212563886084
|
--- !u!1 &7805847212563886084
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,56 @@ namespace HeavenStudio.Games.Scripts_AnimalAcrobat
|
||||||
{
|
{
|
||||||
public class AcrobatObstacle : MonoBehaviour
|
public class AcrobatObstacle : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[Header("Values")]
|
||||||
|
[SerializeField] private float _fullRotRange;
|
||||||
|
[SerializeField] private float _spawnDistance;
|
||||||
|
[SerializeField] private double _holdLength;
|
||||||
|
[SerializeField] private EasingFunction.Ease _ease = EasingFunction.Ease.EaseInOutQuad;
|
||||||
|
|
||||||
|
private double _startBeat;
|
||||||
|
private float _halfRotRange;
|
||||||
|
private EasingFunction.Function _func;
|
||||||
|
|
||||||
|
public float SpawnDistance => _spawnDistance;
|
||||||
|
|
||||||
|
[Header("Components")]
|
||||||
|
[SerializeField] private Transform _rotateRoot;
|
||||||
|
[SerializeField] private Transform _gripPoint;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
_halfRotRange = _fullRotRange * 0.5f;
|
||||||
|
_func = EasingFunction.GetEasingFunction(_ease);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetStartBeat(double beat)
|
||||||
|
{
|
||||||
|
_startBeat = beat;
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public float GetRotationDistance()
|
||||||
|
{
|
||||||
|
float result = Mathf.Cos((_fullRotRange + 180) * Mathf.Deg2Rad) * _gripPoint.localPosition.y;
|
||||||
|
return Mathf.Abs(result * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
var cond = Conductor.instance;
|
||||||
|
if (!cond.isPlaying) return;
|
||||||
|
|
||||||
|
float normalNoMod = cond.GetPositionFromBeat(_startBeat, _holdLength);
|
||||||
|
|
||||||
|
float normalizedBeat = normalNoMod % 1;
|
||||||
|
if (Mathf.Floor(normalNoMod) % 2 != 0)
|
||||||
|
{
|
||||||
|
normalizedBeat = 1 - normalizedBeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
float newAngleZ = _func(-_halfRotRange, _halfRotRange, normalizedBeat);
|
||||||
|
_rotateRoot.localEulerAngles = new Vector3(0, 0, newAngleZ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Jukebox;
|
using Jukebox;
|
||||||
|
using HeavenStudio.Util;
|
||||||
|
|
||||||
namespace HeavenStudio.Games.Loaders
|
namespace HeavenStudio.Games.Loaders
|
||||||
{
|
{
|
||||||
|
|
@ -39,11 +40,18 @@ namespace HeavenStudio.Games.Loaders
|
||||||
|
|
||||||
namespace HeavenStudio.Games
|
namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
using HeavenStudio.Games.Scripts_AnimalAcrobat;
|
using Scripts_AnimalAcrobat;
|
||||||
using HeavenStudio.Util;
|
|
||||||
public class AnimalAcrobat : Minigame
|
public class AnimalAcrobat : Minigame
|
||||||
{
|
{
|
||||||
|
[Header("Animal Prefabs")]
|
||||||
|
[SerializeField] private AcrobatObstacle _elephant;
|
||||||
|
[SerializeField] private AcrobatObstacle _giraffe, _monkeysLong, _monkeysShort;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
Instantiate(_elephant, transform);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue