提交 0f4fd8b9 编写于 作者: IX_V_'s avatar IX_V_

Merge branch 'master' of gitcode.net:SoftwareEngineering2022ClassF/peekaboo/peekaboo

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DeadViewController : MonoBehaviour
{
private float horizontalMove; // 水平移动
private float verticalMove; // 垂直移动
private float speed = 30; // 移动速度
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
horizontalMove = Input.GetAxis("Horizontal");
verticalMove = Input.GetAxis("Vertical");
Vector2 position = transform.position;
position.x = position.x + speed * horizontalMove * Time.deltaTime;
position.y = position.y + speed * verticalMove * Time.deltaTime;
if (position.x < -70)
position.x = -70;
if (position.x > 21)
position.x = 21;
if (position.y < -74)
position.y = -74;
if (position.y > 20)
position.y = 20;
gameObject.transform.position = position;
}
}
fileFormatVersion: 2
guid: f83fb4fb01b4378418e579656d119444
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册