SlideShare una empresa de Scribd logo
1 de 13
Petri Lankoski
Contents
 Waypoint track
 Enemy following waypoint track
 PlayerLogic keeping track of Power and
  Health stats
     Displaying health & power meter with GUI
 Scaling GUI to different screen sizes
 PowerUp
Waypoint
public class Waypoint : MonoBehaviour {
            public Transform nextTarget;
            public string agentTag; // Tag of the things we set the new target
            void OnTriggerEnter(Collider other) {
                                     if(other.gameObject.CompareTag(agentTag)) {
                                     SendNextTarget(other.gameObject);
                         }
            }
            void OnDrawGizmos() {
                         Gizmos.DrawIcon (transform.position, "waypoint.psd");
                         if(nextTarget) {
                                     Gizmos.color = Color.red;
                                     Gizmos.DrawLine(transform.position, nextTarget.position);
                         }
            }
            private void SendNextTarget(GameObject obj) {
                         Enemy script = obj.GetComponent<Enemy>();
                         script.SetTarget(nextTarget);
            }
}
Waypoint.psd
Waypoint                                         (etc, other formats
                                                 Works)


   Setup
     Waypoint prefab
      ○ With Waypoint script attached
      ○ With collider in trigger mode (is trigger set)
     Gizmos/waypoint.psd
      ○ Size should be 32x32 or 25x25 pixels

 Create a track using waypoints
 TEST
Waypoint setup, one track
Waypoint setup, two tracks
Enemy Following Waypoints
   Enemy c# class
     Enemy target in public Transform
      ○ So we can set the first target waypoint on the inspector
     Implement
      ○ public void SetTarget(Transform newTarget) { /* Store newTarget
         to private variable of Enemy class here*/ }
     Make enemy move by the track set with Waypoints
      ○ Use Update() for this
      ○ transform.LookAt()
      ○ transform.Translate(), Time.deltaTime
   Create Enemy prefeb
     Create new tag and set tag to Enemy (or something depending
      the value of agentTag)
     Set the tag to Enemy (or to match the AgentTag variable) to the
      waypoints on your track
   TEST
Second Enemy
   Make an enemy follow different track
     Create new tag and set tag to Enemy
     Set the tag (to the AgentTag variable) to the
     waypoints on your track
Player Object
   Add FirstPersonController to           public class GUIGlobals {
    scene                                    public const float screenWidth = 1280.0f;
     Standard Assets/Character              public const float screenHeight = 800.0f;
      Controllers
                                             public static Matrix4x4 GetGUIMatrix() {
   Create PlayerLogic.cs
     Add meters for health and
                                               float xScale=Screen.widt /screenWidth;
      power                                    float yScale=Screen.height/screenHeight;
     OnGUI():                                 return Matrix4x4.TRS(
      ○ GUI.matrix = GUIGlobals
        .GetGUIMatrix();                            Vector3.zero,
      ○ Use GUI.DrawTexture() &                     Quaternion.identity,
        changing the height or width of
        the texture
                                                    new Vector3(xScale, yScale, 1)
      ○ Drawing are for DrawTexture:                );
          new Rect(x, y, width, height)     }
     power & health as public
      variable for testing
                                           }
GUI.matrix & GUIGlobals
                                      0,0               GUIGlobals.screenWidth,0

    Scales the GUI for
     you in any screen
     sizes
    Layout according to
     values set in
     GUIGlobals
new Rect(GUIGlobals.screenWidth-40,
GUIGlobals.screenHeight-40,
20,20)

                                                    GUIGlobals.screenWidth,
                                                    GUIGlobals.screenHeight
                            0,GUIGlobals.screenHeight
Shortcut to Player, Singleton
public class GameAgents : MonoBehaviour {
  private static GameAgents instance;
  private GameObject player;
  private PlayerLogic playerLogic;
  void Awake() {
        instance = this;
        player = GameObject.FindWithTag("Player");
        playerLogic = player.GetComponent<PlayerLogic>();
   }
   public static GameObject GetPlayer() { return instance.player;}
   public static PlayerLogic GetPlayerLogic() {
          return instance.playerLogic;
   }
}
GameAgents
 Add to an empty game object
 Allows easy access to Player object and
  PlayerLogic classes from other classes
     GameObject pc = GameAgents.GetPlayer();
     PlayerLogic pl =
      GameAgents.GetPlayerLogic();
     GameAgents.GetPlayerLogic().enabled =
      false;
     GameAgents.GetPlayerLogic().FunctionNam
      e(4,6);
