Fundaments of Game Design

Slides:



Advertisements
Similar presentations
CS 106 Introduction to Computer Science I 04 / 11 / 2008 Instructor: Michael Eckmann.
Advertisements

Chapter 8 Inheritance Part 2. © 2004 Pearson Addison-Wesley. All rights reserved8-2 Outline Creating Subclasses Overriding Methods Class Hierarchies Inheritance.
CS 106 Introduction to Computer Science I 11 / 26 / 2007 Instructor: Michael Eckmann.
More about classes and objects Classes in Visual Basic.NET.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
CS 106 Introduction to Computer Science I 04 / 16 / 2010 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 11 / 15 / 2006 Instructor: Michael Eckmann.
Object-Orientated Design and Programming Unit 8: Inheritance and Polymorphism Jin Sa.
HELLO WORLD: YOUR FIRST PROGRAM CHAPTER Topics  Hello World?  Creating a Unity Project –The Unity Project Folder  MonoDevelop: Unity's Code Editor.
Applying OO Concepts Using Java. In this class, we will cover: Overriding a method Overloading a method Constructors Mutator and accessor methods The.
Fundamentals of Python: From First Programs Through Data Structures
Finishing 2D COSC 315 Fall 2014 Bridget M. Blodgett.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
Lecture 9 Polymorphism Richard Gesick.
Games Development 2 Resource Management CO3301 Week 3.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Microsoft Visual Basic 2008 CHAPTER ELEVEN Multiple Classes and Inheritance.
CSE 501N Fall ‘09 14: Inheritance 20 October 2009 Nick Leidenfrost.
Inheritance (Part 4) Abstract Classes 1.  sometimes you will find that you want the API for a base class to have a method that the base class cannot.
Game Maker – Getting Started What is Game Maker?.
Microsoft Visual Basic 2008 CHAPTER ELEVEN Multiple Classes and Inheritance.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Coming up: Inheritance
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
© 2007 Lawrenceville Press Slide 1 Chapter 9 Inheritance  One class is an extension of another.  Allows a class to define a specialized type of an existing.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
GameDevClub CODE CHEAT SHEET NOTE: ALL OF THE CODE IS CASE-SENSITIVE AND THE SYNTAX IS STRICT SO A LOT OF YOUR ERRORS WILL PROBABLY COME FROM TYPOS If.
M1G Introduction to Programming 2 2. Creating Classes: Game and Player.
UFCEKU-20-3Web Games Programming Instantiating World Objects.
ISBN Chapter 12 Support for Object-Oriented Programming.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Inheritance a subclass extends the functionality of a superclass a subclass inherits all the functionality of a superclass don't reinvent the wheel – "stand.
Game Settings Richard Gesick.
Sections Inheritance and Abstract Classes
More (C#) Scripting Day 2, Lesson 1.
Inheritance and Big O And your first reading assignment
One class is an extension of another.
CS230 Tutorial Week 3.
Character Selection from a lobby in Unity
Programming Language Concepts (CIS 635)
Wrapper Classes ints, doubles, and chars are known as primitive types, or built-in types. There are no methods associated with these types of variables.
Inheritance Often, software encapsulates multiple concepts for which some attributes/behaviors overlap E.g. A computer (role-playing) game has: Monsters:
3 Fundamentals of Object-Oriented Programming
Lecture 23 Polymorphism Richard Gesick.
One class is an extension of another.
C# Basics Part2 These slides are designed for Game Design Class
Class Inheritance (Cont.)
Topics Introduction to File Input and Output
Review of Classes and Arrays
Chapter 11 Inheritance and Polymorphism
Keeping Score Richard Gesick.
Applying OO Concepts Using Java
Fundaments of Game Design
Fundaments of Game Design
Fundaments of Game Design
Fundaments of Game Design
CIS 199 Final Review.
Fundaments of Game Design
Fundaments of Game Design
Review of Previous Lesson
Unity Game Development
Unity Game Development
Topics Introduction to File Input and Output
C++ Polymorphism Reference and pointer implicit type casting
Online Pogo Game Customer Service
Pogo Game Customer Care Helpline Number

Call Pogo Contact Phone Number and Enjoy Pogo Game
Presentation transcript:

Fundaments of Game Design Using Managers Richard Gesick

Objectives Concept of managers Polymorphism with managers Player Prefs

Managers Typical managers are game managers and enemy managers. Be careful not to make too many managers, it gets confusing and you duplicate processes. Using an enemy manager as the example. By using the manager, we have once point of control and it makes it easy to use inheritance and polymorphism.

The classes abstract class enemy has abstract move and attack methods. Doesn’t inherit from monobehavior. Subclasses Orc, Troll and Centaur inherit from enemy and each overrides the attack and move methods. Prefabs of the 3 subclasses are made and the scripts assigned. Enemy class is just in the script folder of assets without being assigned to a game object

The enemy manager The enemy manager will have start or awake. In that method it will call a spawn method to create the enemy. Spawn instantiates the enemy subclass objects and adds them to a list of enemies. elist.Add( (Orc) Instantiate(eObj[0], position, rotation); //eObj is an array holding the prefabs

The polymorphic move and attack foreach (Enemy e in eList) { if(e!=null) e.Move(playerPos); e.Attack(playerPos); }

PlayerPrefs Allow storage of small amounts of info (strings, ints, floats) (about 1 MB total) Save data using: PlayerPrefs.SetFloat(“keyname”,variable name); Load data into game using: int pKills=PlayerPrefs.GetInt(“playerKills”);

PlayerPrefs.Save() From unity documentation: Writes all modified preferences to disk. By default Unity writes preferences to disk during OnApplicationQuit(). In cases when the game crashes or otherwise prematurely exits, you might want to write the PlayerPrefs at sensible 'checkpoints' in your game. This function will write to disk potentially causing a small hiccup, therefore it is not recommended to call during actual gameplay. Note: There is no need to call this function manually inside OnApplicationQuit(). PlayerPrefs.Save();