Skip to content

Commit

Permalink
Merge pull request #1 from dogdie233/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dogdie233 authored Nov 15, 2020
2 parents 1dd8692 + 381c954 commit 8a04f3a
Show file tree
Hide file tree
Showing 20 changed files with 593 additions and 137 deletions.
Binary file added Assets/DLFMSample/Delos - Light Above The Sky.mp3
Binary file not shown.
22 changes: 22 additions & 0 deletions Assets/DLFMSample/Delos - Light Above The Sky.mp3.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

135 changes: 135 additions & 0 deletions Assets/DLFMSample/NewAudioMixer.mixer
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!241 &24100000
AudioMixerController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: NewAudioMixer
m_OutputGroup: {fileID: 0}
m_MasterGroup: {fileID: 24300002}
m_Snapshots:
- {fileID: 24500006}
m_StartSnapshot: {fileID: 24500006}
m_SuspendThreshold: -80
m_EnableSuspend: 1
m_UpdateMode: 0
m_ExposedParameters: []
m_AudioMixerGroupViews:
- guids:
- 2e56caa10b03d2b48aab4d11c12021f7
- 322533cf3b9bba54584be71d6bc4c36f
- 63b5d0aadf6defc4781ccf27dcd3212e
name: View
m_CurrentViewIndex: 0
m_TargetSnapshot: {fileID: 24500006}
--- !u!243 &24300002
AudioMixerGroupController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Master
m_AudioMixer: {fileID: 24100000}
m_GroupID: 2e56caa10b03d2b48aab4d11c12021f7
m_Children:
- {fileID: 243159630443108008}
- {fileID: 243736800746631566}
m_Volume: 85383db9e6fd2ad4ba49edc92f6a7a9f
m_Pitch: f99a7c2f1d68ef64eb65af7db3f17ed1
m_Effects:
- {fileID: 24400004}
m_UserColorIndex: 0
m_Mute: 0
m_Solo: 0
m_BypassEffects: 0
--- !u!244 &24400004
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: 86d94f750707f2d4f9cb7c6464b9d5a1
m_EffectName: Attenuation
m_MixLevel: 7e9ab68080b4c9e46b36a29d476d393c
m_Parameters: []
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0
--- !u!245 &24500006
AudioMixerSnapshotController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Snapshot
m_AudioMixer: {fileID: 24100000}
m_SnapshotID: cc1460d2ebb162843827ceb9fc034609
m_FloatValues: {}
m_TransitionOverrides: {}
--- !u!243 &243159630443108008
AudioMixerGroupController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BackGroundMusic
m_AudioMixer: {fileID: 24100000}
m_GroupID: 322533cf3b9bba54584be71d6bc4c36f
m_Children: []
m_Volume: 787fd58580bbb35458e71c261e11cc44
m_Pitch: 26725e43732261647832ccb90cc7079a
m_Effects:
- {fileID: 244373443531088772}
m_UserColorIndex: 0
m_Mute: 0
m_Solo: 0
m_BypassEffects: 0
--- !u!243 &243736800746631566
AudioMixerGroupController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Effect
m_AudioMixer: {fileID: 24100000}
m_GroupID: 63b5d0aadf6defc4781ccf27dcd3212e
m_Children: []
m_Volume: 6de58d687e55c0a4fa82619c024845d7
m_Pitch: 18cc243afd30f214bb836ca7698be735
m_Effects:
- {fileID: 244419882805022256}
m_UserColorIndex: 0
m_Mute: 0
m_Solo: 0
m_BypassEffects: 0
--- !u!244 &244373443531088772
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: ecb49877185562e44936148d9fd39962
m_EffectName: Attenuation
m_MixLevel: b92ea95f9be369b43a29ec95d0c682e2
m_Parameters: []
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0
--- !u!244 &244419882805022256
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: 5e443c88f838b1144872ebb4c03e53cc
m_EffectName: Attenuation
m_MixLevel: 8ec2a7a74e8ab3444b52ddc990af0003
m_Parameters: []
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0
8 changes: 8 additions & 0 deletions Assets/DLFMSample/NewAudioMixer.mixer.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions Assets/DLFMSample/Scripts/BGMController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Event;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Level
{
public class BGMController : MonoBehaviour
{
[SerializeField] private AudioSource source;

private void Awake()
{
if (source == null) { source = GetComponent<AudioSource>(); }
EventManager.onStateChange.AddListener(OnStateChange, Priority.Lowest);
}

private StateChangeEventArgs OnStateChange(StateChangeEventArgs e)
{
if (!e.canceled)
{
if (e.newState == GameState.Playing) { source.Play(); }
if (e.newState == GameState.WaitingRespawn) { source.Pause(); }
}
return e;
}
}
}
11 changes: 11 additions & 0 deletions Assets/DLFMSample/Scripts/BGMController.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 16 additions & 50 deletions Assets/DLFMSample/Scripts/CameraFollower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,15 @@ namespace Level
{
public class CameraFollower : MonoBehaviour
{
public class Task
{
public Vector3 startRotation;
public Vector3 targetRotation;
public float startDistance;
public float targetDistance;
public AnimationCurve curve;
public float startTime = 0f;

public Task(Vector3 arg1, Vector3 arg2, float arg3, float arg4, AnimationCurve arg5)
{
this.startRotation = arg1;
this.targetRotation = arg2;
this.startDistance = arg3;
this.targetDistance = arg4;
this.curve = arg5;
}
}

public Transform line;
public float distance;
private Vector3 currentVelocity = Vector3.zero;
public float smoothTime;
public bool enable;
private Vector3 followPoint;
private Vector3 vector;
private Task runningTask;
private Tweener rotaterX;
private Tweener rotaterY;
private Tweener rotaterZ;
private Tweener distanceChanger;

void Start()
Expand All @@ -47,22 +27,12 @@ void Start()
vector = (transform.position - followPoint) / Vector3.Distance(transform.position, followPoint) * distance;
}

void Update()
void Update()
{
if (!enable) return;
followPoint = Vector3.SmoothDamp(followPoint, line.position, ref currentVelocity, smoothTime);
transform.LookAt(followPoint);
transform.position = followPoint + vector;
/*
if (runningTask != null)
{
if (runningTask.startTime == 0f)
runningTask.startTime = Time.time;
Rotate(Vector3.Lerp(runningTask.startRotation, runningTask.targetRotation, runningTask.curve.Evaluate(Time.time - runningTask.startTime)), Mathf.Lerp(runningTask.startDistance, runningTask.targetDistance, runningTask.curve.Evaluate(Time.time - runningTask.startTime)));
distance = Vector3.Distance(followPoint, transform.position);
if (Time.time >= runningTask.startTime + runningTask.curve.length)
runningTask = null;
}
*/
}

/// <summary>
Expand All @@ -74,32 +44,28 @@ void Update()
/// <param name="curve">时间曲线</param>
public void Rotate(Vector2 target, float distance, float duration, AnimationCurve curve)
{
if (!enable) return;
if (rotaterX != null)
{
{
rotaterX.Kill(false);
rotaterX = null;
}
}
if (rotaterY != null)
{
rotaterY.Kill(false);
rotaterY = null;
}
if (rotaterZ != null)
{
rotaterZ.Kill(false);
rotaterZ = null;
}
if (distanceChanger != null)
{
{
distanceChanger.Kill(false);
distanceChanger = null;
}
if (target.x != transform.eulerAngles.x)
rotaterX = DOTween.To(() => transform.eulerAngles.x, x => { transform.RotateAround(followPoint, Vector3.right, x - transform.eulerAngles.x); }, target.x, duration).SetEase(curve);
if (target.y != transform.eulerAngles.y)
rotaterY = DOTween.To(() => transform.eulerAngles.y, y => { transform.RotateAround(followPoint, Vector3.up, y - transform.eulerAngles.y); }, target.y, duration).SetEase(curve);
if (Vector3.Distance(transform.position, followPoint) != distance)
distanceChanger = DOTween.To(() => Vector3.Distance(transform.position, followPoint), d => vector = (transform.position - followPoint) / Vector3.Distance(transform.position, followPoint) * d, distance, duration).SetEase(curve);
}
}
}
if (target.x != transform.eulerAngles.x)
rotaterX = DOTween.To(() => transform.eulerAngles.x, x => { transform.RotateAround(followPoint, Vector3.right, x - transform.eulerAngles.x); }, target.x, duration).SetEase(curve);
if (target.y != transform.eulerAngles.y)
rotaterY = DOTween.To(() => transform.eulerAngles.y, y => { transform.RotateAround(followPoint, Vector3.up, y - transform.eulerAngles.y); }, target.y, duration).SetEase(curve);
if (Vector3.Distance(transform.position, followPoint) != distance)
distanceChanger = DOTween.To(() => Vector3.Distance(transform.position, followPoint), d => vector = (transform.position - followPoint) / Vector3.Distance(transform.position, followPoint) * d, distance, duration).SetEase(curve);
}
}
}
Loading

0 comments on commit 8a04f3a

Please sign in to comment.