PowerUp
   Expose health and power on inspector
     public int health, power;
   Collider in trigger mode ()
   Catch collision OnTriggerEnter(Collider other)
     Check if player object collided with it
      ○ if(other.gameObject == GameAgents.GetPlayer()) …
          This is faster than tag comparison used in Waypoint
     Send Health and Power to PlayerLogic script
      ○ GameAgents.GetPlayerLogic().PowerUp(health,power)
      ○ You need to add a function for that to PlayerLogic
          public void PowerUp(int powerAdd, int healtAhh) {

Más contenido relacionado

La actualidad más candente

OpenGL L07-Skybox and Terrian
OpenGL L07-Skybox and TerrianOpenGL L07-Skybox and Terrian
OpenGL L07-Skybox and TerrianMohammad Shaker
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationJussi Pohjolainen
 
The Ring programming language version 1.10 book - Part 78 of 212
The Ring programming language version 1.10 book - Part 78 of 212The Ring programming language version 1.10 book - Part 78 of 212
The Ring programming language version 1.10 book - Part 78 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 67 of 202
The Ring programming language version 1.8 book - Part 67 of 202The Ring programming language version 1.8 book - Part 67 of 202
The Ring programming language version 1.8 book - Part 67 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 61 of 181
The Ring programming language version 1.5.2 book - Part 61 of 181The Ring programming language version 1.5.2 book - Part 61 of 181
The Ring programming language version 1.5.2 book - Part 61 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 64 of 185
The Ring programming language version 1.5.4 book - Part 64 of 185The Ring programming language version 1.5.4 book - Part 64 of 185
The Ring programming language version 1.5.4 book - Part 64 of 185Mahmoud Samir Fayed
 
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksBeginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksJinTaek Seo
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDXJussi Pohjolainen
 
Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1NokiaAppForum
 
Petri Niemi Qt Advanced Part 2
Petri Niemi Qt Advanced Part 2Petri Niemi Qt Advanced Part 2
Petri Niemi Qt Advanced Part 2NokiaAppForum
 
Computer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGLComputer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGLSharath Raj
 
Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5Takao Wada
 
The Ring programming language version 1.5.2 book - Part 62 of 181
The Ring programming language version 1.5.2 book - Part 62 of 181The Ring programming language version 1.5.2 book - Part 62 of 181
The Ring programming language version 1.5.2 book - Part 62 of 181Mahmoud Samir Fayed
 
Look Mommy, No GC! (TechDays NL 2017)
Look Mommy, No GC! (TechDays NL 2017)Look Mommy, No GC! (TechDays NL 2017)
Look Mommy, No GC! (TechDays NL 2017)Dina Goldshtein
 
The Ring programming language version 1.5.2 book - Part 63 of 181
The Ring programming language version 1.5.2 book - Part 63 of 181The Ring programming language version 1.5.2 book - Part 63 of 181
The Ring programming language version 1.5.2 book - Part 63 of 181Mahmoud Samir Fayed
 
Deep dive into deeplearn.js
Deep dive into deeplearn.jsDeep dive into deeplearn.js
Deep dive into deeplearn.jsKai Sasaki
 
Workshop with python qgis
Workshop with python qgisWorkshop with python qgis
Workshop with python qgisQust04
 

La actualidad más candente (20)

OpenGL L07-Skybox and Terrian
OpenGL L07-Skybox and TerrianOpenGL L07-Skybox and Terrian
OpenGL L07-Skybox and Terrian
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
 
GLSL
GLSLGLSL
GLSL
 
The Ring programming language version 1.10 book - Part 78 of 212
The Ring programming language version 1.10 book - Part 78 of 212The Ring programming language version 1.10 book - Part 78 of 212
The Ring programming language version 1.10 book - Part 78 of 212
 
The Ring programming language version 1.8 book - Part 67 of 202
The Ring programming language version 1.8 book - Part 67 of 202The Ring programming language version 1.8 book - Part 67 of 202
The Ring programming language version 1.8 book - Part 67 of 202
 
The Ring programming language version 1.5.2 book - Part 61 of 181
The Ring programming language version 1.5.2 book - Part 61 of 181The Ring programming language version 1.5.2 book - Part 61 of 181
The Ring programming language version 1.5.2 book - Part 61 of 181
 
The Ring programming language version 1.5.4 book - Part 64 of 185
The Ring programming language version 1.5.4 book - Part 64 of 185The Ring programming language version 1.5.4 book - Part 64 of 185
The Ring programming language version 1.5.4 book - Part 64 of 185
 
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksBeginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDX
 
Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1Petri Niemi Qt Advanced Part 1
Petri Niemi Qt Advanced Part 1
 
OpenVX 1.0 Reference Guide
OpenVX 1.0 Reference GuideOpenVX 1.0 Reference Guide
OpenVX 1.0 Reference Guide
 
Petri Niemi Qt Advanced Part 2
Petri Niemi Qt Advanced Part 2Petri Niemi Qt Advanced Part 2
Petri Niemi Qt Advanced Part 2
 
Computer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGLComputer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGL
 
Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5
 
libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
 
The Ring programming language version 1.5.2 book - Part 62 of 181
The Ring programming language version 1.5.2 book - Part 62 of 181The Ring programming language version 1.5.2 book - Part 62 of 181
The Ring programming language version 1.5.2 book - Part 62 of 181
 
Look Mommy, No GC! (TechDays NL 2017)
Look Mommy, No GC! (TechDays NL 2017)Look Mommy, No GC! (TechDays NL 2017)
Look Mommy, No GC! (TechDays NL 2017)
 
The Ring programming language version 1.5.2 book - Part 63 of 181
The Ring programming language version 1.5.2 book - Part 63 of 181The Ring programming language version 1.5.2 book - Part 63 of 181
The Ring programming language version 1.5.2 book - Part 63 of 181
 
Deep dive into deeplearn.js
Deep dive into deeplearn.jsDeep dive into deeplearn.js
Deep dive into deeplearn.js
 
Workshop with python qgis
Workshop with python qgisWorkshop with python qgis
Workshop with python qgis
 

Destacado

Gameplay Design Workshop 2/2 (2011)
Gameplay Design Workshop 2/2 (2011)Gameplay Design Workshop 2/2 (2011)
Gameplay Design Workshop 2/2 (2011)Petri Lankoski
 
Gameplay Design Workshop 1/2 (2011)
Gameplay Design Workshop 1/2 (2011)Gameplay Design Workshop 1/2 (2011)
Gameplay Design Workshop 1/2 (2011)Petri Lankoski
 
Formal analysis of gameplay
Formal analysis of gameplayFormal analysis of gameplay
Formal analysis of gameplayPetri Lankoski
 
Simulations: Evaluating game system behavior
Simulations: Evaluating game system behavior Simulations: Evaluating game system behavior
Simulations: Evaluating game system behavior Petri Lankoski
 
Game Design, Lecture1: Design
Game Design, Lecture1: DesignGame Design, Lecture1: Design
Game Design, Lecture1: DesignPetri Lankoski
 
Game Development with Unity
Game Development with UnityGame Development with Unity
Game Development with Unitydavidluzgouveia
 
Game research methods book introduction
Game research methods book introductionGame research methods book introduction
Game research methods book introductionPetri Lankoski
 

Destacado (7)

Gameplay Design Workshop 2/2 (2011)
Gameplay Design Workshop 2/2 (2011)Gameplay Design Workshop 2/2 (2011)
Gameplay Design Workshop 2/2 (2011)
 
Gameplay Design Workshop 1/2 (2011)
Gameplay Design Workshop 1/2 (2011)Gameplay Design Workshop 1/2 (2011)
Gameplay Design Workshop 1/2 (2011)
 
Formal analysis of gameplay
Formal analysis of gameplayFormal analysis of gameplay
Formal analysis of gameplay
 
Simulations: Evaluating game system behavior
Simulations: Evaluating game system behavior Simulations: Evaluating game system behavior
Simulations: Evaluating game system behavior
 
Game Design, Lecture1: Design
Game Design, Lecture1: DesignGame Design, Lecture1: Design
Game Design, Lecture1: Design
 
Game Development with Unity
Game Development with UnityGame Development with Unity
Game Development with Unity
 
Game research methods book introduction
Game research methods book introductionGame research methods book introduction
Game research methods book introduction
 

Similar a Unity programming 1

Design pattern - part 3
Design pattern - part 3Design pattern - part 3
Design pattern - part 3Jieyi Wu
 
Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Korhan Bircan
 
Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]Palak Sanghani
 
