- 博客(16)
- 资源 (2)
- 收藏
- 关注
原创 unity2d摇杆控制角色360度转向和移动
using System.Collections;using System.Collections.Generic;using UnityEngine;public class PlayerMovement : MonoBehaviour{ public float speed; new private Rigidbody2D rigidbody; private Animator animator; public Joystick joystick;
2022-01-25 23:56:58 5156 2
原创 unity2d角色跟随鼠标移动
using System.Collections;using System.Collections.Generic;using UnityEngine;public class PlayerMovement : MonoBehaviour{ public float speed;//速度 new private Rigidbody2D rigidbody;//刚体 private Animator animator;//动画 private float inputX
2022-01-25 23:27:35 4209
原创 unity 实现字幕轮播功能
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class lunbo : MonoBehaviour{ public float timer = 5.0f; public string[] textStrs = new[] { "如果怪物吃到电池将会加快移动速度","如果怪物吃到太空人体型将会变大" }; pri
2021-11-20 23:21:13 2450
原创 unity 利用PlayerPrefs实现关卡解锁功能
关卡结构在关卡中确认过关的地方,添加public int jiesuo;jiesuo = SceneManager.GetActiveScene().buildIndex; PlayerPrefs.SetInt("jiesuo", jiesuo);然后在关卡画板添加using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;using U
2021-11-20 23:18:14 3241 3
原创 unity 利用NavMeshAgent2D实现怪物追人
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.AI;using UnityEngine.UI;public class monster : MonoBehaviour{ private Transform target; //设置追踪目标的位置 public float MoveSpeed = 2.5f; //敌人移动速度 p
2021-11-20 23:08:39 5332
原创 unity silder血条制作
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;using UnityEngine.SceneManagement;using System;public class PlayerMovement : MonoBehaviour{[Header("属性")] public float MaxHP;//最大生命值 public..
2021-11-20 23:02:55 2158
原创 unity刚体受力45度移动配合Joystick
在这里插入代码片void WASDHandling() { // don't move if currently typing in an input // we check this after checking h and v to save computations if (!UIUtils.AnyInputActive()) { // get horizontal and vertical input
2021-09-18 09:15:43 544
原创 unity移动端屏幕按键button移动
标题尽量写上关键词吧,这是我写的一个移动端unity小游戏的游戏方式,因为游戏要求,所以采屏幕按键,这里分享一下using UnityEngine;public class playerMove : MonoBehaviour{public Transform transform;//获取角色坐标private float rt = 0f;private float rt1 = 0f;public float rt2 = 1f;//定义变量,角色移动量public void player
2021-09-04 15:06:44 1656
原创 unity传送门
using UnityEngine;using UnityEngine.SceneManagement;public class SceneTransition : MonoBehaviour{ [SerializeField] private string sceneName; [SerializeField] public string password; private void OnTriggerEnter2D(Collider2D other) {
2021-06-16 22:51:54 1446 2
原创 unity防销毁代码
using System.Collections;using System.Collections.Generic;using UnityEngine;public class xiaohui : MonoBehaviour{ public object Instance { get; private set; } // Start is called before the first frame update private void Awake() {
2021-06-16 22:44:37 227
原创 unity时间代码
using System;using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;//Unity3D获取系统时间并且实时显示public class BaseDisplayInfo : MonoBehaviour{ private readonly int yyyy; //系统当前时间 public Text TxtCurrent
2021-06-16 22:42:26 296
原创 unity按钮控制图层显隐,用于ui制作
惯例,先上代码using UnityEngine;using System.Collections;using UnityEngine.UI;//注意这个不能少//using UnityEditor.Sprites ;public class tucheng : MonoBehaviour{ //public GameObject Gmenue; public GameObject btnObj; public GameObject caidan; public
2021-05-13 21:10:48 819
原创 unity点击游戏中物体切换场景
先上代码,然后图片设置示例using UnityEngine;using UnityEngine.SceneManagement; //Unity4.6之后的版本注意要加这个public class GameManager : MonoBehaviour{ public void OnStartGame(int SceneNumber) { //Application.LoadLevel(SceneNumber); //Unity4.6及之前版本的写法
2021-05-13 21:03:03 2330
转载 unity登录界面和场景异步加载多种方式
文字加载场景切换挂到摄象机上,拖入文本,此文本用于显示加载文本的位置,实际显示内容位文中文本,正在加载中时显示:夏目正在努力加载哦…,加载完成后显示:ok,using UnityEngine;using System.Collections;using UnityEngine.UI;using UnityEngine.SceneManagement;public class LoadScene : MonoBehaviour{ public Text loadingText;
2021-05-13 20:52:32 873 1
unity c#手机短信验证码登陆注册
2023-10-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人