religion/Assets/Scripts/UI/PlayerHpBar.cs
SAIPO bf213bea54 优化游戏特效及制作游戏音效
优化:
1.基督小怪的shader添加完毕,但是小怪的闪电似乎有bug,见末尾bug集合
2.给炸弹爆炸加入了粒子特效
3.优化了死亡的屏幕后特效,现在做到了只有黑白区域才会渲染死亡鬼魂的效果

音效:
1.制作了地藏的全部音效
2.制作了特洛伊木马的全部音效
3.制作了以撒的全部音效
4.制作了玩家 跳跃,挥锤子,扔镰刀,受击,死亡,与击中敌人的音效,目前还缺少交互音效
5.制作了爱欲品的抱人音效
6.制作了所有与爆炸相关的音效

音效大体上已经制作完毕,逻辑也已经写完了
如果有不合适的音效改起来还算容易

问题:
1.目前在交互时(对话,看牌子),玩家可以进行挥砍和跳跃
2.基督石像的雷击效果只有一半不知道是不是bug
3.基督石像我没有找到他的受击函数,所以他的受击音效我没有制作

下班,绷不住了,真就干了后半夜。
2021-12-28 05:01:18 +08:00

42 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Sirenix.OdinInspector;
using UnityEngine.UI;
using DG.Tweening;
public class PlayerHpBar : MonoBehaviour
{
[SerializeField]
private float HPLeft = -1f;
private MyPlayer player;
[SerializeField][ListDrawerSettings]
private List<Image> hearts;
public Sprite full;
public Sprite empty;
void Start(){
hearts = new List<Image>();
//找到必要的物体和组件
player = FindObjectOfType<MyPlayer>();
for(int i = 0; i < 10; i++){
hearts.Add(transform.GetChild(i).GetComponent<Image>());
}
}
void Update(){
//每帧检查当UI剩余血量和玩家真实剩余血量不一致触发重刷新UI功能
if(HPLeft != player.HPLeft) RefrashUI((int) player.HPLeft);
HPLeft = player.HPLeft;
}
void RefrashUI(int left){
foreach(Image t in hearts){
if(left > 0) t.sprite = full;
else t.sprite = empty;
left--;
}
}
}