自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 收藏
  • 关注

原创 2021-09-03

function M:Init() self.turntablePos = 0 self.RollEnd = false self.StopRoll = false self.Speed = 0 self.AddSpeed = -3 self.AddOverSpeed = -20 self.TurnNum = 0 self.TurntableNum = { 0, -72, -144, -216, -288 };--分别对应下方value 1,5,4,

2021-01-06 14:14:22 201 1

原创 unity加载图片

1、图片资源未在Resources文件夹下IEnumerator LoadImage(string url, SpriteRenderer renderer) { WWW www = new WWW(url); if (!www.isDone) yield return www; Texture2D texture = www.texture; Debug.Log(te...

2020-02-23 21:36:44 908

原创 Unity地图描述

public class Map : MonoBehaviour{ public const int RowCount = 8;//行数 public const int ColumnCount = 12;//列数 float MapWidth;//地图宽 float MapHeight;//地图高 float TileWidth;//格子宽 float TileHeight;/...

2020-02-23 16:44:41 224

原创 Unity 选关界面滑块滑到下一关关卡的位置

public void SetScrollbarValue() { int columnCount;//有几列 int rowCountPerPage;//面板可看到的一页中块的排数 int nextLeveNum;//下一关的值 int totalLevelCount;//总关卡数 //下一关关卡在哪一排...

2020-01-17 16:42:25 1108

原创 JsonUtility储存多条信息并解析

//每个关卡过关情况[System.Serializable]public class PassLevel{ public int levelNum; public int isPass;}public class JsonData{ public List<PassLevel> PassLevelList = new List<PassLe...

2020-01-17 16:11:25 178

原创 unity 旋转向量,使其方向改变,大小不变

/// <summary> /// 旋转向量,使其方向改变,大小不变 /// </summary> /// <param name="v">需要旋转的向量</param> /// <param name="angle">旋转的角度</param> /// <returns>...

2020-01-13 16:07:25 2091

原创 Unity3D 本地数据持久化

一、Unity自带的JsonUtility数据保存和加载的类(将创建json和解析json放在了此类中)public static class SaveSystem{ /// <summary> /// 保存文件 /// </summary> /// <typeparam name="T">数据类型</typepara...

2019-12-26 14:34:30 247

原创 unity发射球并显示球运动的路径

using UnityEngine;using System.Collections;using System.Collections.Generic;public class Ball : MonoBehaviour{ public GameObject ball;//要作用的物体 public float power = 5;//力 public int d...

2019-12-20 15:04:49 500

原创 unity中Vector2.SignedAngle与 Vector2.Angle的范围值

一个向量与Vector.right的夹角Vector2.Angle第一象限:0~90第二象限:90~180第三象限:180~90第四象限:90~0Vector2.SignedAngle第一象限:0 ~ -90第二象限:-90 ~ -180第三象限:180 ~ 90第四象限:90 ~ 0...

2019-12-17 15:06:00 5996 2

原创 unity A Star寻路算法

using System;using System.Collections;using System.Collections.Generic;using UnityEngine;public class AStar : MonoBehaviour{ private static AStar _instance; public static AStar Inst() { ...

2019-12-11 15:24:32 199

原创 判断物体是否在屏幕内

private bool IsInView(){Vector2 viewPos = Camera.main.WorldToViewportPoint(transform.position);if (viewPos.x >= 0 && viewPos.x <= 1 && viewPos.y >= 0 && viewPos.y &...

2019-12-09 14:48:13 645

原创 unity精灵的屏幕适配

using System.Collections;using System.Collections.Generic;using UnityEngine;public class AdaptiveScreen : MonoBehaviour{ private const int standardScreenHeight = 1920; //屏幕初始分辨率 height ...

2019-12-05 17:15:40 270

原创 已知一个向量,计算向量上的某个点的坐标

。。。

2019-12-02 15:28:23 4690

原创 LineRenderer画虚线

。。。

2019-11-27 13:49:15 2777

原创 给LineRenderer加重力效果

肯定要先给LineRenderer加碰撞体和刚体,然后修改LineRenderer组件的Use World Space为false

2019-11-26 18:00:12 187

原创 对物体的Collider2D进行操作时,不用得到具体的Collider2D的类型

比如物体有一个CircleCollider2D的组件,另一个物体有一个BoxCollider2D的组件,当想要同时在代码中勾选两者的isTrigger属性时,直接getComponent().isTrigger=true;就行了,不用分别得到物体的CircleCollider2D或者BoxCollider2D在修改属性...

2019-11-21 14:42:51 611

原创 unity2d 物理引擎Effector2D

1.PointEffector2D,模拟2D排斥与吸引效果。2.SurfaceEffector2D,模拟2D物体表面方向力。3.AreaEffector2D,模拟2D物体内部一个方向力。4.PlatformEffector2D,模拟2D 物体平台的方向通过性。5.Buoyancy Effector2D,模拟2D浮力效果。...

2019-11-21 14:18:27 1127

原创 物体跟随鼠标旋转

void Update(){ Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector3 mousePos = new Vector3(pos.x, pos.y, 0); obj.transform.up -= (mousePos - obj.transform.position).normaliz...

2019-11-19 15:01:43 417

原创 unity编辑器扩展总结

using UnityEngine;using UnityEditor;//CustomEditor(typeof()) 用于关联自定义的脚本[CustomEditor(typeof(LevelEditor))]public class MyCustomEditor : Editor{ LevelEditor levelEditor; //每次点击挂载LevelEditor脚本...

2019-11-08 17:59:56 388

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除