SlideShare a Scribd company logo
Cross Platform Game
Development
WITH UNITY3D AND C#
Who
Jerel R Hass
@agies1
agies1@Hotmail.com
What
Introduction to developing production quality video games with Unity3D and C#
◦ Explore the Unity3D Interface
◦ Developing on a PC or Mac
◦ Unity and C#
◦ Scenes
◦ GameObjects
◦ Components
◦ Scripts
◦ Deployment
◦ PC/Mac
◦ Mobile
Why
You have been training for this your
whole career!
The Setup
Download and Install Unity3D
◦ http://unity3d.com/unity/download (Hopefully I have brought along thumb drives)
PC/MAC
◦ A Web Browser
iOS
◦ Xcode
Android
◦ Android SDK and JDK
WP8
◦ WP8 SDK
Most Importantly Have an Idea
Additional Tools
Image Editor
◦ Photoshop, Gimp, Paint.Net
Video Editor
◦ Adobe Premiere, Lightworks
3D Editor
◦ 3ds Max, Blender
Sound Editor
◦ Adobe Audition, Audacity
Unity 3D
Let us build a Voxel Engine
Unity3D Tour
INTEGRATED EDITOR OVERVIEW
Adding to the Scene
Let us begin doing something!
◦ Examine the Camera
◦ Add a GameObject (Cube) to the Hierarchy
◦ View the Cube within the Scene
◦ View the Cube within the Game
◦ View the Cube within the Inspector
◦ View the Cube’s Gizmos
◦ Manipulate the Cube with the Transform Tools (Pan, Transform, Rotate, Scale)
Project Browser
Highlights
• Assets
• Preview
• Favorites
• Search
Hierarchy
• Contains all GameObjects in the current
scene.
• Shows Parenting
• Inherits movement and rotation
Inspector
• GameObjects are made up of
multiple Components
• Public Properties of the
Components can be manipulated
• Icons
Game
The Game View is rendered from the Camera(s) in your game.
Scene
The Scene View is your primary interaction surface with Unity
GameObjects
Every object in your game is a GameObject
Without Components GameObjects are more of an organizational tool using Parenting
GameObjects contain Components
All GameObjects contain a Transform Components
◦ Transform Components tell Unity where to put the GameObject in the Scene, more later
◦ Transform are essential for Parenting
Components
Components are the functional pieces of every GameObject.
Component Properties can be changed by the Editor or Scripts.
Components can be; Added, Copied, Removed, Reordered, Reset, and Required
Unity tries to choose the best Editor for the Properties. Hints or Custom Editors can be used with
Properties to make the Inspector incredibly useful.
!Important: Changes made to the Unity while Running the Game are reverted once the Game is
stopped. More on this when start looking at Scripts.
Component Cont.
Goal
◦ Add a GameObject whose Mesh we can tile and
manipulate later
Setup
◦ Add a New GameObject (Ctrl+Shift+N)
◦ Name it Chunk
◦ Add a Components to Chunk
◦ Mesh Filter
◦ Mesh Render
◦ Mesh Colider
◦ Transform Chunk to 0,0,10
Adding Behaviors
USING VISUAL STUDIO OR MONODEVELOP
C# Scripts - MonoBehaviors
Scripts
◦ All Component Scripts must inherit from
MonoBehaviour
◦ Standard CLR classes/structs can be created and
used by MonoBehaviours
◦ Public Properties are exposed to the Inspectors
◦ Known Event Methods are called by Unity,
without needing to Override
◦ Awake: Called when the script instance is being loaded
◦ Start: Called before the object’s first frame update
◦ Update: Called before a frame update
◦ Many More…
C# Scripts – PolygonGenerator – Class
Goal
◦ Use a Script to hold our mesh geometry
Setup
◦ Create a Folder named “Scripts”
◦ Create a Folder in “Scripts” Named “Generators”
◦ Create a Script named “PolygonGenerator”
◦ Drag “PolygonGenerator” onto “Chunk”
◦ Create Structures to hold the new Mesh
Geometry
◦ Create a cache to hold the GameObjects Mesh
C# Scripts – PolygonGenerator – Events
Goal
◦ Using our structure using Unity’s Events to draw
our mesh
Setup
◦ Get the Mesh from the Parent
◦ Determine the position of the Parent
◦ Add Vertices around the current Position
◦ Add Triangles in order
◦ Add our new structures to the GameObjects
Mesh
Look A Polygon
Run Unity Ctrl+P
Assets
Goal
◦ Add Art we can use to draw on our Mesh
Add a Piece of Art for Materials named “tiles”
◦ This will be our Tile Sheet, it is 128x128 with sixteen 32x32
tiles; simple numbers make for easy math later.
◦ Advanced - Select this when you want to have specific
parameters on your texture and you want to have total
control over your texture.
◦ Filter Mode - Selects how the Texture is filtered when it
gets stretched by 3D transformations:
◦ Point - The Texture becomes blocky up close
◦ Generate Mip Maps - Select this to enable mip-map
generation. Mip maps are smaller versions of the texture
that get used when the texture is very small on screen. See
the Details section at the end of the page.
◦ Drag tiles on to “Chunk”
Visual Properties
Goal
◦ Add a few public properties to change at
Runtime
Setup
◦ Add UV code to script
Visual Properties Cont.
Goal
◦ Change the Chosen Texture
Setup
◦ Run the Game
◦ Use the Inspector to change values of Chosen
Texture
◦ From 0,0
◦ To 0,3
C# Scripts – PolygonGenerator – Terrain
Goal
◦ Extend our simple polygon to a whole terrain of
polygon
Setup
◦ Create a 2 Dimensional array to hold the block
textures
◦ Change our generation to Generate Squares
◦ Count the squares
◦ Randomize the Terrain
◦ Build the Mesh
C# Scripts – PolygonGenerator – Noise
Goal
◦ Use a Unity Function to add some noise to our
boring Voxel
Setup
◦ We are going to call the Math.PerlinNoise
method to generate some pseudo-random
patterns.
Importing Packages – AKA Having a Ball
Goal
◦ Add something interactive in the game using the
Packages
Setup
◦ Asset -> Import -> Standard Assets (Mobile)
◦ Import everything
◦ Project -> Standard Assets (Mobile) -> Prefabs ->
Roll A Ball
◦ Reset
◦ Drop Camera in the Roll A Ball
◦ Transform Chunk to -15,-120,0
◦ Roll A Ball -> Rigidbody -> Constrain Position Z
◦ Prepare to be Dizzy
A Game with Bounce
Goal
◦ Add some interaction and glance at using Inputs
in Unity
Setup
◦ Disable the Roll A Ball Script
◦ That will keep the Start and Update Events from occuring
◦ Create Script Named “TapToBounce”
◦ Start with Grabbing the Owners RigidBody
◦ During the Update check in MouseButton 0 was
lifted
◦ This will translate to the First Touch up in Mobile
◦ When Touch is lifted AddForce to the RigidBody
Unity Remote
ANDROID IOS
Exporting the Web
Lets Take our app and ship it out to the Web
◦ Ctrl+Shift+B
◦ Add Current (to add the current scene)
◦ Platform Web Player
◦ Switch Platform (if your current platform isn’t
web)
◦ Create Folder “Web”
◦ Build And Run
Exporting to Mobile
Well the web was nice, now lets kick it out to
Android
◦ Create a Bundle Identifier
◦ Ctrl+Shift+B
◦ Platform Android
◦ Switch Platform (if your current platform isn’t
Android)
◦ Create Folder “Android”
◦ Build And Run
Where
Unity3D Tutorials
◦ http://unity3d.com/learn
Asset Store
◦ https://www.assetstore.unity3d.com/
To Go Next?
Questions?
COMMENTS