The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184Mahmoud Samir Fayed
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?Ankara JUG
 
Task Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdfTask Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdfcronkwurphyb44502
 
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxasmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxfredharris32
 
Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1Muhammad Shebl Farag
 
Enhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsEnhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsNaman Dwivedi
 
Silverlight as a Gaming Platform
Silverlight as a Gaming PlatformSilverlight as a Gaming Platform
Silverlight as a Gaming Platformgoodfriday
 
Java Graphics
Java GraphicsJava Graphics
Java GraphicsShraddha
 
Modern Android Architecture
Modern Android ArchitectureModern Android Architecture
Modern Android ArchitectureEric Maxwell
 

Similar a Unity programming 1 (20)

Design pattern - part 3
Design pattern - part 3Design pattern - part 3
Design pattern - part 3
 
Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)
 
Unity 13 space shooter game
Unity 13 space shooter gameUnity 13 space shooter game
Unity 13 space shooter game
 
Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]Lec 7 28_aug [compatibility mode]
Lec 7 28_aug [compatibility mode]
 
Games 3 dl4-example
Games 3 dl4-exampleGames 3 dl4-example
Games 3 dl4-example
 
The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184
 
The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184
 
A More Flash Like Web?
A More Flash Like Web?A More Flash Like Web?
A More Flash Like Web?
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?
 
