
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
175 lines
5.5 KiB
C#
175 lines
5.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using DG.Tweening;
|
|
using Sirenix.OdinInspector;
|
|
|
|
/// <summary>
|
|
/// 炸弹类,控制木马喷射和召唤的炸弹
|
|
/// </summary>
|
|
public class Boomer : MonoBehaviour
|
|
{
|
|
// _____ _ _ _
|
|
// | __ \ | | | (_)
|
|
// | |__) | _| |__ | |_ ___
|
|
// | ___/ | | | '_ \| | |/ __|
|
|
// | | | |_| | |_) | | | (__
|
|
// |_| \__,_|_.__/|_|_|\___|
|
|
|
|
/// <summary>
|
|
/// 可以被炸弹炸到的物体,实现一些炸与被炸的功能
|
|
/// </summary>
|
|
public interface I_CanBeBoomedObj{
|
|
/// <summary>
|
|
/// 被炸的时候触发
|
|
/// </summary>
|
|
void BeBoomed(float atk, int dir, Boomer boomer);
|
|
Transform ObjTransform();
|
|
}
|
|
[HideInInspector]
|
|
public Rigidbody2D m_rigidbody;
|
|
/// <summary>
|
|
/// 落地后的爆炸时间
|
|
/// </summary>
|
|
public float landBoomTime = 0;
|
|
/// <summary>
|
|
/// 这个炸弹能否被反击呢?默认无法反击,如果要反击,请在初始化的时候修改此属性
|
|
/// </summary>
|
|
public bool isThisCanBeReturned = false;
|
|
/// <summary>
|
|
/// 爆炸粒子
|
|
/// </summary>
|
|
public GameObject boomParticle;
|
|
|
|
|
|
|
|
// _____ _ _
|
|
// | __ \ (_) | |
|
|
// | |__) | __ ___ ____ _| |_ ___
|
|
// | ___/ '__| \ \ / / _` | __/ _ \
|
|
// | | | | | |\ V / (_| | || __/
|
|
// |_| |_| |_| \_/ \__,_|\__\___|
|
|
|
|
private TrojanHorse owner;
|
|
/// <summary>
|
|
/// 爆炸会受影响的东西,只能是伊斯兰、木马或者玩家
|
|
/// </summary>
|
|
[ListDrawerSettings][ShowInInspector]
|
|
private List<I_CanBeBoomedObj> boomingObj;
|
|
/// <summary>
|
|
/// 记录正在播放的返回动画,爆炸的时候kill一下,否则会触发Tween插件的安全模式错误log
|
|
/// </summary>
|
|
private Tweener returnTweener;
|
|
|
|
// _____ _ _ ____ _
|
|
// / ____| | | | _ \ | |
|
|
// | | __ _| | | |_) | __ _ ___| | __
|
|
// | | / _` | | | _ < / _` |/ __| |/ /
|
|
// | |___| (_| | | | |_) | (_| | (__| <
|
|
// \_____\__,_|_|_|____/ \__,_|\___|_|\_\
|
|
|
|
void Start(){
|
|
Init();
|
|
}
|
|
|
|
// _ _ _
|
|
// | \ | | | |
|
|
// | \| | ___ _ __ _ __ ___ __ _| |
|
|
// | . ` |/ _ \| '__| '_ ` _ \ / _` | |
|
|
// | |\ | (_) | | | | | | | | (_| | |
|
|
// |_| \_|\___/|_| |_| |_| |_|\__,_|_|
|
|
|
|
private void Init(){
|
|
//找到必须的物体和组件
|
|
owner = FindObjectOfType<TrojanHorse>();
|
|
boomingObj = new List<I_CanBeBoomedObj>();
|
|
m_rigidbody = GetComponent<Rigidbody2D>();
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 爆炸的瞬间执行
|
|
/// </summary>
|
|
private void Boom(){
|
|
//对于每一个范围内的被炸物体
|
|
// foreach(I_CanBeBoomedObj obj in boomingObj){
|
|
// //执行被炸事件
|
|
// obj.BeBoomed(owner.ATK,
|
|
// (obj.ObjTransform().position.x - transform.position.x > 0) ? 1 : 1,
|
|
// this
|
|
// );
|
|
// }
|
|
for(int i = 0; i < boomingObj.Count; i++){
|
|
//执行被炸事件
|
|
boomingObj[i].BeBoomed(owner.ATK,
|
|
(boomingObj[i].ObjTransform().position.x - transform.position.x > 0) ? 1 : 1,
|
|
this
|
|
);
|
|
}
|
|
returnTweener.Kill();
|
|
|
|
Instantiate(boomParticle, this.transform.position, Quaternion.identity);
|
|
//销毁自己
|
|
Destroy(gameObject);
|
|
}
|
|
|
|
// ______ _
|
|
// | ____| | |
|
|
// | |____ _____ _ __ | |_
|
|
// | __\ \ / / _ \ '_ \| __|
|
|
// | |___\ V / __/ | | | |_
|
|
// |______\_/ \___|_| |_|\__|
|
|
|
|
/// <summary>
|
|
/// 被反击的时候触发
|
|
/// </summary>
|
|
public void Vengeance(){
|
|
//修改自身物理层使其不会与玩家相撞
|
|
gameObject.layer = 10;
|
|
|
|
//编写Tween动画使其飞向木马受击点
|
|
Tweener tweener = transform.DOMove(
|
|
owner.transform.Find("反弹炸弹受击点").position,
|
|
0.5f,false
|
|
);
|
|
returnTweener = tweener;
|
|
}
|
|
|
|
// _____ _ _ _ _
|
|
// / ____| | | (_) (_)
|
|
// | | ___ | | |_ ___ _ ___ _ __
|
|
// | | / _ \| | | / __| |/ _ \| '_ \
|
|
// | |___| (_) | | | \__ \ | (_) | | | |
|
|
// \_____\___/|_|_|_|___/_|\___/|_| |_|
|
|
|
|
//当与物体碰上
|
|
void OnCollisionEnter2D(Collision2D other){
|
|
//如果创到地面,执行爆炸延时
|
|
if(other.transform.tag == "地面"){
|
|
Invoke("Boom",landBoomTime);
|
|
}
|
|
else{
|
|
//否则直接炸
|
|
Boom();
|
|
}
|
|
}
|
|
//当有东西进入爆炸范围
|
|
void OnTriggerEnter2D(Collider2D other){
|
|
//看看是不是可被炸对象(对象需要实现被炸接口)
|
|
if(other.TryGetComponent<I_CanBeBoomedObj>(out I_CanBeBoomedObj obj) && !other.isTrigger){
|
|
//是则将其加入被炸对象列表
|
|
boomingObj.Add(obj);
|
|
}
|
|
}
|
|
//当有东西离开爆炸范围
|
|
void OnTriggerExit2D(Collider2D other){
|
|
//看看是不是可被炸对象(对象需要实现被炸接口)
|
|
if(other.TryGetComponent<I_CanBeBoomedObj>(out I_CanBeBoomedObj obj ) && !other.isTrigger){
|
|
//是则将其移除出被炸对象列表
|
|
boomingObj.Remove(obj);
|
|
}
|
|
}
|
|
|
|
}
|