More Related Content

What's hot

2013-05-15 threads. why and how
2013-05-15 threads. why and how2013-05-15 threads. why and how
2013-05-15 threads. why and howCocoaHeads Tricity
 
The Ring programming language version 1.5.1 book - Part 48 of 180
The Ring programming language version 1.5.1 book - Part 48 of 180The Ring programming language version 1.5.1 book - Part 48 of 180
The Ring programming language version 1.5.1 book - Part 48 of 180
Mahmoud Samir Fayed
 
2nd cfp 2ndstage
2nd cfp 2ndstage2nd cfp 2ndstage
2nd cfp 2ndstage
s1210079
 
The Ring programming language version 1.8 book - Part 56 of 202
The Ring programming language version 1.8 book - Part 56 of 202The Ring programming language version 1.8 book - Part 56 of 202
The Ring programming language version 1.8 book - Part 56 of 202
Mahmoud Samir Fayed
 
New 2D World-Building, Animation & Graphics Features in Unity
New 2D World-Building, Animation & Graphics Features in UnityNew 2D World-Building, Animation & Graphics Features in Unity
New 2D World-Building, Animation & Graphics Features in Unity
Unity Technologies
 
Gaming with FME
Gaming with FMEGaming with FME
Gaming with FME
Safe Software
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine Basics
Nick Pruehs
 
Game salad problems
Game salad problemsGame salad problems
Game salad problemsSilverr3aver
 
Unreal Technology
Unreal TechnologyUnreal Technology
Unreal Technology
Mohammed Safwat
 
The Ring programming language version 1.2 book - Part 37 of 84
The Ring programming language version 1.2 book - Part 37 of 84The Ring programming language version 1.2 book - Part 37 of 84
The Ring programming language version 1.2 book - Part 37 of 84
Mahmoud Samir Fayed
 

What's hot (12)

