Home khkGames Classes Calendar Software Bibliothek Index Contact
Trail: Simulations


We will be using the book Game Programming for Artists by Jarryd Huntly and Hanna Brady as our guide for learning C# programming in Unity3D GameEngine.
There are copies of the book in the Library but you have digital access to the book. Please search in the library catalog or just click here: https://www.taylorfrancis.com/books/9781351856119

Computers are Dumb
Programmers are Lazy

You will also want a good text editor with syntax highlighting, Unity comes with one.

But literally anything you are comfortable with will be fine.
Bet you never thought so much about text editors!


Download the free ‘Personal’ version here: https://store.unity.com/
Official Documentation: https://docs.unity3d.com/Manual/index.html


Sample Scripts

Object Oriented Programming

  • A technique we use to help divide projects up into more understandable and maintainable pieces.
  • Objects are the base of everything.
    • Objects are a way to categorize code. This chunk of code represents this functionality.
    • Objects hold states and perform behaviours.

C# Syntax

- Interpreted vs. Compiled languages
- Syntax of C# (Formatting)

    { ... } curly brackets at start and end of a code block
    ; the end of a line of code
    // this is a comment
    /*  this is also a comment 
        anything in here is part of the comment

- Variables : containers that hold information

    dataType variableName 
    int : holds whole numbers
    string and character - holds characters
    boolean : true or false

- Operators

    + addition
    - subtraction
    * multiplication
    / division
    % modulus (division but returns the remainder)
    = assignment (is) 
    == comparator (checks if the two values are equal)
    ++ increase by one
    -- decrease by one
        dataType variableName = value;
        int remainder = 8 % 3;
        int score = oldScore / 20 ;
        livesRemaining++ ;

- Conditionals

    if (ConditionIsTrue)
        // The body runs everything in these braces if 
        // the condition is true

- Logical Operators

    && if both expressions are true
    || or
    ! Not
    if ((expression) logicalOperator(expression))
        //The body runs if the entire if statement is true

-Switch: a type of conditional like if...else but for matching specific cases

 switch (variable)
   case 1:
      //case one was matched
   case 2:
      //case two was matched
      //This will run when no cases are matched




    public class Car

-Dot Operator

-Arrays: a specified number of objects of the same data type
-Lists: like an array but can be any length or datatype and can be changed.

Define external redirect: GameEngine