一、基本語法
1.US概念:C++和Java的雜交語言,以C的風格來創建它(EPIC的人都是人才啊,這都能想出來)
2.具有標識符和關鍵字,標識符和C、C++風格一樣,重點:所有修飾符大小寫不敏感(C++用習慣了,改不了了)
3.具有表達式和操作符
4.註釋風格和C++一樣
// A line comment
/* A block comment */
(=。=官方人員還真的是簡略,幾句話就介紹完基本語法,上邊是我的精簡版,學過C++的基本一下都懂)
二、實例
1.環境配置
注意:Start with specified game 中選項一定記得要把自己創建的文件名添加到前面
2.代碼
說明:創建實例,當玩家受到傷害,血量不足時候進行生命回覆
MyGameInfo.uc
class MyGameInfo extends UTGame;
defaultproperties
{
DefaultPawnClass=class'UnrealScript_01.UTPawn_SuperRegen'
}
UTPawn_SuperRegen.ucclass UTPawn_SuperRegen extends UTPawn;
var Int RegenPerSecond;
simulated function PostBeginPlay()
{
super.PostBeginPlay();
SetTimer(1.0,true);
}
function Timer()
{
if (Controller.IsA('PlayerController') && !IsInPain() && Health < SuperHealthMax )
{
Health = Min( Health + RegenPerSecond, SuperHealthMax );
}
}
defaultproperties
{
RegenPerSecond=10
}