SAIPO 6bd74c6c0c 合并了分支
1.序章-家中
  1)加入了后处理volume对象,添加了Bloom,轻微暗角与重新映射动态范围
2.序章-战场
  1)加入了后处理volume对象,与一些色调色轮调整
  2)(建议这个场景也加入爆炸声和屏幕震动,因为背景也有炮弹,现在太平静了)
3.第一关
  1)加入了后处理volume对象,与一些色调色轮调整
  2)修复了枪光的bug
4.第二关
  1)加入了后处理volume对象,与一些色调色轮调整
  2)加入了背景的炮火效果
  3)加入了解决的两声枪响
5.在music effects文件夹里加入了不合适的音效的替代
2021-09-09 22:08:49 +08:00

50 lines
1.6 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Missile : MonoBehaviour
{
//投掷物类,用来控制投掷物
// Start is called before the first frame update
[SerializeField]
private bool amINoisy = false;//记录自己是否落地发出声音的变量
private bool amIBeenChecked = false;//记录自己是否已经被敌人检查过
private Rigidbody2D m_rigidbody;
void Start()
{
m_rigidbody = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
//使得自身旋转角度匹配速度,像一支箭矢
if(m_rigidbody != null)
{
float angle = Vector2.Angle(m_rigidbody.velocity,Vector2.right);
if(m_rigidbody.velocity.y > 0) m_rigidbody.SetRotation(angle);
else m_rigidbody.SetRotation(-angle);
}
}
void OnCollisionEnter2D(Collision2D other)
{
if(other.gameObject.tag == "地面")
{
//当投掷物砸到地面,发出一个响声(逻辑上),标记自身为声源
amINoisy = true;
//同时,摧毁自身的刚体组件,阻止其滚动
Destroy(GetComponent<Rigidbody2D>());
//再摧毁自身碰撞体
//Destroy(GetComponent<CapsuleCollider2D>());
GetComponent<CapsuleCollider2D>().isTrigger = true;
//播放着地音效
GetComponent<AudioSource>().Play();
}
}
public bool AMINoisy(){return amINoisy;}
public bool AmIBeenChecked(){return amIBeenChecked;}
public void YouAreChecked(){amIBeenChecked = true;}
}