using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Author:圈毛君
/// MoveController:2019/10/18 20:50
/// </summary>
public class PlayerController : MonoBehaviour
{
public float walkSpeed = 3.0f; // 步行速度
public float runSpeed = 5.0f; // 跑步速度
public float pressInterval = 0.5f; // 双击按键的有效时间间隔
public float exStepDistance = 3.0f; // 瞬步距离
private Rigidbody2D rgb;
private SpriteRenderer sr;
private Color originColor;
private float pressATime; // 按下A键时间
private float pressDTime;
private float releaseATime = .0f; // 松开A键时间
private float releaseDTime = .0f;
private void Awake()
{
rgb = this.GetComponent<Rigidbody2D>();
sr = this.GetComponent<SpriteRenderer>();
originColor = sr.color;
}
private void Start()
{
【Unity脚本】游戏开发常用功能——双击键盘跑步/快步
最新推荐文章于 2023-11-05 22:01:37 发布