先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
99 lines
3.0 KiB
C#
99 lines
3.0 KiB
C#
using asap.core;
|
|
using cfg;
|
|
using DG.Tweening;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class BarRoot : MonoBehaviour
|
|
{
|
|
public Image bar_green;
|
|
public Image mid;
|
|
public Transform _highlight;
|
|
public Image bar_lianji;
|
|
public GameObject arrow_guidance;
|
|
float barShakeAmp = 1;
|
|
List<float> posAmp = new List<float>() { 0, 0 };
|
|
List<float> posPeriod = new List<float>() { 0, 0 };
|
|
List<float> scaleAmp = new List<float>() { 0, 0 };
|
|
List<float> scalePeriod = new List<float>() { 0, 0 };
|
|
private void InitAmpAndPeriod()
|
|
{
|
|
posAmp = new List<float>() { 0, 0 };
|
|
posPeriod = new List<float>() { 0, 0 };
|
|
scaleAmp = new List<float>() { 0, 0 };
|
|
scalePeriod = new List<float>() { 0, 0 };
|
|
}
|
|
public void ShowTensionBar()
|
|
{
|
|
InitAmpAndPeriod();
|
|
arrow_guidance.gameObject.SetActive(false);
|
|
bar_green.DOKill();
|
|
UpdateTensionBar(0.5f);
|
|
bar_lianji.fillAmount = 0;
|
|
}
|
|
public void UpdateTensionBar(float power)
|
|
{
|
|
power = (power * 86 + 2f) / 90;
|
|
bar_green.fillAmount = power;
|
|
_highlight.localEulerAngles = new Vector3(0, 0, (1 - power) * 90f);
|
|
}
|
|
|
|
public void SetBarCombo(float fillAmount)
|
|
{
|
|
bar_lianji.fillAmount = 0.3f + (fillAmount * 0.7f);
|
|
}
|
|
public void BarComboBack(float time)
|
|
{
|
|
bar_lianji.DOFillAmount(0.3f, time - 0.001f);
|
|
}
|
|
public void SetTensionBarScale(float MaxZoneScale)
|
|
{
|
|
mid.fillAmount = MaxZoneScale;
|
|
}
|
|
public void PlayAni(string aniName, float barShakeAmp)
|
|
{
|
|
this.barShakeAmp = barShakeAmp;
|
|
//ani.Play(aniName);
|
|
RodShakeParam rodShakeParam = GContext.container.Resolve<Tables>().TbRodShakeParam.GetOrDefault(aniName);
|
|
if (rodShakeParam == null)
|
|
{
|
|
InitAmpAndPeriod();
|
|
}
|
|
else
|
|
{
|
|
posAmp = rodShakeParam.PosAmp;
|
|
posPeriod = rodShakeParam.PosPeriod;
|
|
scaleAmp = rodShakeParam.ScaleAmp;
|
|
scalePeriod = rodShakeParam.ScalePeriod;
|
|
}
|
|
}
|
|
private void Update()
|
|
{
|
|
float x = 0;
|
|
float y = 0;
|
|
if (posAmp[0] > 0.0001f)
|
|
{
|
|
x = Mathf.Sin(Time.time * 2 * Mathf.PI / posPeriod[0]) * posAmp[0] * barShakeAmp;
|
|
}
|
|
if (posAmp[1] > 0.0001f)
|
|
{
|
|
y = Mathf.Sin(Time.time * 2 * Mathf.PI / posPeriod[1]) * posAmp[1] * barShakeAmp;
|
|
}
|
|
transform.localPosition = new Vector3(x, y, 0);
|
|
float sx = 1;
|
|
float sy = 1;
|
|
if (scaleAmp[0] > 0.0001f)
|
|
{
|
|
sx += Mathf.Sin(Time.time * 2 * Mathf.PI / scalePeriod[0]) * (scaleAmp[0] - 1) * barShakeAmp;
|
|
}
|
|
if (scaleAmp[1] > 0.0001f)
|
|
{
|
|
sy += Mathf.Sin(Time.time * 2 * Mathf.PI / scalePeriod[1]) * (scaleAmp[1] - 1) * barShakeAmp;
|
|
}
|
|
transform.localScale = new Vector3(sx, sy, 1);
|
|
}
|
|
}
|