
1.创建可交互电报机这个逻辑物体 *.在所有脚本首行添加说明方便查看 2.编写假电报机类,因为这个电报机没有电报机功能,而是一个类似事件的物体。 3.使假电报机可以分清场景中电话线断裂和修复的情况,并对其做出不同反应。 4.没修完电报机的反馈等待策划,修完了的等待我明天编写场景的多态系统 5.均通过了程序简单测试,请各位尽快拉取寻找问题 下班,别摸了,兄弟们
30 lines
860 B
C#
30 lines
860 B
C#
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);
|
||
}
|
||
}
|