2013-05-15 threads. why and how
2013-05-15 threads. why and how2013-05-15 threads. why and how
2013-05-15 threads. why and how
 
The Ring programming language version 1.5.1 book - Part 48 of 180
The Ring programming language version 1.5.1 book - Part 48 of 180The Ring programming language version 1.5.1 book - Part 48 of 180
The Ring programming language version 1.5.1 book - Part 48 of 180
 
2nd cfp 2ndstage
2nd cfp 2ndstage2nd cfp 2ndstage
2nd cfp 2ndstage
 
The Ring programming language version 1.8 book - Part 56 of 202
The Ring programming language version 1.8 book - Part 56 of 202The Ring programming language version 1.8 book - Part 56 of 202
The Ring programming language version 1.8 book - Part 56 of 202
 
New 2D World-Building, Animation & Graphics Features in Unity
New 2D World-Building, Animation & Graphics Features in UnityNew 2D World-Building, Animation & Graphics Features in Unity
New 2D World-Building, Animation & Graphics Features in Unity
 
Showreel
ShowreelShowreel
Showreel
 
Soc research
Soc researchSoc research
Soc research
 
Gaming with FME
Gaming with FMEGaming with FME
Gaming with FME
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine Basics
 
Game salad problems
Game salad problemsGame salad problems
Game salad problems
 
Unreal Technology
Unreal TechnologyUnreal Technology
Unreal Technology
 
The Ring programming language version 1.2 book - Part 37 of 84
The Ring programming language version 1.2 book - Part 37 of 84The Ring programming language version 1.2 book - Part 37 of 84
The Ring programming language version 1.2 book - Part 37 of 84
 

Similar to Cross platform game development

Unity workshop
Unity workshopUnity workshop
Unity workshop
fsxflyer789Productio
 
Cardboard VR: Building Low Cost VR Experiences
Cardboard VR: Building Low Cost VR ExperiencesCardboard VR: Building Low Cost VR Experiences
Cardboard VR: Building Low Cost VR Experiences
Mark Billinghurst
 
Tools for developing Android Games
 Tools for developing Android Games Tools for developing Android Games
Tools for developing Android Games
Platty Soft
 
Developing VR Experiences with Unity
Developing VR Experiences with UnityDeveloping VR Experiences with Unity
Developing VR Experiences with Unity
Mark Billinghurst
 
38199728 multi-player-tutorial
38199728 multi-player-tutorial38199728 multi-player-tutorial
38199728 multi-player-tutorial
alfrecaay
 
Unity Google VR Cardboard Deployment on iOS and Android
Unity Google VR Cardboard Deployment on iOS and AndroidUnity Google VR Cardboard Deployment on iOS and Android
Unity Google VR Cardboard Deployment on iOS and Android
Kobkrit Viriyayudhakorn
 
Cocos2d for beginners
Cocos2d for beginnersCocos2d for beginners
Cocos2d for beginners
Azukisoft Pte Ltd
 
Building VR Applications For Google Cardboard
Building VR Applications For Google CardboardBuilding VR Applications For Google Cardboard
Building VR Applications For Google Cardboard
Mark Billinghurst
 
Mobile AR Lecture6 - Introduction to Unity 3D
Mobile AR Lecture6 - Introduction to Unity 3DMobile AR Lecture6 - Introduction to Unity 3D
Mobile AR Lecture6 - Introduction to Unity 3D
Mark Billinghurst
 
Getting started with Verold and Three.js
Getting started with Verold and Three.jsGetting started with Verold and Three.js
Getting started with Verold and Three.jsVerold
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
Unite2017Tokyo
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
Unity Technologies Japan K.K.
 
Unity3d scripting tutorial
Unity3d scripting tutorialUnity3d scripting tutorial
Unity3d scripting tutorial
hungnttg
 
Easy coding a multi device game with FireMonkey
Easy coding a multi device game with FireMonkeyEasy coding a multi device game with FireMonkey
Easy coding a multi device game with FireMonkey
pprem
 
Lecture2_practice.pdf
Lecture2_practice.pdfLecture2_practice.pdf
Lecture2_practice.pdf
HusseinAlmulla1
 
BYOD: Build Your First VR Experience with Unreal Engine
BYOD: Build Your First VR Experience with Unreal EngineBYOD: Build Your First VR Experience with Unreal Engine
BYOD: Build Your First VR Experience with Unreal Engine
Michael Sheyahshe
 
Workingwithunity 110519054824-phpapp01
Workingwithunity 110519054824-phpapp01Workingwithunity 110519054824-phpapp01
Workingwithunity 110519054824-phpapp01
Srijib Roy
 
Unity Introduction
Unity IntroductionUnity Introduction
Unity Introduction
Juwal Bose
 
2%20-%20Scripting%20Tutorial
2%20-%20Scripting%20Tutorial2%20-%20Scripting%20Tutorial
2%20-%20Scripting%20Tutorialtutorialsruby
 

