1. Trang chủ
  2. » Công Nghệ Thông Tin

oceanofpdf com learning c by developing games with unity emma william

288 2 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 288
Dung lượng 1,9 MB

Nội dung

Làm Game qua unity,“The “joy of discovery” is one of the fundamental joys of play itself. Not just the joy of discovering secrets within the game, but also the joy of uncovering the creator’s vision. It’s that “Aha” moment where it all makes sense, and behind the world the player, can feel the touch of another creative mind. In order for it to be truly joyful, however, it must remain hidden from plain view—not carved as commandments into stone tablets but revealed, piece by piece, through the player’s exploration of the game’s rules.” ― Derek Yu, Spelunky,If you dont know anything about programming in general, writing code, writing scripts, or have no idea where to even begin, then this book is perfect for you. If you want to make games and need to learn how to write C scripts or code, then this book is ideal for you

Learning C# by Developing Games with Unity                     C # P R O G R A M M I N G D F O R E V E L O P M E N T       by Emma William               U N I T Y G A M E   For information contact : (alabamamond@gmail.com, memlnc) http://www.memlnc.com   nd Edition: 2020     Learning C# by Developing Games with Unity Copyright © 2020 by Emma William                   “The “joy of discovery” is one of the fundamental joys of play itself Not just the joy of discovering secrets within the game, but also the joy of uncovering the creator’s vision It’s that “Aha!” moment where it all makes sense, and behind the world the player can feel the touch of another creative mind In order for it to be truly joyful, however, it must remain hidden from plain view—not carved as commandments into stone tablets but revealed, piece by piece, through the player’s exploration of the game’s rules.”   ― Derek Yu, Spelunky               Who this book is for? If you don't know anything about programming in general, writing code, writing scripts, or have no idea where to even begin, then this book is perfect for you If you want to make games and need to learn how to write C# scripts or code, then this book is ideal for you                                                                           memlnc Who this book is for? INTRODUCTION _13 2D OR 3D PROJECTS………………………………………………………………………………………… 14 Full 3D……………………………………………………………………………………………………… ……….15 Orthographic 3D……………………………………………………………………………………………… 16 Full 2D……………………………………………………………………………………………………… ……….16 2D gameplay with 3D graphics………………………………………………………………………… 17 Why we use game engines? ………………………………………………………………………… 19 Quick steps to get started with Unity Engine…………………………………………………….20   CHAPTER _25 The language C #………………………………………………………………………………………………26 syntax…………………………………………………………………………………………………… ………….28 Comments……………………………………………………………………………………………… …………28 variables………………………………………………………………………………………………… …………29 Naming conventions…………………………………………………………………………………………29 Data types…………………………………………………………………………………………………… … 30 Variable declaration with initialization…………………………………………………………….32 Boolean variable………………………………………………………………………………………………33 Keyword var…………………………………………………………………………………………………….33 Data fields / array…………………………………………………………………………………………….33 Create arrays…………………………………………………………………………………………………… 34 Access to an array element………………………………………………………………………………35 Determine the number of all array items…………………………………………………………35 Multidimensional arrays………………………………………………………………………………… 36 Constants……………………………………………………………………………………………… …………37 Enumeration…………………………………………………………………………………………… ………38 Type conversion……………………………………………………………………………………………… 38 Ramifications…………………………………………………………………………………………… …… 40 if statements……………………………………………………………………………………………… ……40 switch statement……………………………………………………………………………………………… 41 grind…………………………………………………………………………………………………… ……………43 for loop…………………………………………………………………………………………………… ………43 Negative step size……………………………………………………………………………………………44 Break…………………………………………………………………………………………………… ………….45 Foreach loop…………………………………………………………………………………………………… 46 while loop…………………………………………………………………………………………………… … 47 loop…………………………………………………………………………………………………… ………48 Classes………………………………………………………………………………………………… ………….49 Assign components by code…………………………………………………………………………… 50 Instantiation of non-components…………………………………………………………………….51 Methods / functions……………………………………………………………………………………….52 Don't repeat yourself………………………………………………………………………………………54 Value types and reference types…………………………………………………………………….54 Overloaded methods…………………………………………………………………………………… 56 Local and global variables……………………………………………………………………………… 56 Prevent confusion with this…………………………………………………………………………… 57 Access and visibility ……………………………………………………………………………………….57 Static classes and class members………………………………………………………………… 59 Parameter modifier out / ref…………………………………………………………………………61 Array passing with params…………………………………………………………………………… 63 Properties and property methods…………………………………………………………………65 Inheritance……………………………………………………………………………………………… ……68 Base class and derived classes………………………………………………………………………………69 Inheritance and visibility……………………………………………………………………………………….70 Override inherited method……………………………………………………………………………………72 Access to the base class…………………………………………………………………………………………73 Seal classes………………………………………………………………………………………………… …………74 Polymorphism………………………………………………………………………………………… …………….75 Interfaces……………………………………………………………………………………………… ………………76 Define interface………………………………………………………………………………………………… ….77 Implement interfaces……………………………………………………………………………………………78 Support from MonoDevelop………………………………………………………………………………….80 Access via an interface………………………………………………………………………………………….80 Namespaces…………………………………………………………………………………………… …………….81 Generic classes and methods……………………………………………………………………………….83 Cunning………………………………………………………………………………………………… …………… 84 Sort list objects………………………………………………………………………………………………… ….86 Dictionary……………………………………………………………………………………………… …………….87   CHAPTER 90 Script programming…………………………………………………………………………………………… .90 Script programming…………………………………………………………………………………………… .90 MonoDevelop………………………………………………………………………………………… ……………91 Help in MonoDevelop………………………………………………………………………………………… 92 Syntax error…………………………………………………………………………………………………… ……92 Forwarding of error messages…………………………………………………………………………….93 Usable programming languages………………………………………………………………………….93 Why C #?……………………………………………………………………………………………………… …….94             { // All the projectiles were consumed, send a message telling them                 projectilesConsumed = true;                 SendMessageUpwards ("ProjectilesConsumed");             }         } }       // Finds the nearest projectile and returns it     Projectile GetNearestProjectile ()     {         Projectile [] allProjectiles = FindObjectsOfType ();           if (allProjectiles.Length == 0)         {             // There are no longer any projectiles             return null;         }           // Search for the nearest projectile and return it         Projectile nearest = allProjectiles [0];         float minDist = Vector2.Distance (nearest.transform.position, transform.position);           for (int i = 1; i

Ngày đăng: 24/05/2023, 18:13

w