Roman 97c56e1892 Squashed commit of the following:
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
2021-12-28 14:04:09 +08:00

210 lines
7.5 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;
/// <summary>
/// 伊斯兰小怪类
/// </summary>
public class YiSiLan : Enemy, Boomer.I_CanBeBoomedObj
{
// _____ _ _ _
// | __ \ | | | (_)
// | |__) | _| |__ | |_ ___
// | ___/ | | | '_ \| | |/ __|
// | | | |_| | |_) | | | (__
// |_| \__,_|_.__/|_|_|\___|
[FoldoutGroup("其他",false,0)][Header("怪物死后旋转速度的随机区间")]
public float deadRotationRangeMax;
[FoldoutGroup("其他",false,0)]
public float deadRotationRangeMin;
/// <summary>
/// 抓到玩家后多长事件触发爆炸
/// </summary>
[Header("抓到玩家后多长事件触发爆炸")][FoldoutGroup("伊斯兰")]
public float boomTime;
/// <summary>
/// 被击飞力度的调整值
/// </summary>
[Header("被攻击后击飞的力度调整值")][FoldoutGroup("其他",false,0)]
public Vector2 hitToflyParameter;
public AudioSource boomAudio;
// _____ _ _
// | __ \ (_) | |
// | |__) | __ ___ ____ _| |_ ___
// | ___/ '__| \ \ / / _` | __/ _ \
// | | | | | |\ V / (_| | || __/
// |_| |_| |_| \_/ \__,_|\__\___|
private Rigidbody2D m_rigidbody;
/// <summary>
/// seek函数中的追踪目标
/// </summary>
public Transform target;
/// <summary>
/// 记录此时玩家是否在爆炸范围内
/// </summary>
[Header("记录此时玩家是否在爆炸范围内")][SerializeField][FoldoutGroup("伊斯兰")][ReadOnly]
private bool canHitPlayer;
public Animator animator;
/// <summary>
/// 这个小怪特殊吗?特殊的是剧情用的
/// </summary>
public bool isThisSpecial = false;
// _____ _ _ ____ _
// / ____| | | | _ \ | |
// | | __ _| | | |_) | __ _ ___| | __
// | | / _` | | | _ < / _` |/ __| |/ /
// | |___| (_| | | | |_) | (_| | (__| <
// \_____\__,_|_|_|____/ \__,_|\___|_|\_\
void Start(){Init();}//初始化
void FixedUpdate(){if(state == State.seek)Seek();}//seek
// _ _ _
// | \ | | | |
// | \| | ___ _ __ _ __ ___ __ _| |
// | . ` |/ _ \| '__| '_ ` _ \ / _` | |
// | |\ | (_) | | | | | | | | (_| | |
// |_| \_|\___/|_| |_| |_| |_|\__,_|_|
private void Init(){
//初始化状态为Seek
if(!isThisSpecial)state = State.seek;
//找到必要的组件
m_rigidbody = GetComponent<Rigidbody2D>();
target = FindObjectOfType<MyPlayer>().transform;
animator = GetComponent<Animator>();
if(!isThisSpecial) animator.SetBool("isMove",true);
}
/// <summary>
/// 寻找函数每Fixed调用
/// </summary>
private void Seek(){
//构造一个方向1代表向右-1代表向左
int dir = (target.position.x - transform.position.x > 0) ? 1:-1;
//使刚体水平方向上获得速度
m_rigidbody.velocity = new Vector2(speed * dir,
m_rigidbody.velocity.y);
//矫正一下faceDir的问题,使其始终朝向玩家
transform.rotation = Quaternion.
Euler
(transform.rotation.x,
((dir == 1) ? 0:-180),
transform.rotation.z);
}
/// <summary>
/// 碰到玩家的时候触发,伊斯兰爆炸的时候Call这个通过协程触发因为爆炸有个延时
/// </summary>
private void Boom(){
//
boomAudio.Play();
deadRotationRangeMax *= 3;
deadRotationRangeMin *= 3;
hitToflyParameter *= 3;
state = State.dead;
OnBeHit(MyPlayer.AtkMethod.,(target.position.x - transform.position.x > 0) ? 1:-1);
// //让自己去世
// OnDead();
//判定能否攻击到玩家
if(canHitPlayer){
FindObjectOfType<MyPlayer>().OnBeHit(ATK,(target.position.x - transform.position.x > 0) ? -1:1);
// //加一个扭矩,营造死亡的效果
// m_rigidbody.AddTorque(Random.Range(deadRotationRangeMin,deadRotationRangeMax) *
// ((target.position.x - transform.position.x > 0) ? -1:1));
}
}
/// <summary>
/// 被击飞的击飞效果处理
/// </summary>
/// <param name="dir">被击方向</param>
public void BeHitToFly(int dir){
m_rigidbody.velocity += new Vector2( //给予自身一个
-1 * dir * hitToflyParameter.x,//X方向为力度系数乘以受击方向
hitToflyParameter.y//Y方向为力度系数
//的绝对的速度
);
}
/// <summary>
/// 协程用,删除自己这个游戏物体
/// </summary>
protected void Dead(){Destroy(gameObject);}
// ______ _
// | ____| | |
// | |____ _____ _ __ | |_
// | __\ \ / / _ \ '_ \| __|
// | |___\ V / __/ | | | |_
// |______\_/ \___|_| |_|\__|
protected override void OnTouchThePlayer(MyPlayer player){
Invoke("Boom",boomTime);
//播放爆炸动画
animator.SetBool("isBoom",true);
}
public override void OnDead(){
//标记当前状态为死亡
state = State.dead;
//加一个扭矩,营造死亡的效果
m_rigidbody.AddTorque(Random.Range(deadRotationRangeMin,deadRotationRangeMax) *
((target.position.x - transform.position.x > 0) ? -1 : 1));
//关掉自己的碰撞体
GetComponent<BoxCollider2D>().enabled = false;
//两秒后自己毁灭
Invoke("Dead",2f);
}
public override void OnBeHit(MyPlayer.AtkMethod hitMethod, int hitDir){
attackAudio.Play();
//让自己被击飞
BeHitToFly(hitDir);
//结算生命值
HPLeft -= MyPlayer.atkMethodMagnification[hitMethod];
//看下死了没
//死了就记录下死亡时候的面部朝向用来做死亡翻滚效果然后再Call一下死亡事件
if(CheckDead()) {OnDead();}
//被打飞了在着地前都不会挨打了
canBeHit = false;
}
// _____ _ _ _ _
// / ____| | | (_) (_)
// | | ___ | | |_ ___ _ ___ _ __
// | | / _ \| | | / __| |/ _ \| '_ \
// | |___| (_) | | | \__ \ | (_) | | | |
// \_____\___/|_|_|_|___/_|\___/|_| |_|
//触发器代表炸弹范围,进入说明能炸到,离开说明炸不到了
protected override void OnTriggerEnter2D(Collider2D other){
base.OnTriggerEnter2D(other);
if(other.gameObject.TryGetComponent<MyPlayer>(out MyPlayer player))
canHitPlayer = true;
}
void OnTriggerExit2D(Collider2D other){
if(other.gameObject.TryGetComponent<MyPlayer>(out MyPlayer player))
canHitPlayer = false;
}
// _____ _ __
// |_ _| | | / _|
// | | _ __ | |_ ___ _ __| |_ __ _ ___ ___
// | | | '_ \| __/ _ \ '__| _/ _` |/ __/ _ \
// _| |_| | | | || __/ | | || (_| | (_| __/
// |_____|_| |_|\__\___|_| |_| \__,_|\___\___|
public void BeBoomed(float atk, int dir, Boomer boomer){
//需要重写
OnBeHit(MyPlayer.AtkMethod.,dir);
}
public Transform ObjTransform(){return transform;}
}