# Unity Tanks Tutorial
## *Concepts Learned In Each Phase*
## Index
1. [Scene Setup](#01-scene-setup)
2. [Tank Creation & Control](#02-tank-creation--control)
3. [Camera Control](#03-camera-control)
4. [Tank Control](#04-tank-health)
5. [Shell Creation](#05-shell-creation)
6. [Firing Shells](#06-firing-shells)
7. [Game Managers](#07-game-managers)
8. [Audio Mixing](#08-audio-mixing)
### 01. [Scene Setup](http://unity3d.com/learn/tutorials/projects/tanks-tutorial/scene-setup?playlist=20081)
***Basic scene setup***
#### General
* Dragging asset models into the scene or hierarchy
* Frame selecting game objects in scene: dbl-click game object in Hierarchy, or 'F' key in Scene when selected
#### Lighting
* Dedicated window for lighting options
* Precomputed Real Time GI selected for use
* Baking the lighting (a lengthy bg process)
* Low resolution OK for lowpoly models
* Ambient light source & color vs. skybox
### 02. [Tank Creation & Control](http://unity3d.com/learn/tutorials/projects/tanks-tutorial/tank-creation-control?playlist=20081)
***How to add the tank artwork and components to let the player control the tank.***
#### General
* Layers
* For collider interaction isolation
* Only collider owner needs to be on layer (parent GO, not children)
* Duplication of GameObjects (Ctrl+D or right-click context menu)
* Project Settings
* Input Manager: configuring input control & names
#### Components
* Component adding, setup, & collapsing
* Rigidbody
* req'd for Physics system
* constraints on axes (position/rotation)
* Kinematics: turn on/off (receive physical forces/no forces)
* Colliders (primitive)
* reports physics events (collisions) to Rigidbody
* Trigger vs. Physical events
* proper sizing for model
* Audio Source
* Populating references using "Circle Select" in Inspector
* versus dragging from Project Assets folders
* Empty references to be populated at runtime via scripting
* Scripts
* are also Components (provided they extend from Monobehaviour)
#### Prefabs
* Dragging configured scene objects from Hierarchy into Project Prefabs folder
* and vice versa
* Prefab options: Select, Revert, Apply
* between prefab & scene object linkage
* Applying changes from changed Hierarchy/Scene game objects to prefabs.
* Blue vs gray text in Hierarchy: Saved vs. unsaved changes to prefabs from scene gameobjects
* Also ***bold*** fields in Inspector are unsaved changes to prefabs
#### Particle Systems
* World vs. Local simulation space
* Simulate over time vs. distance
* Various options for behavior
#### Scripting
* Script editing, compiling, serializing workflow in Unity
* Console window messages for debugging.
* Public vs. Private fields/member variables
* relation to Inspector view (public fields show up for editing & populating references)
* UnassignedReferenceExceptions when forgetting to assign reference in Inspector panel.
* Inspector serialized values override values assigned in the script's public/serializable variables.
* Dynamically referencing & manipulating Components at runtime
* Variable naming conventions
* e.g. m_Name denotes class member variable (scoping mnemonic)
* TankMovement (inherits from MonoBehavior)
* Script Component for Tank GameObject to control its movement
* coding MonoBehaviour Event methods (Awake, Start, Update, etc)
* Vector manipulation math for Rigidbody movement by applying forces via method calls
* Quaternion representation in Unity for rotations of Transformations
* Quaternion.Euler() method for easy Euler angle conversions
### 03. [Camera Control](http://unity3d.com/learn/tutorials/projects/tanks-tutorial/scene-setup?playlist=20081)
***How to create a Camera rig which pans and zooms to keep all tanks on-screen at once.***
* Creation of an empty GameObject called CameraRig to house a Script Component: CameraControl.cs
* Rig becomes parent of the existing MainCamera
* Scripted to keep both tanks in view: Pan and Zoom (i.e. move & resize frustum)
* Tanks will stay in camera's frustum: area b/w near & far clip plane
* Perspective frustum: variable size clip planes
* Orthographic frustum: same size clip planes, hence no change in scale over distance
* Orthographic Camera size in relation to aspect ratio (16:9) & aspect (1.77).
* GameObject.GetComponentInChildren<ComponentType>() method OK if child component type is unique.
* [HideInInspector] attribute to prevent public member from being serialized to Inspector.
### 04. [Tank Health](http://unity3d.com/learn/tutorials/projects/tanks-tutorial/tank-health?playlist=20081)
***Setup tank damage, update UI heal slider based on health value, tank deactivation on death***
* Using a Unity UI Slider as a radial health bar.
* UI Elements: Canvas, Slider, EventSystem
* EventSystem Input Module component in Inspector
* Axis setup along with InputManager
* Canvas Scaler (Script) component for helping developing multiresolution apps
* Canvas component Render modes: Screenspace vs. Worldspace
* Rect Transform component in all UI elements.
* Anchor presets button to edit anchors (Shift/Alt)
* Top to Bottom rendering of UI child elements of Canvas (as found in the Hierarchy)
* Instantiating inactive game objects (e.g. particle systems) to cache them until ready for use.
* Also, setting them inactive again instead of destroying them then reinstantiating again.
* Caching like this (inactive->active) saves on garbage collection calls.
### 05. [Shell Creation](http://unity3d.com/learn/tutorials/projects/tanks-tutorial/shell-creation?playlist=20081)
***Create a ballistic shell for the tank & a radius for explosion forces***
* Collider triggers for simply creating callbacks in scripts to react to, instead of physical forces.
* Physics.OverlapSphere(pos,radius,layer) method to get an array of colliders touching/inside a specified sphere.
* Rigidbody.AddExplosionForce(force,pos,radius) to simulate explosive forces.
* Component references can also be used to get other component references on same GameObject via GetComponent<>().
### 06. [Firing Shells](http://unity3d.com/learn/tutorials/projects/tanks-tutorial/firing-shells?playlist=20081)
***How to fire projectiles, and make a UI & sound effect to accompany the mechanic.***
* Re-appropriate a UI Slider to make an aiming guide.
* Shells are unoptimally instantiated and destroyed every fire. Object pooling pattern would solve this.
### 07. [Game Managers](http://unity3d.com/learn/tutorials/projects/tanks-tutorial/game-managers?playlist=20081)
***Game loop architecture using coroutines and textual UI creation for messaging players.***
* Text UI GameObject creation and usage, along with Shadow script component for effect.
* [Serializable] attribute on classes are serialized for view in the Inspector.
* ColorUtility.ToHtmlStringRGB(Color) for converting an rgb color to HTML code for rich text.
* Coroutines are used to cleverly manage the main game loop.
#### Coroutines
* A function that can suspend its execution (yield) until the given `YieldInstruction` finishes.
* Normal coroutine updates are run after the *Update()* function returns.
* Can be used as a way to spread an effect over a period time
* It is also a **useful optimization** since it also allows you to determine at what rate any function gets called.
**Return types & different uses of Coroutines:**
```csharp
yield // The coroutine will continue after all Update functions have been called on the next frame.
yield WaitForSeconds // Continue after a specified time delay, after all Update functions have been called for the frame
yield WaitForFixedUpdate // Continue after all FixedUpdate has been called on all scripts
yield WaitForEn
没有合适的资源?快使用搜索试试~ 我知道了~
(5.0-2019)unity坦克 源码Unity-Tanks-Tutorial.zip
共517个文件
meta:268个
cs:68个
shader:65个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 92 浏览量
2022-10-29
21:15:14
上传
评论
收藏 60.89MB ZIP 举报
温馨提示
(5.0-2019)unity坦克 源码Unity-Tanks-Tutorial.zip
资源推荐
资源详情
资源评论
收起资源包目录
(5.0-2019)unity坦克 源码Unity-Tanks-Tutorial.zip (517个子文件)
EngineIdle.aif 1.1MB
EngineDriving.aif 734KB
LightmapSnapshot.asset 16.14MB
LightmapSnapshot.asset 15.96MB
ProjectSettings.asset 13KB
InputManager.asset 6KB
QualitySettings.asset 4KB
GraphicsSettings.asset 1KB
Physics2DSettings.asset 950B
NavMeshAreas.asset 884B
DynamicsManager.asset 650B
EditorSettings.asset 479B
TagManager.asset 391B
AudioManager.asset 303B
UnityAdsSettings.asset 223B
EditorBuildSettings.asset 207B
UnityAnalyticsManager.asset 198B
TimeManager.asset 175B
NetworkManager.asset 151B
frag_ao.cginc 2KB
CompletePumpjack.controller 2KB
Pumpjack.controller 2KB
DepthOfFieldDeprecated.cs 20KB
DepthOfField.cs 18KB
CameraMotionBlur.cs 18KB
Bloom.cs 16KB
BloomAndFlares.cs 14KB
GameManager.cs 10KB
Tonemapping.cs 9KB
GameManager.cs 9KB
ContrastStretch.cs 8KB
BloomEditor.cs 8KB
BloomAndFlaresEditor.cs 8KB
NoiseAndGrain.cs 7KB
ScreenSpaceAmbientOcclusion.cs 7KB
DepthOfFieldDeprecatedEditor.cs 7KB
PostEffectsBase.cs 7KB
ColorCorrectionCurves.cs 7KB
PostEffectsHelper.cs 6KB
Antialiasing.cs 6KB
SunShafts.cs 6KB
NoiseAndScratches.cs 6KB
GlobalFog.cs 5KB
TankMovement.cs 5KB
CameraControl.cs 5KB
VignetteAndChromaticAberration.cs 5KB
TankShooting.cs 5KB
CameraControl.cs 5KB
TankMovement.cs 5KB
NoiseAndGrainEditor.cs 5KB
ColorCorrectionLookup.cs 5KB
TankShooting.cs 5KB
TonemappingEditor.cs 4KB
ColorCorrectionCurvesEditor.cs 4KB
SunShaftsEditor.cs 4KB
DepthOfFieldEditor.cs 4KB
CameraMotionBlurEditor.cs 4KB
ShellExplosion.cs 4KB
ShellExplosion.cs 4KB
Blur.cs 4KB
Quads.cs 4KB
ScreenSpaceAmbientObscurance.cs 4KB
ColorCorrectionLookupEditor.cs 4KB
TankManager.cs 4KB
TankHealth.cs 4KB
TankManager.cs 3KB
TankHealth.cs 3KB
BloomOptimized.cs 3KB
Triangles.cs 3KB
BlurOptimized.cs 3KB
CreaseShading.cs 3KB
EdgeDetection.cs 3KB
AntialiasingEditor.cs 3KB
VignetteAndChromaticAberrationEditor.cs 3KB
MotionBlur.cs 3KB
ContrastEnhance.cs 3KB
EdgeDetectionEditor.cs 2KB
TiltShift.cs 2KB
ScreenOverlay.cs 2KB
ImageEffects.cs 1KB
Fisheye.cs 1KB
ImageEffectBase.cs 1KB
UIDirectionControl.cs 731B
UIDirectionControl.cs 669B
Grayscale.cs 633B
Vortex.cs 633B
Twirl.cs 632B
ColorCorrectionRamp.cs 562B
MoveSceneViewCamera.cs 510B
SepiaTone.cs 444B
ReflectionProbe-0.exr 129KB
ReflectionProbe-0.exr 28KB
Tank.fbx 400KB
Cliff.fbx 223KB
PumpJack.fbx 183KB
BustedTank.fbx 131KB
Concrete.fbx 110KB
Refinery.fbx 89KB
Building02.fbx 67KB
Cow.fbx 61KB
共 517 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
reg183
- 粉丝: 1811
- 资源: 1万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功