Similar to Cross platform game development (20)

Unity workshop
Unity workshopUnity workshop
Unity workshop
 
Cardboard VR: Building Low Cost VR Experiences
Cardboard VR: Building Low Cost VR ExperiencesCardboard VR: Building Low Cost VR Experiences
Cardboard VR: Building Low Cost VR Experiences
 
Tools for developing Android Games
 Tools for developing Android Games Tools for developing Android Games
Tools for developing Android Games
 
Developing VR Experiences with Unity
Developing VR Experiences with UnityDeveloping VR Experiences with Unity
Developing VR Experiences with Unity
 
38199728 multi-player-tutorial
38199728 multi-player-tutorial38199728 multi-player-tutorial
38199728 multi-player-tutorial
 
Unity Google VR Cardboard Deployment on iOS and Android
Unity Google VR Cardboard Deployment on iOS and AndroidUnity Google VR Cardboard Deployment on iOS and Android
Unity Google VR Cardboard Deployment on iOS and Android
 
Cocos2d for beginners
Cocos2d for beginnersCocos2d for beginners
Cocos2d for beginners
 
Building VR Applications For Google Cardboard
Building VR Applications For Google CardboardBuilding VR Applications For Google Cardboard
Building VR Applications For Google Cardboard
 
Mobile AR Lecture6 - Introduction to Unity 3D
Mobile AR Lecture6 - Introduction to Unity 3DMobile AR Lecture6 - Introduction to Unity 3D
Mobile AR Lecture6 - Introduction to Unity 3D
 
Getting started with Verold and Three.js
Getting started with Verold and Three.jsGetting started with Verold and Three.js
Getting started with Verold and Three.js
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
 
Unity3d scripting tutorial
Unity3d scripting tutorialUnity3d scripting tutorial
Unity3d scripting tutorial
 
Easy coding a multi device game with FireMonkey
Easy coding a multi device game with FireMonkeyEasy coding a multi device game with FireMonkey
Easy coding a multi device game with FireMonkey
 
Lecture2_practice.pdf
Lecture2_practice.pdfLecture2_practice.pdf
Lecture2_practice.pdf
 
BYOD: Build Your First VR Experience with Unreal Engine
BYOD: Build Your First VR Experience with Unreal EngineBYOD: Build Your First VR Experience with Unreal Engine
BYOD: Build Your First VR Experience with Unreal Engine
 
Workingwithunity 110519054824-phpapp01
Workingwithunity 110519054824-phpapp01Workingwithunity 110519054824-phpapp01
Workingwithunity 110519054824-phpapp01
 
Unity Introduction
Unity IntroductionUnity Introduction
Unity Introduction
 
Unity 3d scripting tutorial
Unity 3d scripting tutorialUnity 3d scripting tutorial
Unity 3d scripting tutorial
 
2%20-%20Scripting%20Tutorial
2%20-%20Scripting%20Tutorial2%20-%20Scripting%20Tutorial
2%20-%20Scripting%20Tutorial
 

Recently uploaded

Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 

Recently uploaded (20)

Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 

