
commit bf213bea549de72d8545a79c04e46b25d5a37b26 Author: SAIPO <grasste0403@hotmail.com> Date: Tue Dec 28 05:01:18 2021 +0800 优化游戏特效及制作游戏音效 优化: 1.基督小怪的shader添加完毕,但是小怪的闪电似乎有bug,见末尾bug集合 2.给炸弹爆炸加入了粒子特效 3.优化了死亡的屏幕后特效,现在做到了只有黑白区域才会渲染死亡鬼魂的效果 音效: 1.制作了地藏的全部音效 2.制作了特洛伊木马的全部音效 3.制作了以撒的全部音效 4.制作了玩家 跳跃,挥锤子,扔镰刀,受击,死亡,与击中敌人的音效,目前还缺少交互音效 5.制作了爱欲品的抱人音效 6.制作了所有与爆炸相关的音效 音效大体上已经制作完毕,逻辑也已经写完了 如果有不合适的音效改起来还算容易 问题: 1.目前在交互时(对话,看牌子),玩家可以进行挥砍和跳跃 2.基督石像的雷击效果只有一半不知道是不是bug 3.基督石像我没有找到他的受击函数,所以他的受击音效我没有制作 下班,绷不住了,真就干了后半夜。 commit 0d7446d2e7a625f033cda6acc496c6cddfe2d75f Author: SAIPO <grasste0403@hotmail.com> Date: Sat Dec 25 22:53:32 2021 +0800 修改建议及完善特效 修改建议: 1.添加了击中的粒子特效,但是还需要迭代 2.修复马死后灰尘不会消失的bug 完善特效 1.制作了死亡时的阴间特效,已经在全场景实装 2.制作了闪电的辉光特效。 3.调整了所有场景的全局shader以适配死亡阴间特效 # Conflicts: # Assets/Prefabs/基督闪电攻击器.prefab # Assets/Prefabs/死亡玩家.prefab # Assets/Scenes/DiZangStageTest.unity # Assets/Scenes/Fo.unity # Assets/Scenes/Ji.unity # Assets/Scenes/TeLuoYiStageTest.unity # Assets/Scenes/Yi.unity # Assets/Scenes/YiSaStageTest.unity # Assets/Scenes/cun.unity # Assets/Scripts/Boss/木马/TrojanHorse.cs # Assets/Scripts/演出/以撒/YiSaOpeningStage.cs # Assets/Scripts/玩家/MyPlayer.cs # Assets/Shader/大落雷/Shader Graphs_大落雷.mat # Assets/Shader/阴间/Shader Graphs_阴间.mat # Assets/Shader/阴间/阴间.shadergraph # UserSettings/EditorUserSettings.asset
158 lines
5.3 KiB
C#
158 lines
5.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using Sirenix.OdinInspector;
|
|
|
|
/// <summary>
|
|
/// 管理基督小怪召出来的闪电攻击
|
|
/// </summary>
|
|
public class LightningAttackAdministrator : MonoBehaviour
|
|
{
|
|
// _____ _ _ _
|
|
// | __ \ | | | (_)
|
|
// | |__) | _| |__ | |_ ___
|
|
// | ___/ | | | '_ \| | |/ __|
|
|
// | | | |_| | |_) | | | (__
|
|
// |_| \__,_|_.__/|_|_|\___|
|
|
|
|
/// <summary>
|
|
/// 单道闪电的持续时间
|
|
/// </summary>
|
|
[Header("单道闪电的持续时间")]
|
|
public float lightingTime;
|
|
/// <summary>
|
|
/// 两道闪电之间间隔的时间
|
|
/// </summary>
|
|
[Header("两道闪电之间间隔的时间")]
|
|
public float lightingIntervalTime;
|
|
/// <summary>
|
|
/// 攻击方向,产生这个闪电的怪物攻击时指定
|
|
/// </summary>
|
|
[Header("攻击方向,产生这个闪电的怪物攻击时指定")][ReadOnly]
|
|
public int dir;
|
|
/// <summary>
|
|
/// 这个攻击器的主人。请在发动攻击的时候指定。用来通知主人,本次攻击结束
|
|
/// </summary>
|
|
public JiDu owner;
|
|
/// <summary>
|
|
/// 基督小怪攻击硬直
|
|
/// </summary>
|
|
public float Stiff;
|
|
|
|
|
|
|
|
// _____ _ _
|
|
// | __ \ (_) | |
|
|
// | |__) | __ ___ ____ _| |_ ___
|
|
// | ___/ '__| \ \ / / _` | __/ _ \
|
|
// | | | | | |\ V / (_| | || __/
|
|
// |_| |_| |_| \_/ \__,_|\__\___|
|
|
[SerializeField][ListDrawerSettings][ReadOnly]
|
|
private List<Lighting> lightings;
|
|
|
|
// _____ _ _ ____ _
|
|
// / ____| | | | _ \ | |
|
|
// | | __ _| | | |_) | __ _ ___| | __
|
|
// | | / _` | | | _ < / _` |/ __| |/ /
|
|
// | |___| (_| | | | |_) | (_| | (__| <
|
|
// \_____\__,_|_|_|____/ \__,_|\___|_|\_\
|
|
void Start(){
|
|
Init();
|
|
StartCoroutine("ATK");
|
|
}
|
|
|
|
// _ _ _
|
|
// | \ | | | |
|
|
// | \| | ___ _ __ _ __ ___ __ _| |
|
|
// | . ` |/ _ \| '__| '_ ` _ \ / _` | |
|
|
// | |\ | (_) | | | | | | | | (_| | |
|
|
// |_| \_|\___/|_| |_| |_| |_|\__,_|_|
|
|
|
|
/// <summary>
|
|
/// 初始化函数
|
|
/// </summary>
|
|
private void Init(){
|
|
//处理一下攻击器朝向问题
|
|
if(dir == -1) transform.localScale = new Vector3(
|
|
transform.localScale.x * -1,
|
|
transform.localScale.y,
|
|
transform.localScale.z
|
|
);
|
|
//初始化闪电列表,用来控制每一个小闪电
|
|
lightings = new List<Lighting>(transform.childCount);
|
|
for (int i = 0; i < transform.childCount; i++){
|
|
Transform temp = transform.GetChild(i);
|
|
lightings.Add(
|
|
temp.gameObject.AddComponent<Lighting>()
|
|
);
|
|
//初始化小闪电的主人和状态
|
|
lightings[i].state = Lighting.State.wait;
|
|
lightings[i].owner = this;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 攻击函数协程
|
|
/// </summary>
|
|
private IEnumerator ATK(){
|
|
//按顺序遍历每一个小闪电
|
|
foreach(Lighting l in lightings){
|
|
//如果处于等待状态
|
|
if(l.state == Lighting.State.wait){
|
|
//如果不是第一个闪电,则需要等待每个闪电的间隔的时间
|
|
if(l != lightings[0])yield return new WaitForSeconds(lightingIntervalTime);
|
|
//等待结束后令闪电攻击
|
|
l.gameObject.SetActive(true);
|
|
l.state = Lighting.State.atk;
|
|
//然后攻击持续每个小闪电的持续时间
|
|
yield return new WaitForSeconds(lightingTime);
|
|
//等待结束后关闭这个小闪电
|
|
l.gameObject.SetActive(false);
|
|
l.state = Lighting.State.over;
|
|
//循环至下一个小闪电
|
|
}
|
|
}
|
|
//遍历结束后进入攻击硬直等待
|
|
yield return new WaitForSeconds(Stiff);
|
|
//等待结束后通知主人攻击结束,并销毁攻击器
|
|
owner.OnAtkEnd();
|
|
Destroy(gameObject);
|
|
}
|
|
|
|
|
|
// _______ _ _____ _
|
|
// |__ __| | |/ ____| |
|
|
// | | ___ ___ | | | | | __ _ ___ ___
|
|
// | |/ _ \ / _ \| | | | |/ _` / __/ __|
|
|
// | | (_) | (_) | | |____| | (_| \__ \__ \
|
|
// |_|\___/ \___/|_|\_____|_|\__,_|___/___/
|
|
|
|
/// <summary>
|
|
/// 单道小闪电类,主要控制一下碰撞体
|
|
/// </summary>
|
|
private class Lighting : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// 闪电的状态种类
|
|
/// </summary>
|
|
public enum State{wait,atk,over};
|
|
/// <summary>
|
|
/// 闪电的当前状态
|
|
/// </summary>
|
|
public State state;
|
|
/// <summary>
|
|
/// 这道闪电的主人,一个攻击器
|
|
/// </summary>
|
|
public LightningAttackAdministrator owner;
|
|
|
|
void OnTriggerEnter2D(Collider2D other){
|
|
if (other.TryGetComponent<MyPlayer>(out MyPlayer player)){
|
|
player.OnBeHit(owner.owner.ATK,
|
|
((owner.transform.position.x - player.transform.position.x > 0) ? 1 : -1)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|