本文主要是介绍unity Kinect 垃圾分类 体感互动,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
https://item.taobao.com/item.htm?spm=a2oq0.12575281.0.0.15d11debV1kIxe&ft=t&id=619995280132
最近自己制作了一个垃圾分类的体感互动项目和大家分享下点击观看视频获取项目源码
我用的是unity5.52
垃圾分类的类型
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public enum LaJiEnum
{//youhairiguangdengguan,chongdiandianchi,ranfajihe,guoqiyaowu,feiqiyoutong,shachongpenwuguan,xiaoduji,shachongji,shuiyinxueyaji,xijiashui,laoshuyao,nongyaojiqibaozhuangwu,feixiangzhi,shuiyinwenduji,geniedianchi,qianxudianchi,guoqizhijiayou,jienengdeng,shuiyintiwenji,feixguangpian,yingguangdengguan,niukoudianchi,yanghuagongdianchi,yapopinneibaozhuang,yaowujiaonang,yaopian,feiCTguangpian,feixiangzhidipian,//qitalajiwuranzhizhang,suliaoxiguan,yicixingcanju,shanbeike,yantouyanhui,shaoliangchengtu,LEDdeng,zhiniaoku,weishengzhi,taocicanju,baonuantie,yicixinggandianchi,taocibeiju,miaoqian,jiaodai,maofa,liulianke,yezike,kouxiangtang,baoxiandai,hailizike,wusunsuliaodai,hailuoke,yingxingyanjing,mianmo,kouzhao,gouniaodian,neiyiku,jiumaojin,dongwudakuaigutou,ganzaoji,ruanjiaoguan,//kehuishoulajibaozhi,feishukanzazhi,jinshucanju,jinshudaoju,kuaidixiangzi,yifukuzi,feijiudianshi,feijiudianxian,yilaguan,yinliaopin,jiupin,huapin,paomosuliao,bolicanju,menchuangboli,feishouji,jinshuluosi,xinfeng,chuanglian,mianbei,dayinzhi,kuangquanshupin,feisuliaowanju,xie,xifamoyupin,shiyongyoutong,xiangbao,maorongwanju,suliaowanpen,jinshubaozhuanghe,jinshuyijia,yanhe,//chuyulajicaijincaiye,shengcaishengfan,feiqishiyongyouzhi,gugeneizang,canzhiluoye,guopiguoke,shipintiaoliao,geleimianshi,guwujiqijiagongshipin,roudanjiqijiagongshipin,xietui,xiake,shuichanjiqijiagongshipin,suigu,chayezha,kafeizha,lingshi,geshiguantoushipin,chongwusiliao,shuiguoguorou,fenzhuangkeshiyongshipin,geshitiaoweipin,suiguojingzhi,guoshiguoke,shineihuahui,shineipenzai,danke,jiroufeiliao,guojiangfeiliao,jungufeiliao,youyufeiliao,jianguo}
public class LaJiItem : MonoBehaviour
{public string LaJiName;/// <summary>/// 垃圾类别/// </summary>public LaJiEnum currentLajiEnum;/// <summary>/// 正确的垃圾桶类别/// </summary>public LaJiTongEnum RightLajiTong;RectTransform rect;bool canwithHand = false;private void Start(){rect = transform.GetComponent<RectTransform>();}private void OnTriggerEnter2D(Collider2D collision){if (collision.name == "Image_Hand"){canwithHand = true;}elseif (collision.tag == "LaJiTong"){canwithHand = false;}}private void Update(){if (canwithHand){rect.position = GameManager.Instance.handRect.position;}}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;/// <summary>
/// 声音系统
/// </summary>
public class AudioManager : MonoBehaviour
{public static AudioManager Instance;/// <summary>/// 正确的音效/// </summary>public AudioClip audioClipRight;/// <summary>/// 错误的音效/// </summary>public AudioClip audioClipFalse;/// <summary>/// 声音播放器/// </summary>public AudioSource audioSource;// Use this for initialization/// <summary>/// 播放正确音效/// </summary>public void PlayRightAu(){audioSource.clip = audioClipRight;audioSource.Play();audioSource.volume = 0.2f;}/// <summary>/// 播放错误音效/// </summary>public void PlayFalseAu(){audioSource.clip = audioClipFalse;audioSource.Play();audioSource.volume = 1f;}void Start(){Instance = this;}}
https://item.taobao.com/item.htm?ft=t&id=619995280132
这篇关于unity Kinect 垃圾分类 体感互动的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!