Task Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdfTask Write a Java program to implement a simple graphics editor tha.pdf
Task Write a Java program to implement a simple graphics editor tha.pdf
 
Griffon @ Svwjug
Griffon @ SvwjugGriffon @ Svwjug
Griffon @ Svwjug
 
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxasmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
 
MIDP: Game API
MIDP: Game APIMIDP: Game API
MIDP: Game API
 
Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1Getting started with GUI programming in Java_1
Getting started with GUI programming in Java_1
 
Enhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsEnhancing UI/UX using Java animations
Enhancing UI/UX using Java animations
 
Scmad Chapter07
Scmad Chapter07Scmad Chapter07
Scmad Chapter07
 
Silverlight as a Gaming Platform
Silverlight as a Gaming PlatformSilverlight as a Gaming Platform
Silverlight as a Gaming Platform
 
Java Graphics
Java GraphicsJava Graphics
Java Graphics
 
Modern Android Architecture
Modern Android ArchitectureModern Android Architecture
Modern Android Architecture
 
OpenGL ES 3.1 Reference Card
OpenGL ES 3.1 Reference CardOpenGL ES 3.1 Reference Card
OpenGL ES 3.1 Reference Card
 

Más de Petri Lankoski

A brief introduction to quantitative analysis
A brief introduction to quantitative analysisA brief introduction to quantitative analysis
A brief introduction to quantitative analysisPetri Lankoski
 
Game Analysis at HEVGA PhD Summer School
Game Analysis at HEVGA PhD Summer SchoolGame Analysis at HEVGA PhD Summer School
Game Analysis at HEVGA PhD Summer SchoolPetri Lankoski
 
Constructive Alignment in Teaching Game Research in Game Development Bachelor...
Constructive Alignment in Teaching Game Research in Game Development Bachelor...Constructive Alignment in Teaching Game Research in Game Development Bachelor...
Constructive Alignment in Teaching Game Research in Game Development Bachelor...Petri Lankoski
 
Level Design Course Intro and Assingnts
Level Design Course Intro and AssingntsLevel Design Course Intro and Assingnts
Level Design Course Intro and AssingntsPetri Lankoski
 
Quantitative analysis: A brief introduction
Quantitative analysis: A brief introductionQuantitative analysis: A brief introduction
Quantitative analysis: A brief introductionPetri Lankoski
 
Embodiment, Game Characters and Game Design
Embodiment, Game Characters and Game DesignEmbodiment, Game Characters and Game Design
Embodiment, Game Characters and Game DesignPetri Lankoski
 
