Book Image

Unity 5.x Game Development Blueprints

By : John P. Doran
Book Image

Unity 5.x Game Development Blueprints

By: John P. Doran

Overview of this book

<p>This book will help you to create exciting and interactive games from scratch with the Unity game development platform. We will build 7-8 action-packed games of different difficulty levels, and we’ll show you how to leverage the intuitive workflow tools and state of the art Unity rendering engine to build and deploy mobile desktop as well as console games.</p> <p>Through this book, you’ll develop a complete skillset with the Unity toolset. Using the powerful C# language, we’ll create game-specific characters and game environments. Each project will focus on key Unity features as well as game strategy development. This book is the ideal guide to help your transition from an application developer to a full-fledged Unity game developer</p>
Table of Contents (19 chapters)
Unity 5.x Game Development Blueprints
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface
Index

Creating waves of targets


Now that we have all of the pieces together, let's make it so that we will only spawn a few ducks at a time and have a few of them appear at a time.

  1. Open up the TargetBehaviour script, and in the Start function, remove the following line:

    ShowTarget(); 

    This will keep the targets in their original position until we are ready for them to be shown.

  2. Next, we will create a new script named GameController by going to the Project tab and then selecting Create | C# Script and once it appears give it a name of GameController. Double-click on the file to open up your IDE of choice and add the following code:

    using UnityEngine;
    using System.Collections; 			 // IEnumerator
    using System.Collections.Generic; // List
    
    public class GameController : MonoBehaviour
    {
        public static GameController _instance;
    
        [HideInInspector] // Hides var below from inspector
        public List<TargetBehaviour> targets = new List<TargetBehaviour>();
    
        void Awake()
        {
            _instance...