SAIPO d3f9ad1a5c 1.增加了老爹的回忆场景,但是人物还没有加入移动,我不大会使呜呜。
2.增加了视觉差parallax的代码,并在第一个场景的背景加入了视差。
3.第一个场景的可交互物品加入了提示灯光(暂定效果)
4.战场加入了硝烟粒子特效
2021-07-24 08:26:28 +08:00

29 lines
829 B
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;
/*
更新日期2021.7.24 视差类
使用方式将类挂载到需要视差的背景上将主摄像机赋值给Cam调节视差率即可
注意 移动的背景一定要比不移动的面积大
*/
public class Parallax : MonoBehaviour
{
public Transform Cam;//视差摄像机
public float moveRate;//视差率
private float startPoint;//起点,自动获取
// Start is called before the first frame update
void Start()
{
startPoint = transform.position.x;//获取当前起点位置
}
// Update is called once per frame
void Update()
{
//每帧更新位置
transform.position = new Vector2(startPoint + Cam.position.x * moveRate, transform.position.y);
}
}