- Unreal Development Kit Game Programming with UnrealScript:Beginner's Guide
- Rachel Cordone
- 254字
- 2021-08-27 11:59:11
Function overriding
In addition to variables, functions declared in parent classes are also inherited by their children. This lets us change behavior that goes beyond simple variable changes. For example, two pickups under Inventory | UTInventory | UTTimedPowerup in the class tree, UTBerserk
and UTUDamage
, have the same function called GivenTo
which is inherited from Inventory
. Even though the function name is the same, they give the inventory items their unique behavior. UTBerserk
's GivenTo
function calls a function that increases the player's weapon firing rate, while UTUDamage
's GivenTo
function increases the player's DamageScaling
variable. These functions also set different sound effects and overlays for the two different items.
To experiment with function overriding we're going to expand our AwesomeGame
classes to include a custom GameInfo
and PlayerController
class. The GameInfo
controls the rules of the game and is what makes Deathmatch
different from "Capture the Flag" for example. A custom GameInfo
is one of the most important classes when creating our own game, and most of the time it is the first class created in a new project.
The PlayerController
is the brain behind the player's character running around on screen. It processes our input, controls the player's viewpoint, and passes and receives messages to and from other players among many other things. It is another important class in a custom game, and taking the time to read through it will help you understand how a lot of things are done in a UDK game.
So with that, let's make a custom game!
- 電腦組裝與維修從入門到精通(第2版)
- BeagleBone By Example
- Camtasia Studio 8:Advanced Editing and Publishing Techniques
- 電腦軟硬件維修從入門到精通
- 基于Apache Kylin構建大數據分析平臺
- Blender Quick Start Guide
- “硬”核:硬件產品成功密碼
- WebGL Hotshot
- 電腦組裝與維護即時通
- Spring Security 3.x Cookbook
- 微服務架構基礎(Spring Boot+Spring Cloud+Docker)
- 嵌入式系統設計大學教程(第2版)
- 創客電子:Arduino和Raspberry Pi智能制作項目精選
- 3D打印:Geomagic Design X5.1 逆向建模設計實用教程
- Exceptional C++:47個C++工程難題、編程問題和解決方案(中文版)