Cross platform game development

  • 3. What Introduction to developing production quality video games with Unity3D and C# ◦ Explore the Unity3D Interface ◦ Developing on a PC or Mac ◦ Unity and C# ◦ Scenes ◦ GameObjects ◦ Components ◦ Scripts ◦ Deployment ◦ PC/Mac ◦ Mobile
  • 4. Why You have been training for this your whole career!
  • 5. The Setup Download and Install Unity3D ◦ http://unity3d.com/unity/download (Hopefully I have brought along thumb drives) PC/MAC ◦ A Web Browser iOS ◦ Xcode Android ◦ Android SDK and JDK WP8 ◦ WP8 SDK Most Importantly Have an Idea
  • 6. Additional Tools Image Editor ◦ Photoshop, Gimp, Paint.Net Video Editor ◦ Adobe Premiere, Lightworks 3D Editor ◦ 3ds Max, Blender Sound Editor ◦ Adobe Audition, Audacity
  • 7. Unity 3D Let us build a Voxel Engine
  • 9. Adding to the Scene Let us begin doing something! ◦ Examine the Camera ◦ Add a GameObject (Cube) to the Hierarchy ◦ View the Cube within the Scene ◦ View the Cube within the Game ◦ View the Cube within the Inspector ◦ View the Cube’s Gizmos ◦ Manipulate the Cube with the Transform Tools (Pan, Transform, Rotate, Scale)
  • 10. Project Browser Highlights • Assets • Preview • Favorites • Search
  • 11. Hierarchy • Contains all GameObjects in the current scene. • Shows Parenting • Inherits movement and rotation
  • 12. Inspector • GameObjects are made up of multiple Components • Public Properties of the Components can be manipulated • Icons
  • 13. Game The Game View is rendered from the Camera(s) in your game.
  • 14. Scene The Scene View is your primary interaction surface with Unity
  • 15. GameObjects Every object in your game is a GameObject Without Components GameObjects are more of an organizational tool using Parenting GameObjects contain Components All GameObjects contain a Transform Components ◦ Transform Components tell Unity where to put the GameObject in the Scene, more later ◦ Transform are essential for Parenting
  • 16. Components Components are the functional pieces of every GameObject. Component Properties can be changed by the Editor or Scripts. Components can be; Added, Copied, Removed, Reordered, Reset, and Required Unity tries to choose the best Editor for the Properties. Hints or Custom Editors can be used with Properties to make the Inspector incredibly useful. !Important: Changes made to the Unity while Running the Game are reverted once the Game is stopped. More on this when start looking at Scripts.
  • 17. Component Cont. Goal ◦ Add a GameObject whose Mesh we can tile and manipulate later Setup ◦ Add a New GameObject (Ctrl+Shift+N) ◦ Name it Chunk ◦ Add a Components to Chunk ◦ Mesh Filter ◦ Mesh Render ◦ Mesh Colider ◦ Transform Chunk to 0,0,10
  • 18. Adding Behaviors USING VISUAL STUDIO OR MONODEVELOP
  • 19. C# Scripts - MonoBehaviors Scripts ◦ All Component Scripts must inherit from MonoBehaviour ◦ Standard CLR classes/structs can be created and used by MonoBehaviours ◦ Public Properties are exposed to the Inspectors ◦ Known Event Methods are called by Unity, without needing to Override ◦ Awake: Called when the script instance is being loaded ◦ Start: Called before the object’s first frame update ◦ Update: Called before a frame update ◦ Many More…
  • 20. C# Scripts – PolygonGenerator – Class Goal ◦ Use a Script to hold our mesh geometry Setup ◦ Create a Folder named “Scripts” ◦ Create a Folder in “Scripts” Named “Generators” ◦ Create a Script named “PolygonGenerator” ◦ Drag “PolygonGenerator” onto “Chunk” ◦ Create Structures to hold the new Mesh Geometry ◦ Create a cache to hold the GameObjects Mesh
  • 21. C# Scripts – PolygonGenerator – Events Goal ◦ Using our structure using Unity’s Events to draw our mesh Setup ◦ Get the Mesh from the Parent ◦ Determine the position of the Parent ◦ Add Vertices around the current Position ◦ Add Triangles in order ◦ Add our new structures to the GameObjects Mesh
  • 22. Look A Polygon Run Unity Ctrl+P
  • 23. Assets Goal ◦ Add Art we can use to draw on our Mesh Add a Piece of Art for Materials named “tiles” ◦ This will be our Tile Sheet, it is 128x128 with sixteen 32x32 tiles; simple numbers make for easy math later. ◦ Advanced - Select this when you want to have specific parameters on your texture and you want to have total control over your texture. ◦ Filter Mode - Selects how the Texture is filtered when it gets stretched by 3D transformations: ◦ Point - The Texture becomes blocky up close ◦ Generate Mip Maps - Select this to enable mip-map generation. Mip maps are smaller versions of the texture that get used when the texture is very small on screen. See the Details section at the end of the page. ◦ Drag tiles on to “Chunk”
  • 24. Visual Properties Goal ◦ Add a few public properties to change at Runtime Setup ◦ Add UV code to script
  • 25. Visual Properties Cont. Goal ◦ Change the Chosen Texture Setup ◦ Run the Game ◦ Use the Inspector to change values of Chosen Texture ◦ From 0,0 ◦ To 0,3
  • 26. C# Scripts – PolygonGenerator – Terrain Goal ◦ Extend our simple polygon to a whole terrain of polygon Setup ◦ Create a 2 Dimensional array to hold the block textures ◦ Change our generation to Generate Squares ◦ Count the squares ◦ Randomize the Terrain ◦ Build the Mesh
  • 27. C# Scripts – PolygonGenerator – Noise Goal ◦ Use a Unity Function to add some noise to our boring Voxel Setup ◦ We are going to call the Math.PerlinNoise method to generate some pseudo-random patterns.
  • 28. Importing Packages – AKA Having a Ball Goal ◦ Add something interactive in the game using the Packages Setup ◦ Asset -> Import -> Standard Assets (Mobile) ◦ Import everything ◦ Project -> Standard Assets (Mobile) -> Prefabs -> Roll A Ball ◦ Reset ◦ Drop Camera in the Roll A Ball ◦ Transform Chunk to -15,-120,0 ◦ Roll A Ball -> Rigidbody -> Constrain Position Z ◦ Prepare to be Dizzy
  • 29. A Game with Bounce Goal ◦ Add some interaction and glance at using Inputs in Unity Setup ◦ Disable the Roll A Ball Script ◦ That will keep the Start and Update Events from occuring ◦ Create Script Named “TapToBounce” ◦ Start with Grabbing the Owners RigidBody ◦ During the Update check in MouseButton 0 was lifted ◦ This will translate to the First Touch up in Mobile ◦ When Touch is lifted AddForce to the RigidBody
  • 31. Exporting the Web Lets Take our app and ship it out to the Web ◦ Ctrl+Shift+B ◦ Add Current (to add the current scene) ◦ Platform Web Player ◦ Switch Platform (if your current platform isn’t web) ◦ Create Folder “Web” ◦ Build And Run
  • 32. Exporting to Mobile Well the web was nice, now lets kick it out to Android ◦ Create a Bundle Identifier ◦ Ctrl+Shift+B ◦ Platform Android ◦ Switch Platform (if your current platform isn’t Android) ◦ Create Folder “Android” ◦ Build And Run
  • 33. Where Unity3D Tutorials ◦ http://unity3d.com/learn Asset Store ◦ https://www.assetstore.unity3d.com/ To Go Next?