Escape: Level Design Exercise in Unity
Escape: Level Design Exercise in UnityEscape: Level Design Exercise in Unity
Escape: Level Design Exercise in UnityPetri Lankoski
 
Designprocesser lecture1
Designprocesser lecture1Designprocesser lecture1
Designprocesser lecture1Petri Lankoski
 
How can game studies support game design practice?
How can game studies support game design practice?How can game studies support game design practice?
How can game studies support game design practice?Petri Lankoski
 
Game Project / Assignement
Game Project / AssignementGame Project / Assignement
Game Project / AssignementPetri Lankoski
 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with UnityPetri Lankoski
 
Game Analysis, lecture 1
Game Analysis, lecture 1Game Analysis, lecture 1
Game Analysis, lecture 1Petri Lankoski
 
Gameplay Design Workshop 2/3
Gameplay Design Workshop 2/3Gameplay Design Workshop 2/3
Gameplay Design Workshop 2/3Petri Lankoski
 
Gameplay Design Workshop 1/3
Gameplay Design Workshop 1/3Gameplay Design Workshop 1/3
Gameplay Design Workshop 1/3Petri Lankoski
 
Game Design and Procution: Introduction to Studies
Game Design and Procution: Introduction to StudiesGame Design and Procution: Introduction to Studies
Game Design and Procution: Introduction to StudiesPetri Lankoski
 

Más de Petri Lankoski (20)

A brief introduction to quantitative analysis
A brief introduction to quantitative analysisA brief introduction to quantitative analysis
A brief introduction to quantitative analysis
 
Game Analysis at HEVGA PhD Summer School
Game Analysis at HEVGA PhD Summer SchoolGame Analysis at HEVGA PhD Summer School
Game Analysis at HEVGA PhD Summer School
 
Constructive Alignment in Teaching Game Research in Game Development Bachelor...
Constructive Alignment in Teaching Game Research in Game Development Bachelor...Constructive Alignment in Teaching Game Research in Game Development Bachelor...
Constructive Alignment in Teaching Game Research in Game Development Bachelor...
 
Perforce
PerforcePerforce
Perforce
 
Level Design Course Intro and Assingnts
Level Design Course Intro and AssingntsLevel Design Course Intro and Assingnts
Level Design Course Intro and Assingnts
 
Quantitative analysis: A brief introduction
Quantitative analysis: A brief introductionQuantitative analysis: A brief introduction
Quantitative analysis: A brief introduction
 
Embodiment, Game Characters and Game Design
Embodiment, Game Characters and Game DesignEmbodiment, Game Characters and Game Design
Embodiment, Game Characters and Game Design
 
Escape: Level Design Exercise in Unity
Escape: Level Design Exercise in UnityEscape: Level Design Exercise in Unity
Escape: Level Design Exercise in Unity
 
Level Design
Level Design Level Design
Level Design
 
Game system design
Game system designGame system design
Game system design
 
Models for story
Models for storyModels for story
Models for story
 
Designprocesser lecture1
Designprocesser lecture1Designprocesser lecture1
Designprocesser lecture1
 
How can game studies support game design practice?
How can game studies support game design practice?How can game studies support game design practice?
How can game studies support game design practice?
 
Game Project / Focus
Game Project / FocusGame Project / Focus
Game Project / Focus
 
Game Project / Assignement
Game Project / AssignementGame Project / Assignement
Game Project / Assignement
 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with Unity
 
Game Analysis, lecture 1
Game Analysis, lecture 1Game Analysis, lecture 1
Game Analysis, lecture 1
 
Gameplay Design Workshop 2/3
Gameplay Design Workshop 2/3Gameplay Design Workshop 2/3
Gameplay Design Workshop 2/3
 
Gameplay Design Workshop 1/3
Gameplay Design Workshop 1/3Gameplay Design Workshop 1/3
Gameplay Design Workshop 1/3
 
