2.添加了三个关卡的视差效果 3.添加了第一关的机枪兵的开枪时的火光 4.实装了第二关的挡板遮挡灯光效果 5.增加了第一关中的大型烟雾 6.实装了第二关的水面反射 (以上更改均有或多或少修改程序的代码) 7.增加了玩家脚底的跑动灰尘效果 8.增加了战场上时不时飘过的黑色烟雾(有时可能有些违和)
48 lines
1.1 KiB
C#
48 lines
1.1 KiB
C#
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
public class KeepOut : MonoBehaviour
|
||
{
|
||
public List<GameObject> playerLayer;//获得所有玩家的图层 没办法 我只会这么写了 屎山代码
|
||
// Start is called before the first frame update
|
||
void Start()
|
||
{
|
||
|
||
}
|
||
|
||
// Update is called once per frame
|
||
void Update()
|
||
{
|
||
|
||
}
|
||
|
||
|
||
private void OnTriggerEnter2D(Collider2D other)
|
||
{
|
||
//当玩家进入这个遮挡区域 把图层换为遮光的图层
|
||
if (other.tag == "Player")
|
||
{
|
||
for (int i = 0; i < playerLayer.Count; i++)
|
||
{
|
||
playerLayer[i].GetComponent<SpriteRenderer>().sortingLayerName = "player(遮光)";
|
||
}
|
||
}
|
||
}
|
||
|
||
private void OnTriggerExit2D(Collider2D other)
|
||
{
|
||
//当玩家出去这个遮挡区域 把图层换回去
|
||
if (other.tag == "Player")
|
||
{
|
||
for (int i = 0; i < playerLayer.Count; i++)
|
||
{
|
||
playerLayer[i].GetComponent<SpriteRenderer>().sortingLayerName = "player";
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
}
|