Editor's Notes

  1. The Mesh is the detailed geometry of your GameObject The Mesh Filter takes a mesh from your assets and passes it to the Mesh Renderer for rendering on the screen. The Mesh Renderer takes the geometry from the Mesh Filter and renders it at the position defined by the object's Transform component. The Mesh Collider takes a Mesh Asset and builds its Collider based on that mesh. It is far more accurate for collision detection than using primitives for complicated meshes.
  2. using System.Collections.Generic; using UnityEngine; using System.Collections; public class PolygonGenerator : MonoBehaviour { protected List<Vector3> newVertices = new List<Vector3>(); protected List<int> newTriangles = new List<int>(); protected List<Vector2> newUV = new List<Vector2>(); private Mesh mesh; private void Start() { mesh = GetComponent<MeshFilter>().mesh; float x = transform.position.x; float y = transform.position.y; float z = transform.position.z; newVertices.Add(new Vector3(x, y, z)); newVertices.Add(new Vector3(x + 1, y, z)); newVertices.Add(new Vector3(x + 1, y - 1, z)); newVertices.Add(new Vector3(x, y - 1, z)); newTriangles.Add(0); newTriangles.Add(1); newTriangles.Add(3); newTriangles.Add(1); newTriangles.Add(2); newTriangles.Add(3); mesh.Clear(); mesh.vertices = newVertices.ToArray(); mesh.triangles = newTriangles.ToArray(); mesh.Optimize(); mesh.RecalculateNormals(); } void Update () { } }
  3. using System.Collections.Generic; using UnityEngine; using System.Collections; public class PolygonGenerator : MonoBehaviour { protected List<Vector3> newVertices = new List<Vector3>(); protected List<int> newTriangles = new List<int>(); protected List<Vector2> newUV = new List<Vector2>(); private Mesh mesh; private float textureUnit = 0.25f; public Vector2 chosenTexture; private void Start() { mesh = GetComponent<MeshFilter>().mesh; float x = transform.position.x; float y = transform.position.y; float z = transform.position.z; newVertices.Add(new Vector3(x, y, z)); newVertices.Add(new Vector3(x + 1, y, z)); newVertices.Add(new Vector3(x + 1, y - 1, z)); newVertices.Add(new Vector3(x, y - 1, z)); newTriangles.Add(0); newTriangles.Add(1); newTriangles.Add(3); newTriangles.Add(1); newTriangles.Add(2); newTriangles.Add(3); newUV.Add(new Vector2(textureUnit * chosenTexture.x, textureUnit * chosenTexture.y + textureUnit)); newUV.Add(new Vector2(textureUnit * chosenTexture.x + textureUnit, textureUnit * chosenTexture.y + textureUnit)); newUV.Add(new Vector2(textureUnit * chosenTexture.x + textureUnit, textureUnit * chosenTexture.y)); newUV.Add(new Vector2(textureUnit * chosenTexture.x, textureUnit * chosenTexture.y)); mesh.Clear(); mesh.vertices = newVertices.ToArray(); mesh.triangles = newTriangles.ToArray(); mesh.uv = newUV.ToArray(); mesh.Optimize(); mesh.RecalculateNormals(); } void Update () { newUV.Clear(); newUV.Add(new Vector2(textureUnit * chosenTexture.x, textureUnit * chosenTexture.y + textureUnit)); newUV.Add(new Vector2(textureUnit * chosenTexture.x + textureUnit, textureUnit * chosenTexture.y + textureUnit)); newUV.Add(new Vector2(textureUnit * chosenTexture.x + textureUnit, textureUnit * chosenTexture.y)); newUV.Add(new Vector2(textureUnit * chosenTexture.x, textureUnit * chosenTexture.y)); mesh.Clear(); mesh.vertices = newVertices.ToArray(); mesh.triangles = newTriangles.ToArray(); mesh.uv = newUV.ToArray(); mesh.Optimize(); mesh.RecalculateNormals(); } }
  4. using System.Collections.Generic; using UnityEngine; using System.Collections; public class PolygonGenerator : MonoBehaviour { protected List<Vector3> newVertices = new List<Vector3>(); protected List<int> newTriangles = new List<int>(); protected List<Vector2> newUV = new List<Vector2>(); private Mesh mesh; private float textureUnit = 0.25f; public int squareCount; private Vector2?[,] blocks; private void Start() { mesh = GetComponent<MeshFilter>().mesh; GenerateTerrain(); BuildMesh(); UpdateMesh(); } private void UpdateMesh() { mesh.Clear(); mesh.vertices = newVertices.ToArray(); mesh.triangles = newTriangles.ToArray(); mesh.uv = newUV.ToArray(); mesh.Optimize(); mesh.RecalculateNormals(); squareCount = 0; newVertices.Clear(); newTriangles.Clear(); newUV.Clear(); } private void BuildMesh() { for (int px = 0; px < blocks.GetLength(0); px++) { for (int py = 0; py < blocks.GetLength(1); py++) { GenerateSquare(px, py, blocks[px, py]); } } } private void GenerateSquare(int x, int y, Vector2? tex) { if (tex == null) return; var texture = tex.Value; newVertices.Add(new Vector3(x, y, 0)); newVertices.Add(new Vector3(x + 1, y, 0)); newVertices.Add(new Vector3(x + 1, y - 1, 0)); newVertices.Add(new Vector3(x, y - 1, 0)); newTriangles.Add(squareCount * 4); newTriangles.Add((squareCount * 4) + 1); newTriangles.Add((squareCount * 4) + 3); newTriangles.Add((squareCount * 4) + 1); newTriangles.Add((squareCount * 4) + 2); newTriangles.Add((squareCount * 4) + 3); newUV.Add(new Vector2(textureUnit * texture.x, textureUnit * texture.y + textureUnit)); newUV.Add(new Vector2(textureUnit * texture.x + textureUnit, textureUnit * texture.y + textureUnit)); newUV.Add(new Vector2(textureUnit * texture.x + textureUnit, textureUnit * texture.y)); newUV.Add(new Vector2(textureUnit * texture.x, textureUnit * texture.y)); squareCount++; } private void GenerateTerrain() { blocks = new Vector2?[20,8]; for (int px = 0; px < blocks.GetLength(0); px++) { for (int py = 0; py < blocks.GetLength(1); py++) { if (py == 5) { blocks[px, py] = new Vector2(1, Random.Range(0,4)); } else if (py < 5) { blocks[px, py] = new Vector2(0, Random.Range(0, 4)); } } } } void Update() { } }
  5. using UnityEngine; using System.Collections; using System.Collections.Generic; public class PolygonGenerator : MonoBehaviour { private List<Vector3> newVertices = new List<Vector3>(); private List<int> newTriangles = new List<int>(); private List<Vector2> newUV = new List<Vector2>(); private List<Vector3> colVertices = new List<Vector3>(); private List<int> colTriangles = new List<int>(); private int colCount; private Mesh mesh; private MeshCollider col; private float textureUnit = 0.25f; private Vector2 textureDirt = new Vector2(0, 3); private Vector2 textureGrass = new Vector2(1, 3); public byte[,] blocks; private int squareCount; // Use this for initialization void Start() { mesh = GetComponent<MeshFilter>().mesh; col = GetComponent<MeshCollider>(); GenerateTerrain(); BuildMesh(); UpdateMesh(); } void Update() { } void GenerateTerrain() { blocks = new byte[96, 128]; for (int px = 0; px < blocks.GetLength(0); px++) { int stone = Noise(px, 0, 80, 15, 1); stone += Noise(px, 0, 50, 30, 1); stone += Noise(px, 0, 10, 10, 1); stone += 75; int dirt = Noise(px, 0, 100, 35, 1); dirt += Noise(px, 0, 50, 30, 1); dirt += 75; for (int py = 0; py < blocks.GetLength(1); py++) { if (py < stone) { blocks[px, py] = 1; } else if (py < dirt) { blocks[px, py] = 2; } } } } int Noise(int x, int y, float scale, float mag, float exp) { return (int)(Mathf.Pow((Mathf.PerlinNoise(x / scale, y / scale) * mag), (exp))); } void BuildMesh() { for (int px = 0; px < blocks.GetLength(0); px++) { for (int py = 0; py < blocks.GetLength(1); py++) { if (blocks[px, py] != 0) { GenerateCollider(px, py); if (blocks[px, py] == 1) { GenerateSquare(px, py, textureDirt); } else if (blocks[px, py] == 2) { GenerateSquare(px, py, textureGrass); } } } } } byte Block(int x, int y) { if (x == -1 || x == blocks.GetLength(0) || y == -1 || y == blocks.GetLength(1)) { return (byte)1; } return blocks[x, y]; } void GenerateCollider(int x, int y) { //Top if (Block(x, y + 1) == 0) { colVertices.Add(new Vector3(x, y, 1)); colVertices.Add(new Vector3(x + 1, y, 1)); colVertices.Add(new Vector3(x + 1, y, 0)); colVertices.Add(new Vector3(x, y, 0)); ColliderTriangles(); colCount++; } //bot if (Block(x, y - 1) == 0) { colVertices.Add(new Vector3(x, y - 1, 0)); colVertices.Add(new Vector3(x + 1, y - 1, 0)); colVertices.Add(new Vector3(x + 1, y - 1, 1)); colVertices.Add(new Vector3(x, y - 1, 1)); ColliderTriangles(); colCount++; } //left if (Block(x - 1, y) == 0) { colVertices.Add(new Vector3(x, y - 1, 1)); colVertices.Add(new Vector3(x, y, 1)); colVertices.Add(new Vector3(x, y, 0)); colVertices.Add(new Vector3(x, y - 1, 0)); ColliderTriangles(); colCount++; } //right if (Block(x + 1, y) == 0) { colVertices.Add(new Vector3(x + 1, y, 1)); colVertices.Add(new Vector3(x + 1, y - 1, 1)); colVertices.Add(new Vector3(x + 1, y - 1, 0)); colVertices.Add(new Vector3(x + 1, y, 0)); ColliderTriangles(); colCount++; } } void ColliderTriangles() { colTriangles.Add(colCount * 4); colTriangles.Add((colCount * 4) + 1); colTriangles.Add((colCount * 4) + 3); colTriangles.Add((colCount * 4) + 1); colTriangles.Add((colCount * 4) + 2); colTriangles.Add((colCount * 4) + 3); } void GenerateSquare(int x, int y, Vector2 texture) { newVertices.Add(new Vector3(x, y, 0)); newVertices.Add(new Vector3(x + 1, y, 0)); newVertices.Add(new Vector3(x + 1, y - 1, 0)); newVertices.Add(new Vector3(x, y - 1, 0)); newTriangles.Add(squareCount * 4); newTriangles.Add((squareCount * 4) + 1); newTriangles.Add((squareCount * 4) + 3); newTriangles.Add((squareCount * 4) + 1); newTriangles.Add((squareCount * 4) + 2); newTriangles.Add((squareCount * 4) + 3); newUV.Add(new Vector2(textureUnit * texture.x, textureUnit * texture.y + textureUnit)); newUV.Add(new Vector2(textureUnit * texture.x + textureUnit, textureUnit * texture.y + textureUnit)); newUV.Add(new Vector2(textureUnit * texture.x + textureUnit, textureUnit * texture.y)); newUV.Add(new Vector2(textureUnit * texture.x, textureUnit * texture.y)); squareCount++; } void UpdateMesh() { mesh.Clear(); mesh.vertices = newVertices.ToArray(); mesh.triangles = newTriangles.ToArray(); mesh.uv = newUV.ToArray(); mesh.Optimize(); mesh.RecalculateNormals(); newVertices.Clear(); newTriangles.Clear(); newUV.Clear(); squareCount = 0; var newMesh = new Mesh { vertices = colVertices.ToArray(), triangles = colTriangles.ToArray() }; col.sharedMesh = newMesh; colVertices.Clear(); colTriangles.Clear(); colCount = 0; } }
  6. private void BuildMesh() { for (int px = 0; px < blocks.GetLength(0); px++) { for (int py = 0; py < blocks.GetLength(1); py++) { GenerateSquare(px, py, blocks[px, py]); } } } private void GenerateTerrain() { blocks = new Vector2?[20,8]; for (int px = 0; px < blocks.GetLength(0); px++) { for (int py = 0; py < blocks.GetLength(1); py++) { if (py == 5) { blocks[px, py] = new Vector2(1, Random.Range(0,4)); } else if (py < 5) { blocks[px, py] = new Vector2(0, Random.Range(0, 4)); } } } }
  7. using System; using UnityEngine; using System.Collections; public class TapToBounce : MonoBehaviour { private Rigidbody ballRigidBody; void Start () { ballRigidBody = rigidbody; } void Update () { if (Input.GetMouseButtonUp(0) && Input.GetMouseButtonUp(1)) { Jump(); return; } //Left Mouse or First Touch if (Input.GetMouseButtonUp(0)) { Push(-1); } //Right Mouse or Second Touch if (Input.GetMouseButtonUp(1)) { Push(1); } } private void Push(int direction) { ballRigidBody.AddForce(5 * direction, 0, 0, ForceMode.Force); } private void Jump() { ballRigidBody.AddForce(0, 5, 0, ForceMode.VelocityChange); } }
  8. Great for testing, but always verify on the device!