Game Design and Procution: Introduction to Studies
Game Design and Procution: Introduction to StudiesGame Design and Procution: Introduction to Studies
Game Design and Procution: Introduction to Studies
 

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Unity programming 1

  • 2. Contents  Waypoint track  Enemy following waypoint track  PlayerLogic keeping track of Power and Health stats  Displaying health & power meter with GUI  Scaling GUI to different screen sizes  PowerUp
  • 3. Waypoint public class Waypoint : MonoBehaviour { public Transform nextTarget; public string agentTag; // Tag of the things we set the new target void OnTriggerEnter(Collider other) { if(other.gameObject.CompareTag(agentTag)) { SendNextTarget(other.gameObject); } } void OnDrawGizmos() { Gizmos.DrawIcon (transform.position, "waypoint.psd"); if(nextTarget) { Gizmos.color = Color.red; Gizmos.DrawLine(transform.position, nextTarget.position); } } private void SendNextTarget(GameObject obj) { Enemy script = obj.GetComponent<Enemy>(); script.SetTarget(nextTarget); } }
  • 4. Waypoint.psd Waypoint (etc, other formats Works)  Setup  Waypoint prefab ○ With Waypoint script attached ○ With collider in trigger mode (is trigger set)  Gizmos/waypoint.psd ○ Size should be 32x32 or 25x25 pixels  Create a track using waypoints  TEST
  • 7. Enemy Following Waypoints  Enemy c# class  Enemy target in public Transform ○ So we can set the first target waypoint on the inspector  Implement ○ public void SetTarget(Transform newTarget) { /* Store newTarget to private variable of Enemy class here*/ }  Make enemy move by the track set with Waypoints ○ Use Update() for this ○ transform.LookAt() ○ transform.Translate(), Time.deltaTime  Create Enemy prefeb  Create new tag and set tag to Enemy (or something depending the value of agentTag)  Set the tag to Enemy (or to match the AgentTag variable) to the waypoints on your track  TEST
  • 8. Second Enemy  Make an enemy follow different track  Create new tag and set tag to Enemy  Set the tag (to the AgentTag variable) to the waypoints on your track
  • 9. Player Object  Add FirstPersonController to public class GUIGlobals { scene public const float screenWidth = 1280.0f;  Standard Assets/Character public const float screenHeight = 800.0f; Controllers public static Matrix4x4 GetGUIMatrix() {  Create PlayerLogic.cs  Add meters for health and float xScale=Screen.widt /screenWidth; power float yScale=Screen.height/screenHeight;  OnGUI(): return Matrix4x4.TRS( ○ GUI.matrix = GUIGlobals .GetGUIMatrix(); Vector3.zero, ○ Use GUI.DrawTexture() & Quaternion.identity, changing the height or width of the texture new Vector3(xScale, yScale, 1) ○ Drawing are for DrawTexture: );  new Rect(x, y, width, height) }  power & health as public variable for testing }
  • 10. GUI.matrix & GUIGlobals 0,0 GUIGlobals.screenWidth,0  Scales the GUI for you in any screen sizes  Layout according to values set in GUIGlobals new Rect(GUIGlobals.screenWidth-40, GUIGlobals.screenHeight-40, 20,20) GUIGlobals.screenWidth, GUIGlobals.screenHeight 0,GUIGlobals.screenHeight
  • 11. Shortcut to Player, Singleton public class GameAgents : MonoBehaviour { private static GameAgents instance; private GameObject player; private PlayerLogic playerLogic; void Awake() { instance = this; player = GameObject.FindWithTag("Player"); playerLogic = player.GetComponent<PlayerLogic>(); } public static GameObject GetPlayer() { return instance.player;} public static PlayerLogic GetPlayerLogic() { return instance.playerLogic; } }
  • 12. GameAgents  Add to an empty game object  Allows easy access to Player object and PlayerLogic classes from other classes  GameObject pc = GameAgents.GetPlayer();  PlayerLogic pl = GameAgents.GetPlayerLogic();  GameAgents.GetPlayerLogic().enabled = false;  GameAgents.GetPlayerLogic().FunctionNam e(4,6);
  • 13. PowerUp  Expose health and power on inspector  public int health, power;  Collider in trigger mode ()  Catch collision OnTriggerEnter(Collider other)  Check if player object collided with it ○ if(other.gameObject == GameAgents.GetPlayer()) …  This is faster than tag comparison used in Waypoint  Send Health and Power to PlayerLogic script ○ GameAgents.GetPlayerLogic().PowerUp(health,power) ○ You need to add a function for that to PlayerLogic  public void PowerUp(int powerAdd, int healtAhh) {