当前位置: 首页 > news >正文

html5网站模板下载推广赚钱app

html5网站模板下载,推广赚钱app,贵州省安顺市网站建设,wordpress 搬家出错通过网盘分享的文件:CubeMoveMusic.unitypackage 链接: https://pan.baidu.com/s/1Rq-HH4H9qzVNtpQ84WXyUA?pwda7xn 提取码: a7xn 运行游戏点击空格动态创建拉伸的方块,由Speed控制速度,新方向是随机上下左右生成。 using System.Collect…

通过网盘分享的文件:CubeMoveMusic.unitypackage
链接: https://pan.baidu.com/s/1Rq-HH4H9qzVNtpQ84WXyUA?pwd=a7xn 提取码: a7xn 

运行游戏点击空格动态创建拉伸的方块,由Speed控制速度,新方向是随机上下左右生成。 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class CubeMoveGameCamera : MonoBehaviour
{private Vector3 constDir;public GeneMap geneMap;void Start(){constDir = transform.position - geneMap.defaultPos;}// Update is called once per framevoid Update(){transform.position = constDir + geneMap.GetPos();}
}

生成移动方块以及单方向拉伸方块脚本:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class GeneMap : MonoBehaviour
{public enum Side{Top, Bottom, Left, Right}public GameObject cubePrefab;private GameObject movingCubeGo;private Transform movingCubeTrans;private Side moveSide;public Vector3 defaultPos;public float speed = 1f;private Matrix4x4 rotationMatrix4x4;private void Start(){rotationMatrix4x4 = Matrix4x4.TRS(Vector3.zero, cubePrefab.transform.localRotation, Vector3.one);}Side MirrorSide(Side side){if (side == Side.Top){return Side.Bottom;}if (side == Side.Bottom){return Side.Top;}if (side == Side.Left){return Side.Right;}if (side == Side.Right){return Side.Left;}Debug.LogError("?");return Side.Top;}public bool IsMoving(){return movingCubeGo != null;}public Vector3 GetPos(){Vector3 pos = defaultPos;if (IsMoving()){//利用上一个移动物体的方向,通过不同方向的移动物体局部大小得到偏移量,而0.5f是下一个新物体一半的偏移Vector3 oldOffset = Vector3.zero;switch (moveSide){case Side.Top:oldOffset = new Vector3(0, 0, movingCubeTrans.localScale.z - 0.5f);break;case Side.Bottom:oldOffset = new Vector3(0, 0, -movingCubeTrans.localScale.z + 0.5f);break;case Side.Left:oldOffset = new Vector3(-movingCubeTrans.localScale.x + 0.5f, 0, 0);break;case Side.Right://例如上一个物体是右方向,则使用局部大小x作为偏移量数值,并且需要-0.5f来让新物体的整体恰好在前一个延伸物体的内部。oldOffset = new Vector3(movingCubeTrans.localScale.x - 0.5f, 0, 0);break;default:break;}pos = movingCubeTrans.position + rotationMatrix4x4.MultiplyPoint(oldOffset);}return pos;}private void Update(){if (movingCubeGo != null){if (moveSide == Side.Top || moveSide == Side.Bottom){movingCubeTrans.localScale = new Vector3(1, 1, movingCubeTrans.localScale.z + speed * Time.deltaTime);}else{movingCubeTrans.localScale = new Vector3(movingCubeTrans.localScale.x + speed * Time.deltaTime, 1, 1);}}if (Input.GetKeyDown(KeyCode.Space)){Vector3 pos = GetPos();movingCubeGo = GameObject.Instantiate(cubePrefab);movingCubeTrans = movingCubeGo.transform;List<int> sideList = new List<int>();for (int i = 0; i < 4; i++){if (i != (int)moveSide && i != (int)MirrorSide(moveSide)){sideList.Add(i);}}int randomIndex = Random.Range(0, sideList.Count);moveSide = (Side)sideList[randomIndex];//1、新物体在进行朝着新方向移动时,需要对子物体Cube调整局部位置(目的:锚点轴心偏移,实现单方向延伸)//2、newOffset用于将新移动物体偏移到新移动方向的上一个物体边缘位置点Vector3 newOffset = Vector3.zero;Vector3 newLocalScale = Vector3.one;Transform childTrans = movingCubeTrans.Find("Cube");childTrans.GetComponent<MeshRenderer>().material.SetColor("_Color", new Color(Random.Range(0, 256) / 255f, Random.Range(0, 256) / 255f, Random.Range(0, 256) / 255f, 1));switch (moveSide){case Side.Top:childTrans.localPosition = new Vector3(0, 0, 0.5f);newOffset = new Vector3(0, 0, 0.5f);newLocalScale = new Vector3(1, 1, 0);break;case Side.Bottom:childTrans.localPosition = new Vector3(0, 0, -0.5f);newOffset = new Vector3(0, 0, -0.5f);newLocalScale = new Vector3(1, 1, 0);break;case Side.Left:childTrans.localPosition = new Vector3(-0.5f, 0, 0);newOffset = new Vector3(-0.5f, 0, 0);newLocalScale = new Vector3(0, 1, 1);break;case Side.Right://例如右方向的Cube子物体需要偏移(0.5f,0,0)保证锚点是在物体左侧childTrans.localPosition = new Vector3(0.5f, 0, 0);//右方向的新物体起点要在上一个物体的右侧边缘点作为起点,故x轴+0.5fnewOffset = new Vector3(0.5f, 0, 0);//右方向的新物体大小X轴要从0开始newLocalScale = new Vector3(0, 1, 1);break;default:break;}movingCubeTrans.position = pos + rotationMatrix4x4.MultiplyPoint(newOffset);movingCubeTrans.localScale = newLocalScale;}}
}
http://www.ds6.com.cn/news/68645.html

相关文章:

  • 罗湖商城网站建设哪家效益快百度指数查询官网入口
  • 做网站一般工资如何竞价排名是什么
  • 家居网站建设营销推广上海做关键词推广企业
  • 江西响应式网站制作短信营销
  • 十堰企业网站制作公司cpa游戏推广联盟
  • 网站做兼容处理怎么设置谷歌网站收录提交入口
  • 网站推广过程叙述徐州seo推广优化
  • 装修设计费收费标准处理事件seo软件
  • 做网站前期了解客户什么需求网站查询关键词排名软件
  • 哪些企业合适做网站整站seo外包
  • 政府网站建设投标书网上做推广怎么收费
  • 北京云建站模板武汉今日新闻头条
  • 泰州模板建站源码永久免费的网站服务器有哪些软件
  • 企业网站备案价格seoapp推广
  • iis网站属性在哪自媒体平台哪个收益高
  • 做打鱼网站的代理东莞seo建站排名
  • 淄博的大型网站建设搜索引擎营销分析
  • 怎么上传网站地图建站合肥网络公司seo
  • 企业网站如何优化网站运营工作的基本内容
  • 陕西城乡建设部网站首页百度知道个人中心
  • dnf怎么做钓鱼网站注册网站在哪里注册
  • 阿里 建设网站互联网营销顾问
  • 做网站都可以做什么广州百度推广电话
  • 垣曲做网站百度搜索引擎入口官网
  • 沾化网站建设软文案例大全
  • 自动发卡网站怎么做安卓手机优化大师官方下载
  • 帮别人做网站必须要开公司app拉新佣金排行榜
  • app下载做任务赚钱网站交换友情链接的途径有哪些
  • 江门网站制作最有效的恶意点击
  • 国家专业分类目录厦门seo关键词优化培训