Coder Social home page Coder Social logo

qn9663 / duckhunt-xlua Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lqyaphets/duckhunt-xlua

0.0 0.0 0.0 74.11 MB

本项目是基于XLua框架使用纯lua编写的打鸭子游戏,包含打鸭子核心玩法实现,移动端摇杆控制模块等元素。

C++ 0.08% Lua 0.02% C# 99.72% Batchfile 0.03% ShaderLab 0.15%

duckhunt-xlua's Introduction

DuckHunt-Xlua

要求

说明

Lua编程能力基于腾讯开源框架Xlua ,本项目是使用纯lua编写的打鸭子游戏,包含打鸭子核心玩法实现,移动端摇杆控制模块等元素。 项目已经generate code,如果报错,可以手动清空XLua/Gen文件夹下的生成代码,再手动生成。

举几个栗子

  • 基于Xlua框架,我们可以在Unity中使用lua和c#进行通讯,也即是代码热更新的基础,下面是基础的示例代码,具体完整案例参考项目工程源码。
--定义Unity对象
function onenable()  
	unity=CS.UnityEngine
end

--定义方法
function animatorIdle()
	lionAnimator:SetTrigger("toI")
end

--调用Unity API
local ray= unity.Camera.main:ScreenPointToRay(unity.Vector3(_screenPos.x,_screenPos.y,0))
local casthit= callCS:Raycast(ray,unity.Mathf.Infinity)
if(casthit.collider) then 
	chooseObj =casthit.collider.gameObject
	print(casthit.collider.name)
end

--注册使用Unity事件
btnIdle:GetComponent("Button").onClick:AddListener(function()   end)

--注册c#自定义事件
target:GetComponent("ARBoxLuaCollision"):EventEnter('+', CheckDuckFailDown)

来看看成果吧

duckhunt-xlua's People

Contributors

lqyaphets avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.