Aottg2-文档

Your first script

翻译:(你的第一个脚本)

Now that you know how to load custom logic into a map, let’s create our first custom logic script. This script will be simple - it will start the game and print “Hello world” to the chat window.

翻译:(既然你已经知道如何将自定义逻辑加载到地图中,那么让我们来创建我们的第一个自定义逻辑脚本。这个脚本会很简单 —— 它将启动游戏并在聊天窗口中打印 “Hello world”。)

The Main class

翻译:(主类)

The core of every custom logic script is the Main class. This class is responsible for most of the game mode logic, and receives important event callbacks.

翻译:(每个自定义逻辑脚本的核心是 Main 类。这个类负责大部分游戏模式的逻辑,并接收重要的事件回调。)

class Main
{
    function OnGameStart()
    {
        Game.Print("Hello world");
    }
}

Here, class Main means we are declaring a new class named Main. The class named Main is a special class that is always running and always receives event updates.

翻译:(在这里,class Main 意味着我们正在声明一个名为 Main 的新类。名为 Main 的类是一个特殊的类,它始终运行并始终接收事件更新。)

function OnGameStart() means we are declaring a new function named OnGameStart that takes no parameters. OnGameStart is a special function known as an event callback. This means that it gets called by the interpreter under certain circumstances. In this case, OnGameStart is called once every time the game begins.

翻译:(function OnGameStart() 意味着我们正在声明一个名为 OnGameStart 的新函数,该函数不接受任何参数。OnGameStart 是一个被称为事件回调的特殊函数。这意味着在某些情况下它会被解释器调用。在这种情况下,每次游戏开始时都会调用 OnGameStart。)

Game.Print("Hello world"); means we are calling the Game.Print function, which prints out a message to the chat window.

翻译:(Game.Print("Hello world"); 意味着我们正在调用 Game.Print 函数,该函数会在聊天窗口中打印一条消息。)

Notice that curly braces are used to enclose classes and functions, while semicolons are used to end statements.

翻译:(请注意,花括号用于包围类和函数,而分号用于结束语句。)

Variables

变量

Variables are a way of storing data, and can be of different types. These types include primitives (string, bool, int, float, null), builtin object types such as Human or Titan, and any custom classes that you define.
(变量是一种存储数据的方式,并且可以有不同的数据类型。这些类型包括基本数据类型(字符串、布尔值、整数、浮点数、空值)、内置对象类型(如Human或Titan)以及你定义的任何自定义类。)

We modify our previous example by using message = “Hello world”. This stores the “Hello world” string in the message variable, which can then be passed to Game.Print.
(我们通过使用 message = "Hello world" 修改之前的示例。这将“Hello world”字符串存储在 message 变量中,然后可以将该变量传递给 Game.Print。)

class Main
{
    function OnGameStart()
    {
        message = "Hello world";
        Game.Print(message);
    }
}

In this case, message is a local variable. This means that it is only usable in the function it was declared in. If we want to use the variable elsewhere, such as in a different function or class, we will need to declare an instance variable.
(在这种情况下,message 是一个局部变量。这意味着它只能在声明它的函数中使用。如果我们想在其他地方(例如在不同的函数或类中)使用该变量,我们将需要声明一个实例变量。)

class Main
{
    Message = "";

    function OnGameStart()
    {
        self.Message = "Hello world";
        Game.Print(self.Message);
    }
}

Notice that instance variables within the class are referenced by using the self keyword. If we were to reference this variable outside of Main, we would use Main.Message.
(请注意,在类中实例变量是通过使用 self 关键字来引用的。如果我们要在 Main 类之外引用这个变量,我们将使用 Main.Message。)

Types

类型

Variables have different types, such as strings, bools, ints, Human, Titan, etc. Custom logic uses type inferencing, meaning variable types are not explicitly declared but are inferred based on their assignments.
(变量有不同的类型,例如字符串、布尔值、整数、Human、Titan 等等。自定义逻辑使用类型推断,这意味着变量类型不是显式声明的,而是根据它们的赋值来推断的。)

Primitive types are the most basic types of variable. They include:
(基本类型是最基本的变量类型。它们包括:)

  • string (“hello world”). Strings represent text and are declared by enclosing anything with double quotations (" ").
  • float (5.0). Floats represent decimal numbers and are declared by any number with a decimal point.
  • int (5). Ints represent integer numbers and are declared by any number without a decimal.
  • bool (true/false). Bools represent true or false and are declared by using the true or false keywords.
  • null. Null represents the empty or null value, and can be declared by using the null keyword.

翻译:

  • 字符串(“hello world”)。字符串表示文本,通过用双引号(" ")括起任何内容来声明。
  • 浮点数(5.0)。浮点数表示小数,通过任何带有小数点的数字来声明。
  • 整数(5)。整数表示整数,通过任何不带小数点的数字来声明。
  • 布尔值(true/false)。布尔值表示真或假,通过使用 truefalse 关键字来声明。
  • 空值。null 表示空值或无值,可以通过使用 null 关键字来声明。

Some examples of each primitive being declared:
(以下是每种基本类型声明的一些示例:)

class Main
{
    MyString = "Hello world";
    MyFloat = 5.0;
    MyInt = 5;
    MyBool = true;
    MyNull = null;
}

Object types are variable types that are derived from classes. There are also many builtin object types, such as Human, Titan, Vector3, Player. These types are often passed in callback functions.
(对象类型是从类派生的变量类型。也有许多内置对象类型,例如 Human、Titan、Vector3、Player。这些类型经常在回调函数中传递。)

class Main
{
    function OnPlayerSpawn(player, character)
    {
        Game.Print(player.Name);
    }
}

In this example, player is of type Player and character is of type Character. As objects, they may have variable fields that can be referenced such as player.Name.
(在这个例子中,playerPlayer 类型,characterCharacter 类型。作为对象,它们可能有可以引用的变量字段,例如 player.Name。)

Some object types, such as Vector3, Color, or any object types that derive from custom classes can be created and assigned to a variable. This is called instantiation.
(一些对象类型,例如 Vector3、Color,或者任何从自定义类派生的对象类型,可以被创建并赋值给一个变量。这称为实例化。)

class Main
{
    function OnPlayerSpawn(player, character)
    {
        newSpawnPosition = Vector3(0.0, 100.0, 0.0);
        character.Position = newSpawnPosition;
    }
}

Here we create a new Vector3 by using the Vector3(x, y, z) initializer. We then assign it to newSpawnPosition. Finally, we set the character’s position to this Vector3 variable. The effect of this script is that every character will be immediately moved to the (0, 100, 0) position upon spawning.
(在这里,我们使用 Vector3(x, y, z) 初始化器创建一个新的 Vector3 对象。然后将其赋值给 newSpawnPosition。最后,我们将角色的位置设置为这个 Vector3 变量。这个脚本的效果是,每个角色在生成时都会立即移动到 (0, 100, 0) 位置。)

Variable Inspector

变量检查器

Instance variables in the Main class, as well as components, are by default modifiable by the game host. This means that they show up in the “Mode” panel of the game creation window, allowing for hosts to set custom variables for each game mode. Likewise, variables declared in components are visible in the map editor inspector to allow customization across different map objects.
Main 类中的实例变量以及组件,默认情况下可由游戏主机进行修改。这意味着它们会显示在游戏创建窗口的“模式”面板中,从而允许主机为每个游戏模式设置自定义变量。同样,在组件中声明的变量在地图编辑器检查器中可见,以便在不同的地图对象之间进行自定义设置。)

To disable this behavior and make the variable private, precede it with an underscore. This will hide the variable from the inspector.
(若要禁用此行为并将变量设为私有,可在变量名前加一个下划线。这样该变量将不会在检查器中显示。)

class Main
{
    TitansPerWave = 3;
    _privateVariable = false;
}

TitansPerWave will be visible and modifiable by the game host, while _privateVariable will not be visible.
TitansPerWave 会显示出来且游戏主机可以对其进行修改,而 _privateVariable 则不会显示。)

The Description variable, when set to a string, is also shown as a message beneath the Mode panel. This is useful for listing any details you want players to know about the game mode.
(当 Description 变量被设置为字符串时,它会作为一条消息显示在“模式”面板下方。这对于列出你希望玩家了解的有关游戏模式的任何详细信息很有用。)

class Main
{
    Description = "This is a PVP game mode with infinite respawns.";
}

The Tooltip suffix on any Main variable will give additional gamemode information to the player about certain settings. Tooltips are any variable that ends with “Tooltip”. For example, if you have a variable called TitansPerWave, you can add a string field TitansPerWaveTooltip and it will show up as a hint to that setting.
(任何 Main 类变量加上 Tooltip 后缀后,会为玩家提供有关某些设置的额外游戏模式信息。工具提示是指任何以 “Tooltip” 结尾的变量。例如,如果你有一个名为 TitansPerWave 的变量,你可以添加一个字符串字段 TitansPerWaveTooltip,它将作为该设置的提示显示出来。)

class Main
{
    TitansPerWave = 5;
    TitansPerWaveTooltip = "How many titans to spawn per wave.";
}

The Dropbox suffix on any Main variable will convert that variable into a dropbox with the given comma separated options. For example, if you have a variable called TitanSize, you can add a string field TitanSizeDropbox with comma separated options that will be applied to the TitanSize variable. The initial value of TitanSize will be the default value of the dropbox.

Note that dropboxes only support string variables.
(任何 Main 类变量加上 Dropbox 后缀后,会将该变量转换为一个下拉框,其中的选项由逗号分隔。例如,如果你有一个名为 TitanSize 的变量,你可以添加一个字符串字段 TitanSizeDropbox,其中用逗号分隔的选项将应用于 TitanSize 变量。TitanSize 的初始值将是下拉框的默认值。

请注意,下拉框仅支持字符串变量。)

class Main
{
    TitanSize = "Small";
    TitanSizeDropbox = "Small, Medium, Large";
    # Titan Size will now be either "Small", "Medium", or "Large" depending on what the user chooses #
}

Expressions

表达式

Expressions allow us to combine or modify variables, such as addition, subtraction, etc.
(表达式允许我们对变量进行组合或修改,例如进行加法、减法等运算。)

We already looked at one type of expression, which is the set expression. This assigns a value to a variable.
(我们已经了解过一种表达式,即赋值表达式。它用于将一个值赋给一个变量。)

myFloat = 5.5;

We can modify this float variable through addition, subtraction, division, multiplication expressions.
(我们可以通过加法、减法、除法、乘法表达式来修改这个浮点型变量。)

myFloat = myFloat + 5.0;
myFloat = 5.0 / 3.0;
myFloat = (myFloat * 2.0) - 3.5;
myFloat += 5.0;

Parentheses can be used to specify operation priority as in the third example.
(如第三个例子所示,我们可以使用括号来指定运算优先级。)

Be careful not to perform operations on incompatible types. This would throw an error:
(要注意避免对不兼容的类型进行运算,否则会抛出错误:)

vector = Vector3(0, 0, 0);
myInt = 5;
Game.Print(vector + myInt);

You can’t add a vector and an int together! Instead, lets convert the int to vector first before adding them.
(你不能直接将一个向量和一个整数相加!相反,我们应该先将整数转换为向量,然后再进行相加操作。)

Game.Print(vector + Vector3(myInt, myInt, myInt));

This will print out “5, 5, 5”.
(这将输出 “5, 5, 5”。)

We can reference other class fields or method calls in our expressions.
(我们可以在表达式中引用其他类的字段或方法调用。)

myString = Network.MyPlayer.Name + " joined at " + Convert.ToString(Time.GameTime);

Finally, we can use some symbols to modify bool values. They include the following:
(最后,我们可以使用一些符号来修改布尔值,这些符号包括:)

  • == (equals)
  • != (not equals)
  • || (or)
  • && (and)
  • ! (not)
  • < (less than)
  • (greater than)

  • <= (less than or equal)
  • = (greater than or equal)

翻译:

  • ==(等于)
  • !=(不等于)
  • ||(或)
  • &&(与)
  • !(非)
  • <(小于)
  • (大于)

  • <=(小于或等于)
  • =(大于或等于)

myInt = 5;
myBool = myInt == 5; (this returns true)
myBool = !(myInt == 5); (this returns false)
myBool = myInt != 5; (this returns false)
myBool = (myInt == 4 || myInt == 5); (this returns true)
myBool = myInt == 4 && myInt == 5; (this returns false)
myBool = myInt >= 4; (this returns true)

Conditionals

条件语句

Conditionals allow us to execute blocks of code based on certain boolean conditions. They include if, else, and elif.
(条件语句使我们能够根据特定的布尔条件来执行代码块。条件语句包括 ifelseelif。)

Let’s take a look at the basic if conditional, which will execute the block if the condition in parentheses evaluates to true.
(我们来看看基本的 if 条件语句,如果括号内的条件求值为 true,它将执行相应的代码块。)

function OnGameStart()
{
    numPlayers = Network.Players.Count;
    if (numPlayers > 8)
    {
        Game.Print("Too many players!");
    }
}

We can also chain conditionals together by using elif and else. The second elif (else if) block will execute only if its conditional passes and the first conditional failed. The third else statement will always execute as long as the first two conditionals failed.
(我们还可以通过使用 elifelse 将条件语句链接在一起。只有当第二个 elifelse if)块的条件成立且第一个条件不成立时,该块才会执行。只要前两个条件都不成立,第三个 else 语句就会执行。)

function OnGameStart()
{
    numPlayers = Network.Players.Count;
    if (numPlayers > 8)
    {
        Game.Print("Too many players!");
    }
    elif (numPlayers > 4)
    {
        Game.Print("Just the right number of players.");
    }
    else
    {
        Game.Print("Too few players!");
    }
}

Conditionals can also use expressions in their check statement.
(条件语句在其检查语句中也可以使用表达式。)

if ((numPlayers * 2) > 8 || numPlayers <= 4 * 3)

Loops

循环

Loops allow us to execute blocks of code continuously. There are two kinds of loops: while, and for.
(循环允许我们持续执行代码块。有两种循环类型:while 循环和 for 循环。)

Let’s take a look at the while loop, which will execute the block repeatedly until the conditional fails.
(我们来看一下 while 循环,它会反复执行代码块,直到条件不成立。)

i = 0;
while (i < 10)
{
    Game.Print(Convert.ToString(i));
    i = i + 1;
}

This will print out 0 to 9, since once i reaches 10 the loop will break.
(这将输出0到9,因为一旦 i 达到10,循环就会终止。)

For loops allow us to iterate over collections such as lists and ranges.
for 循环允许我们遍历诸如列表和范围等集合。)

for (player in Network.Players)
{
    Game.Print(player.Name);
}

Here, Network.Players returns a List of players which is an iterable, meaning it can be read in sequence. This for loop will print out each player’s name.
(这里,Network.Players 返回一个玩家列表,它是一个可迭代对象,这意味着可以按顺序读取。这个 for 循环将输出每个玩家的名字。)

The Range() class allows us to create convenient iterables of integers to loop over. This is useful if you want to quickly iterate over a range of numbers for example.
Range() 类允许我们创建方便的整数可迭代对象来进行循环。例如,如果你想快速遍历一定范围的数字,这会很有用。)

for (i in Range(0, 10, 1))
{
    Game.SpawnTitans("Default", i);
}

Range takes 3 ints: Start, End, and Step. Start is the first number the range begins at, End is the last number (exclusive), and Step is how much the variable will increment each loop. In this case, i begins at 0, increases by 1 at each loop, and breaks once it reaches 10.
Range 接受3个整数参数:起始值、结束值和步长。起始值是范围开始的第一个数字,结束值是最后一个数字(不包含该值),步长是每次循环变量增加的量。在这种情况下,i 从0开始,每次循环增加1,一旦达到10就终止。)

Functions

函数

Functions are pieces of executable code within classes. There are two types of functions: custom and callback. Custom functions are only called when explicitly used in the script, while callback functions are called based on certain conditions. Both however are declared the same way.
(函数是类中的可执行代码片段。函数有两种类型:自定义函数和回调函数。自定义函数只有在脚本中被显式调用时才会执行,而回调函数会根据特定条件被调用。不过,这两种函数的声明方式是相同的。)

Let’s first create a helper function that spawns some titans at certain locations.
(首先,让我们创建一个辅助函数,用于在特定位置生成一些泰坦。)

class Main
{
    function OnGameStart()
    {
        self.SpawnTitans(8);
    }
    
    function SpawnTitans(num)
    {
        location1 = Vector3(-50, 0, 0);
        location2 = Vector3(50, 0, 0);
        Game.SpawnTitansAt("Default", num, location1);
        Game.SpawnTitansAt("Default", num, location2);
    }
}

OnGameStart is a callback function that is called once upon the game round starting. SpawnTitans is a custom function that is unused until we call it in OnGameStart. Here we spawn 8 titans each at the positions (-50, 0, 0) and (50, 0, 0).
OnGameStart 是一个回调函数,在游戏回合开始时会被调用一次。SpawnTitans 是一个自定义函数,直到我们在 OnGameStart 中调用它之前,它都不会被使用。在这里,我们在位置 (-50, 0, 0) 和 (50, 0, 0) 各生成了 8 个泰坦。)

Notice the self that precedes the function call. This is used to reference anything that is defined in the current class, including instance variables and functions. On the other hand, we reference the Game class in order to call its SpawnTitansAt function.
(注意函数调用前的 self。它用于引用当前类中定义的任何内容,包括实例变量和函数。另一方面,我们引用 Game 类是为了调用它的 SpawnTitansAt 函数。)

When declaring the SpawnTitans function, we included a parameter num. Parameters allow us to pass values when calling the function, which can then be used as a local variable within the function.
(在声明 SpawnTitans 函数时,我们包含了一个参数 num。参数允许我们在调用函数时传递值,这些值可以在函数内部作为局部变量使用。)

Functions can also return values.
(函数也可以返回值。)

class Main
{
    function OnCharacterDie(victim, killer, name)
    {
        if (killer != null)
        {
            damage = self.CalculateDamage(killer.Velocity);
            Game.Print(name + " dealt " + Convert.ToString(damage));
        }
    }
    
    function CalculateDamage(velocity)
    {
        damage = velocity.Magnitude * 10.0;
        return damage;
    }
}

Here, OnCharacterDie is a callback function that is called whenever a character dies. The CalculateDamage function returns a float value that can then be used in OnCharacterDie to print out the damage dealt.
(在这里,OnCharacterDie 是一个回调函数,每当一个角色死亡时就会被调用。CalculateDamage 函数返回一个浮点值,这个值可以在 OnCharacterDie 中用于输出造成的伤害。)

Coroutines

协程

Coroutines are like functions except run in the background, while normal functions will interrupt the game until the function is completed. Coroutines can make use of the “wait” keyword in order to pause the function without blocking the game.
(协程类似于函数,但它是在后台运行的,而普通函数会中断游戏,直到函数执行完毕。协程可以使用 “wait” 关键字来暂停函数,同时不会阻塞游戏。)

Below is an example of a coroutine that runs a cutscene. The wait calls allow the function to pause in the background without interrupting the main execution. To call coroutines you can call them just like any other function.
(以下是一个运行过场动画的协程示例。“wait” 调用允许函数在后台暂停,而不中断主程序的执行。调用协程的方式和调用其他函数一样。)

coroutine Start()
{
    spawn = Map.FindMapObjectByName("AnnieSpawnPoint");
    startPosition = Vector3(-85, 40, 132);
    startRotation = Vector3(2, 12.4, 0);
    velocity = Vector3.GetRotationDirection(startRotation, Vector3.Back).Normalized * 5.0;
    Cutscene.SetCameraPosition(startPosition);
    Cutscene.SetCameraRotation(startRotation);
    Cutscene.SetCameraVelocity(velocity);
    Cutscene.ShowDialogue("Levi1", "Levi", "Defeat the female titan before she escapes the forest!");
    wait 1.0;
    if (Network.IsMasterClient)
    {
        annie = Game.SpawnShifterAt("Annie", spawn.Position);
        annie.Rotation = Vector3(0, 180, 0);
    }
    wait 4.0;
}

Classes

Classes allow you create modular pieces of code, which can be useful for separating custom logic into manageable pieces. In the previous section we explored the Main class, which is a special class that is always initialized and run upon game start. Besides Main, there are several kinds of classes: Normal classes, components, extensions, and cutscenes. For now we will look at the normal class.
(类允许你创建模块化的代码片段,这有助于将自定义逻辑拆分成易于管理的部分。在上一节中,我们探讨了 Main 类,它是一个特殊的类,在游戏启动时会始终被初始化并运行。除了 Main 类之外,还有几种类型的类:普通类、组件、扩展和过场动画类。目前,我们将关注普通类。)

class Main
{
    function Init()
    {
        numberPrinter = NumberPrinter();
        numberPrinter.Print(5);
    }
}

class NumberPrinter
{
    function Init()
    {
        Game.Print("Init");
    }
    
    function Print(num)
    {
        Game.Print(Convert.ToString(num));
    }
}

function Init() is called in every class upon creation.
(每个类在创建时都会调用 Init() 函数。)

class NumberPrinter declares a new class NumberPrinter, similar to the way we declared the Main class. Since this is a normal class it does not have access to the callback functions that Main has, except for Init().
class NumberPrinter 声明了一个新的类 NumberPrinter,这与我们声明 Main 类的方式类似。由于这是一个普通类,除了 Init() 之外,它无法访问 Main 类所拥有的回调函数。)

numberPrinter = NumberPrinter() creates an instance of the NumberPrinter class and stores it in the numberPrinter variable.
numberPrinter = NumberPrinter() 创建了 NumberPrinter 类的一个实例,并将其存储在 numberPrinter 变量中。)

numberPrinter.Print(5) calls the Print function on our instance variable. The output of this program is “Init” followed by “5”.
numberPrinter.Print(5) 调用了实例变量的 Print 函数。这个程序的输出是先显示 “Init”,接着显示 “5”。)

Like Main, custom classes can contain their own instance variables and functions.
(和 Main 类一样,自定义类可以包含它们自己的实例变量和函数。)

Static Classes

静态类

You may have noticed that some classes, such as Game or Convert can be referenced directly without first creating an instance. These are known as static classes - meaning there is only one instance that can be globally accessed from anywhere in the script. Many common functions, such as spawning titans and performing math operations, will be found in these static classes.
(你可能已经注意到,有些类,比如 GameConvert,无需先创建实例就可以直接引用。这些被称为静态类 —— 这意味着只有一个实例,并且可以在脚本的任何地方全局访问。许多常见的函数,比如生成泰坦和执行数学运算,都可以在这些静态类中找到。)

class Main
{
    function OnGameStart()
    {
        numTitans = Math.Pow(2, 5);
        Game.SpawnTitans("Default", numTitans);
    }
}

Main is also a static class, and can be referenced from anywhere just like Math or Game.
Main 也是一个静态类,就像 MathGame 一样,可以在任何地方被引用。)

class TitanSpawner
{
    function Spawn()
    {
        num = Main.TitansPerWave;
        Game.SpawnTitans("Default", num);
    }
}

Components

组件

Components are a type of class that can be added to map objects through the map editor. They have access to the callback functions Main has, as well as some unique ones such as collisions and network events.
(组件是一种可以通过地图编辑器添加到地图对象中的类。它们可以访问 Main 类拥有的回调函数,以及一些独特的回调函数,例如碰撞和网络事件相关的回调函数。)

Once components are declared and the custom logic is loaded into the map editor, they can be added to objects via the “Add Component” button in the inspector window.
(一旦声明了组件并将自定义逻辑加载到地图编辑器中,就可以通过检查器窗口中的“添加组件”按钮将它们添加到对象中。)

component DamageRegion
{
    Damage = 100;

    function OnCollisionEnter(other)
    {
        if (other.IsCharacter && other.IsMine)
        {
            other.GetDamaged("Server", self.Damage);
        }
    }
}

OnCollisionEnter is a callback function unique components that gets called whenever the map object enters collision with another object. Here we deal 100 damage to any character that collides with the map object.
OnCollisionEnter 是组件特有的回调函数,每当地图对象与另一个对象发生碰撞时就会被调用。在这里,我们对任何与地图对象碰撞的角色造成 100 点伤害。)

The Damage variable will also be visible in the map editor and can be modified in the inspector to a custom value, allowing for different map objects to have a custom Damage value.
Damage 变量在地图编辑器中也会可见,并且可以在检查器中修改为自定义值,这样不同的地图对象就可以有自定义的伤害值。)

Extensions

扩展

Extensions are a way of creating your own static classes, like Game or Convert. This is useful for creating utility functions that can be used globally.
(扩展是一种创建自己的静态类的方式,类似于 GameConvert 类。这对于创建可以全局使用的实用函数很有用。)

class Main
{
    function OnPlayerJoin(player)
    {
        PrettyPrint.PrintJoin(player.Name);
    }
    
    function OnPlayerLeave(player)
    {
        PrettyPrint.PrintLeave(player.Name);
    }
}

extension PrettyPrint
{
    function PrintJoin(name)
    {
        timestamp = self.GetTimestamp(time.GameTime);
        Game.Print(timestamp + " has joined the room.");
    }
    
    function PrintLeave(name)
    {
        timestamp = self.GetTimestamp(time.GameTime);
        Game.Print(timestamp + " has left the room.");
    }
    
    function GetTimestamp(time)
    {
        time = String.FormatFloat(time, 2);
        return "[" + time + "]";
    }
}

翻译:
Main
Main 类中定义了两个回调函数:

  • OnPlayerJoin(player):当有玩家加入时,调用 PrettyPrint 扩展类的 PrintJoin 方法,传入玩家的名字。
  • OnPlayerLeave(player):当有玩家离开时,调用 PrettyPrint 扩展类的 PrintLeave 方法,传入玩家的名字。

PrettyPrint 扩展类
这是自定义的扩展类,包含以下方法:

  • PrintJoin(name):获取当前游戏时间的时间戳,然后打印出包含该时间戳和玩家加入信息的消息。
  • PrintLeave(name):获取当前游戏时间的时间戳,然后打印出包含该时间戳和玩家离开信息的消息。
  • GetTimestamp(time):将传入的时间格式化为保留两位小数的字符串,并添加方括号,返回格式化后的时间戳字符串。

Cutscenes

过场动画

Cutscenes are a type of class that can be conveniently referenced using the Cutscene static class.
(过场动画是一种可以通过 Cutscene 静态类方便引用的类。)

Cutscene classes must contain a coroutine “Start”, which will be called upon calling Cutscene.Start(CutsceneClassName: string, full: bool).
(过场动画类必须包含一个协程 Start,当调用 Cutscene.Start(CutsceneClassName: string, full: bool) 时,这个协程会被调用。)

function OnGameStart()
{
    Game.SetPlaylist("Boss");
    Cutscene.Start("MainCutscene", true);
}
cutscene MainCutscene
{
    coroutine Start()
    {
        spawn = Map.FindMapObjectByName("AnnieSpawnPoint");
        startPosition = Vector3(-85, 40, 132);
        startRotation = Vector3(2, 12.4, 0);
        velocity = Vector3.GetRotationDirection(startRotation, Vector3.Back).Normalized * 5.0;
        Camera.SetPosition(startPosition);
        Camera.SetRotation(startRotation);
        Camera.SetVelocity(velocity);
        Cutscene.ShowDialogue("Levi1", "Levi", "Defeat the female titan before she escapes the forest!");
        wait 1.0;
        if (Network.IsMasterClient)
        {
            annie = Game.SpawnShifterAt("Annie", spawn.Position);
            annie.Rotation = Vector3(0, 180, 0);
        }
        wait 4.0;
    }
}

在上述代码中,OnGameStart 函数在游戏开始时被调用,它先设置了播放列表为 “Boss”,然后调用 Cutscene.Start 启动名为 MainCutscene 的过场动画。

MainCutscene 是一个过场动画类,其中的 Start 协程定义了过场动画的具体内容。它首先找到名为 “AnnieSpawnPoint” 的地图对象,设置相机的初始位置、旋转和速度,显示一段对话,等待 1 秒。如果当前客户端是主机,则在指定位置生成一个名为 “Annie” 的角色并设置其旋转,最后再等待 4 秒。

Static Objects

静态对象

In the map editor, you will notice a “Static” checkbox on each map object. This denotes whether the object will ever move, change active status, or change visibility. If you intend on modifying objects using Custom Logic, you must disable the Static attribute. Likewise if you don’t need an object to move or change visibility, you should enable the Static attribute so that the object can benefit from static batching optimization.
(在地图编辑器中,你会注意到每个地图对象上都有一个“静态”复选框。这表示该对象是否会移动、改变激活状态或改变可见性。如果你打算使用自定义逻辑修改对象,则必须禁用“静态”属性。同样,如果你不需要对象移动或改变可见性,你应该启用“静态”属性,以便该对象能够受益于静态批处理优化。)

By default all objects are static unless the checkbox is disabled.
(默认情况下,所有对象都是静态的,除非禁用该复选框。)

Networking

网络功能

In the map editor, you will notice a “Networked” checkbox on each map object. This denotes whether the object will be using Custom Logic networking functions such as NetworkView and OnNetwork or OnStream callbacks. In order to mark an object for sync and networking, you must enable the “Networked” attribute. Afterwards, the NetworkView object becomes available for access in the custom logic component (via self.NetworkView), and the following network callbacks become available: SendNetworkStream, OnNetworkStream, OnNetworkMessage.
(在地图编辑器中,你会注意到每个地图对象上都有一个“联网”复选框。这表明该对象是否将使用自定义逻辑网络功能,例如 NetworkView 以及 OnNetworkOnStream 回调。为了将某个对象标记为需要进行同步和网络交互,你必须启用“联网”属性。启用之后,在自定义逻辑组件中就可以访问 NetworkView 对象(通过 self.NetworkView),并且以下网络回调函数也将可用:SendNetworkStreamOnNetworkStreamOnNetworkMessage。)

Commenting

注释

Comments allow us to describe code to others reading the custom logic file without interfering with the logic. To make a comment, use the ‘#’ character. Any line starting with ‘#’ will be ignored by the interpreter. You can also use ‘/’ and '/’ to create block comments.
(注释允许我们在不干扰逻辑的情况下,向阅读自定义逻辑文件的其他人描述代码。要创建注释,请使用 ‘#’ 字符。解释器会忽略任何以 ‘#’ 开头的行。你还可以使用 ‘/’ 和 '/’ 来创建块注释。)

Example:
(示例:)

class Main
{
    # this function is called everytime the game starts
    function OnGameStart()
    {
        # spawn some titans
        Game.SpawnTitans("Default", 5);
        
        /* 
           this is a comment block
           that takes up multiple lines
        */
        return;
    }
}

以下是一些静态类和对象的一些文档:

Static Classes

Static Classes

Game(游戏)

Game functions such as spawning titans and managing game state.
翻译:(诸如生成泰坦和管理游戏状态等游戏功能。)

Fields

FieldTypeReadonlyDescription中文描述
IsEndingbooltrueIs the game currently ending.游戏当前是否正在结束。
EndTimeLeftfloattrueTime left before game restarts.游戏重新开始前剩余的时间。
TitansList(Titan)trueList of titans currently alive.当前存活的泰坦列表。
ShiftersList(Shifter)trueList of shifters currently alive.当前存活的变身者列表。
HumansList(Human)trueList of humans currently alive.当前存活的人类列表。
AITitansList(Titan)trueList of AI titans currently alive.当前存活的AI泰坦列表。
AIShiftersList(Shifter)trueList of AI shifters currently alive.当前存活的AI变身者列表。
AIHumansList(Human)trueList of AI humans currently alive.当前存活的AI人类列表。
PlayerTitansList(Titan)trueList of player titans currently alive.当前存活的玩家操控泰坦列表。
PlayerShiftersList(Shifter)trueList of player shifters currently alive.当前存活的玩家操控变身者列表。
PlayerHumansList(Human)trueList of player humans currently alive.当前存活的玩家操控人类列表。
LoadoutsList(string)trueList of allowed player loadouts.允许的玩家装备列表。
DefaultShowKillScoreboolfalseDefault kill score behavior. If set to false, kill scores (damage popup) will not automatically show upon player dealing character damage.默认的击杀得分行为。如果设置为false,玩家造成角色伤害时,击杀得分(伤害弹出框)将不会自动显示。
DefaultShowKillFeedboolfalseDefault kill feed behavior. If set to false, kill feeds (feed popup) will not automatically show upon player kills.默认的击杀反馈行为。如果设置为false,玩家击杀时,击杀反馈(反馈弹出框)将不会自动显示。
DefaultAddKillScoreboolfalseDefault add score behavior. If set to false, kills will not automatically modify kills/damage/deaths stats.默认的添加得分行为。如果设置为false,击杀将不会自动修改击杀/伤害/死亡统计数据。
ShowScoreboardStatusboolfalseWhether to show player alive/dead status in the scoreboard.是否在计分板中显示玩家的存活/死亡状态。
ShowScoreboardLoadoutboolfalseWhether to show player character/loadout in the scoreboard.是否在计分板中显示玩家角色/装备。
ForcedCharacterTypeboolfalseThe forced character for the local player. Upon next spawn or SpawnPlayer call, the player will spawn as this character instead of their chosen character. Available characters: Human, Titan, Shifter.本地玩家的强制角色。在下一次重生或调用SpawnPlayer时,玩家将以此角色重生,而不是他们选择的角色。可用角色:人类、泰坦、变身者。
ForcedLoadoutboolfalseThe forced loadout for the local player. Upon next spawn, the player will spawn using this loadout. Available loadouts per character type:
Shifter: Annie, Eren
Titan: Small, Medium, Large
Human: Blades, AHSS, APG, Thunderspears
本地玩家的强制装备。在下一次重生时,玩家将使用此装备重生。每个角色类型可用的装备:
变身者:安妮、艾伦
泰坦:小型、中型、大型
人类:利刃、AHSS、APG、雷枪

Functions

FunctionReturnsDescription中文描述
Debug(message: string)nullPrints a message to the debug console (accessible using F11).向调试控制台打印一条消息(可使用F11访问)。
Print(message: string)nullPrints a message to the chat window.向聊天窗口打印一条消息。
PrintAll(message: string)nullPrints a message to all players chat window.向所有玩家的聊天窗口打印一条消息。
End(delay: float)nullEnds the game and restarts after given delay. Master client only.结束游戏并在给定延迟后重新开始。仅主客户端可用。
SpawnTitan(type: string)TitanSpawn a titan. Master client only. Valid types: “Default”, “Dummy”, “Normal”, “Abnormal”, “Punk”, “Crawler”, “Thrower”.生成一个泰坦。仅主客户端可用。有效类型:“Default”、“Dummy”、“Normal”、“Abnormal”、“Punk”、“Crawler”、“Thrower”。
SpawnTitanAt(type: string, position: Vector3, optional rotationY: float)TitanSpawn a titan at position. Master client only.在指定位置生成一个泰坦。仅主客户端可用。
SpawnTitans(type:string, amount: int)List(Titan)Spawn amount titans. Master client only.生成指定数量的泰坦。仅主客户端可用。
SpawnTitansAt(type:string, amount: int, position: Vector3, optional rotationY: float)List(Titan)Spawn amount titans at position. Master client only.在指定位置生成指定数量的泰坦。仅主客户端可用。
SpawnTitansAsync(type: string, amount: int)nullSpawn amount titans over time. Note that no titan list is returned.随时间生成指定数量的泰坦。请注意,不会返回泰坦列表。
SpawnTitansAtAsync(type: string, amount: int, position: Vector3, optional rotationY: float)nullSpawn amount titans at position over time.随时间在指定位置生成指定数量的泰坦。
SpawnShifter(type: string)ShifterSpawn a shifter. Master client only. Valid types: “Annie”生成一个变身者。仅主客户端可用。有效类型:“Annie”
SpawnShifterAt(type: string, position: Vector3, optional rotationY: float)ShifterSpawn a shifter at position.在指定位置生成一个变身者。
SpawnPlayer(player: Player, force: bool)nullSpawns the given player. Must be the given player or masterclient. If force is true, will kill the existing player and respawn them, otherwise will only spawn if the player is dead.生成指定玩家。必须是指定玩家或主客户端。如果force为true,将杀死现有玩家并重新生成他们,否则仅在玩家死亡时生成。
SpawnPlayerAt(player: Player, force: bool, position: Vector3, optional rotationY: float)nullSpawns the player at a given position.在指定位置生成玩家。
SpawnPlayerAll(force: bool)nullSpawns all players. Master client only.生成所有玩家。仅主客户端可用。
SpawnPlayerAtAll(force: bool, position: Vector3, optional rotationY: float)nullSpawns all players at position.在指定位置生成所有玩家。
GetGeneralSetting(setting: string)bool / int / float / stringRetrieves the value of the given general tab setting. Dropdown setting’s values are ordered 0,n.
Example: GetGeneralSetting(“Difficulty”) returns 0 for training, 1 for easy, 2 for normal, and 3 for hard.
获取给定常规选项卡设置的值。下拉设置的值按0,n排序。
示例:GetGeneralSetting(“Difficulty”),返回0表示训练,1表示简单,2表示普通,3表示困难。
GetTitanSetting(setting: string)bool / int / float / stringRetrieves the value of the given titan tab setting.获取给定泰坦选项卡设置的值。
GetMiscSetting(setting: string)bool / int / float / stringRetrieves the value of the given misc tab setting. Dropdown setting’s values are ordered 0,n.
Example: GetMiscSetting(“PVP”)
returns results ordered 0,n in order of the dropdown list of the setting.
0 for off, 1 for ffa, and 2 for teams.
获取给定杂项选项卡设置的值。下拉设置的值按0,n排序。
示例:GetMiscSetting(“PVP”)
按设置的下拉列表顺序返回0,n的结果。
0表示关闭,1表示自由对战,2表示团队模式。
SpawnProjectile(projectile: string, position: Vector3, rotation: Vector3, velocity: Vector3, gravity: Vector3, liveTime: float, team: string, [extra params])nullSpawns a projectile. Valid projectiles: ThunderSpear, CannonBall, Flare, BladeThrow, Smokebomb, Rock1. ThunderSpear takes two extra params (radius: float, color: Color)
Flare takes extra param (color: Color).
生成一个投射物。有效投射物:雷枪、炮弹、信号弹、飞刀、烟雾弹、Rock1。雷枪需要两个额外参数(radius: float, color: Color)
信号弹需要额外参数(color: Color)。
SpawnProjectileWithOwner(projectile: string, position: Vector3, rotation: Vector3, velocity: Vector3, gravity: Vector3, liveTime: float, owner: Character, [extra params])nullSpawns a projectile from the given character as its owner.从给定角色作为所有者生成一个投射物。
SpawnEffect(effect: string, position: Vector3, rotation: Vector3, scale: float, [params])nullSpawns an effect. Valid effects can be found here (left-hand variable name). ThunderSpearExplode takes extra params explodeColor (Color) and killSound (bool).生成一个特效。有效特效可在此处找到(左侧变量名)。ThunderSpearExplode需要额外参数explodeColor (Color) 和killSound (bool)。
SetPlaylist(playlist: string)nullSets the music playlist. Valid playlists: Default, Boss, Menu, Peaceful, Battle, Racing设置音乐播放列表。有效播放列表:Default、Boss、Menu、Peaceful、Battle、Racing
SetSong(song: string)nullSets the music song.设置音乐歌曲。
FindCharacterByViewID(viewID: int)CharacterReturns character from View ID.根据视图ID返回角色。
ShowKillScore(score: int)nullLocally shows a kill score popup for the player.为玩家在本地显示击杀得分弹出框。
ShowKillFeed(killer: string, victim: string, score: int, weapon: string)nullLocally shows a kill feed for the player. Valid weapon icons: Blades, AHSS, APG, Thunderspear, Titan, Shifter.为玩家在本地显示击杀反馈。有效武器图标:利刃、AHSS、APG、雷枪、泰坦、变身者。
ShowKillFeedAll(killer: string, victim: string, score: int, weapon: string)nullShows a kill feed for all players. Can be called by anyone.为所有玩家显示击杀反馈。任何人都可以调用。

Network(网络)

Networking functions.

翻译:(网络相关功能。)

Fields

FieldTypeReadonlyDescription中文描述
IsMasterClientbooltrueIs current player the master client.当前玩家是否为主客户端。
PlayersList(Player)trueList of all players in the room.房间内所有玩家的列表。
MasterClientPlayertrueThe current master client.当前的主客户端。
MyPlayerPlayertrueMy player.我的玩家。
NetworkTimefloattrueThe current photon network time. This will probably be different from the Game time.当前的光子网络时间。这可能与游戏时间不同。
PingfloattrueThe current local player’s ping.当前本地玩家的延迟。

Functions

FunctionReturnsDescription中文描述
SendMessage(target: Player, message: string)nullSend a network message to the target player. This will be received in the OnNetworkMessage callback in Main.向目标玩家发送一条网络消息。该消息将在主程序的OnNetworkMessage回调函数中被接收。
SendMessageAll(message: string)nullSend a network message to all players including yourself.向包括自己在内的所有玩家发送一条网络消息。
SendMessageOthers(message: string)nullSend a network message to all players excluding yourself.向除自己之外的所有玩家发送一条网络消息。
GetTimestampDifference(float t1, float t2)floatCompute the wrapped timestamp difference from photon events. Used to determine delay.计算来自光子事件的环绕时间戳差异。用于确定延迟。
KickPlayer(player : Player 或 int, reason=“”)nullKick the player via ID or Player object from the room, only callable by the host.通过ID或玩家对象将玩家从房间踢出,仅主机可调用此操作。

Map(地图)

Finding, creating, and destroying map objects.

翻译:(查找、创建和销毁地图对象。)

Functions

FunctionReturnsDescription中文描述
FindAllMapObjects()List(MapObject)Returns all map objects in the game.返回游戏中所有的地图对象。
FindMapObjectByName(name: string)MapObjectReturns the first map object matching the given name返回第一个与给定名称匹配的地图对象。
FindMapObjectsByName(name: string)List(MapObject)Returns a list of map objects matching the given name返回与给定名称匹配的地图对象列表。
FindMapObjectByID(id: int)MapObjectReturns the map object matching ID.返回与给定ID匹配的地图对象。
FindMapObjectByTag(tag: string)MapObjectReturns the first map object that has a tag component matching the given name返回第一个具有与给定名称匹配的标签组件的地图对象。
FindMapObjectsByTag(tag: string)List(MapObject)Returns a list of map objects matching the given tag返回与给定标签匹配的地图对象列表。
FindMapObjectsByComponentList(MapObject)Returns a list of map objects which have the corresponding CL component attached返回附有相应CL组件的地图对象列表。
CreateMapObjectRaw(data: string)MapObjectCreates a map object given the raw data string, which corresponds to a map file CSV row根据原始数据字符串创建一个地图对象,该字符串对应于地图文件的CSV行。
DestroyMapObject(obj: MapObject, includeChildren: bool)nullDestroys the given map object, and its children if includeChildren is true.销毁给定的地图对象,如果includeChildren为true,则同时销毁其子对象。
CopyMapObject(obj: MapObject, includeChildren: bool)MapObjectCreates a copy of the given map object, and its children if includeChildren is true.创建给定地图对象的副本,如果includeChildren为true,则同时复制其子对象。
DestroyMapTargetable(obj: MapTargetable)nullDestroys the given map targetable (see MapObject on creating AI targets).销毁给定的地图可目标对象(有关创建AI目标,请参阅MapObject)。
UpdateNavMeshnullUpdates the Navmesh (host only). This operation may take a while depending on the map size. If you have a bad computer, please use UpdateNavMeshAsync to avoid disconnecting due to the non - async method hanging. (honestly I have no idea why you would want to use this but whatever)更新导航网格(仅主机)。此操作可能需要一些时间,具体取决于地图大小。如果你的电脑性能不佳,请使用UpdateNavMeshAsync以避免因非异步方法挂起而断开连接。(说实话,我不明白你为什么要使用这个,但随便啦)
UpdateNavMeshAsyncnullUpdates the Navmesh (host only) asynchronously and (hopefully) should not hang. This process is still somewhat CPU intensive so maybe pause the game or add in a loading screen when using this. For realtime dynamic changes to the map, please use the NavMeshObstacle Component.异步更新导航网格(仅主机),并且(希望)不会挂起。此过程仍然有点消耗CPU资源,因此使用时可以暂停游戏或添加加载屏幕。对于地图的实时动态更改,请使用NavMeshObstacle组件。

UI(用户界面)

UI label functions.

翻译:(用户界面标签相关功能。)

Functions

FunctionReturnsDescription中文描述
SetLabel(type: string, label: string)nullSets the label at a certain location. Valid types: “TopCenter”, “TopLeft”, “TopRight”, “MiddleCenter”, “MiddleLeft”, “MiddleRight”, “BottomLeft”, “BottomRight”, “BottomCenter”.在特定位置设置标签。有效的位置类型有:“TopCenter”(顶部中央)、“TopLeft”(顶部左侧)、“TopRight”(顶部右侧)、“MiddleCenter”(中间中央)、“MiddleLeft”(中间左侧)、“MiddleRight”(中间右侧)、“BottomLeft”(底部左侧)、“BottomRight”(底部右侧)、“BottomCenter”(底部中央)。
SetLabelForTime(type: string, label: string, time: float)nullSets the label for a certain time, after which it will be cleared.在特定位置设置标签,并显示指定的时间,时间结束后标签会被清除。
SetLabelAll(type: string, label: string)nullSets the label for all players. Master client only. Be careful not to call this often.为所有玩家设置标签。仅主客户端可调用。注意不要频繁调用此函数。
SetLabelForTimeAll(type: string, label: string, time: float)nullSets the label for all players for a certain time. Master client only.为所有玩家设置标签,并显示指定的时间。仅主客户端可调用。
CreatePopup(name: string, title: string, width: int, height: int)nullCreates a new popup. This popup is hidden until shown.创建一个新的弹出窗口。该弹出窗口在显示之前是隐藏的。
ShowPopup(name: string)nullShows the popup with given name.显示指定名称的弹出窗口。
HidePopup(name: string)nullHides the popup with given name.隐藏指定名称的弹出窗口。
ClearPopup(name: string)nullClears all elements in popup with given name.清除指定名称弹出窗口中的所有元素。
AddPopupLabel(name: string, label: string)nullAdds a text row to the popup with label as content.向弹出窗口中添加一行文本,文本内容为指定的标签内容。
AddPopupButton(popupName: string, buttonName: string, buttonText: string)nullAdds a button row to the popup with given button name and display text. When button is pressed, OnButtonClick is called in Main with buttonName parameter.向弹出窗口中添加一个按钮行,指定按钮名称和显示文本。当按钮被按下时,会在主脚本中调用OnButtonClick函数,并传入按钮名称作为参数。
AddPopupButtons(popupName: string, buttonNames: List, buttonTitles: List)nullAdds a list of buttons in a row to the popup.向弹出窗口中添加一排按钮,按钮名称和标题分别由传入的列表指定。
AddPopupBottomButton(popupName: string, buttonName: string, buttonText: string)nullAdds a button to the bottom bar of the popup.向弹出窗口的底部栏添加一个按钮。
WrapStyleTag(text: string, style: string, args: string)stringReturns a wrapped string given style and args.根据给定的样式和参数返回一个包装后的字符串。
GetLocale(category: string, subcategory: string, key: string)stringGets translated locale from the current Language.json file with given category, subcategory, and key pattern.根据给定的类别、子类别和键模式,从当前的Language.json文件中获取翻译后的本地化字符串。
GetLanguage()stringReturns the current language (ie "English).返回当前使用的语言(例如“English”)。
ShowChangeCharacterMenu()nullShows the change character menu if main character is Human.如果主角是人类,则显示角色切换菜单。
SetScoreboardHeader(header: string)nullSets the display of the scoreboard header (default “Kills / Deaths…”)设置计分板标题的显示内容(默认是“Kills / Deaths…”)。
SetScoreboardProperty(property: string)nullSets which Player custom property to read from to display on the scoreboard. If set to empty string, will use the default “Kills / Deaths…” display.设置从玩家的哪个自定义属性读取数据并显示在计分板上。如果设置为空字符串,则使用默认的“Kills / Deaths…”显示。
GetThemeColor(panel : string, category : string, item : string)ColorGets the color of the specified item. See theme json for reference.获取指定项目的颜色。可参考主题的JSON文件。

Time(时间)

Time functions.

翻译:(时间相关功能。)

Fields

FieldTypeReadonlyDescription中文描述
TickTimefloattrueTime between each tick (0.02 seconds)每个游戏节拍之间的时间(0.02秒)
GameTimefloattrueTime since start of the round.自回合开始以来的时间。
FrameTimefloattrueTime between each frame.每一帧之间的时间。
TimeScalefloatfalseChanges the timescale of the game.改变游戏的时间尺度。

Convert(转换)

Converting objects to different types.

翻译:(将对象转换为不同的类型。)

Functions

FunctionReturnsDescription中文描述
ToFloat(value: object)floatConvert the value to floating type将值转换为浮点类型
ToInt(value: object)intConvert the value to integer type将值转换为整数类型
ToBool(value: object)boolConvert the value to boolean type将值转换为布尔类型
ToString(value: object)stringConvert the value to string type将值转换为字符串类型
IsFloat(value: object)boolReturns true if the object is a float.如果对象是浮点数,则返回true。
IsInt(value: object)boolReturns true if the object is an int.如果对象是整数,则返回true。
IsBool(value: object)boolReturns true if the object is a bool.如果对象是布尔值,则返回true。
IsString(value: object)boolReturns true if the object is a string.如果对象是字符串,则返回true。
IsObject(value: object)boolReturns true if the object is an Object. You can use value.Type for further type checking.如果对象是一个对象,则返回true。你可以使用value.Type进行进一步的类型检查。

String(字符串)

String manipulation functions.

翻译:(字符串操作功能。)

Fields

FieldReturnsDescription中文描述
NewlinestringReturns the newline character.返回换行符。

Functions

FunctionReturnsDescription中文描述
FormatFloat(num: float, decimals: int)stringFormat the float to decimal places.将浮点数格式化为指定的小数位数。
FormatFromList(value : string, formatter : list)stringEquivalent to C## string.format(string, List)等同于C##中的string.format(string, List)
Split(value: string, splitter : string 或 list, removeEmpty=False)List(string)Split the string into a list. Can pass in either a string to split on or a list of strings to split on, the last optional param can remove all empty entries.将字符串分割成一个列表。可以传入一个用于分割的字符串,也可以传入一个用于分割的字符串列表,最后一个可选参数可以移除所有空项。
Join(value: List, separator: string)stringJoin the list into a string.将列表拼接成一个字符串。
Substring(value: string, startIndex: int)stringSubstring of string from startIndex.从指定起始索引开始截取字符串。
SubstringWithLength(value: string, startIndex: int, length: int)stringSubstring of string from startIndex and with given length.从指定起始索引开始截取指定长度的字符串。
Length(value: string)intLength of the string.字符串的长度。
Replace(value: string, match: string, with: string)stringReplace all matches in the string with the replacement.将字符串中所有匹配项替换为指定的字符串。
Contains(value: string, match: string)boolIf the string contains match.判断字符串是否包含指定的匹配项。
IndexOf(value: string, item: string)intReturns the index of the given string.返回指定字符串的索引。
StartsWith(value: string, match: string)boolIf the string starts with match.判断字符串是否以指定的匹配项开头。
EndsWith(value: string, match: string)boolIf the string ends with match.判断字符串是否以指定的匹配项结尾。
Trim(value: string)stringTrim all whitespace from start and end of string.去除字符串首尾的所有空白字符。
Insert(value: string, insert: string, index: int)stringInsert a string at given index.在指定索引位置插入一个字符串。
Capitalize(value: string)stringCapitalizes the first letter of the string.将字符串的首字母大写。
ToUpper(value: string)stringReturns string in upper case.返回全大写的字符串。
ToLower(value: string)stringReturns string in lower case.返回全小写的字符串。

Input(输入)

Reading player key inputs. Note that inputs are best handled in OnFrame rather than OnTick, due to being updated every frame and not every physics tick.

翻译:(读取玩家的按键输入。请注意,由于输入是每帧更新而不是每个物理节拍更新,因此最好在OnFrame而不是OnTick中处理输入。)

Functions

FunctionReturnsDescription中文描述
GetKeyName(key: string)stringGets the key name the player assigned to the key setting. Example: GetKeyName(“General/Forward”) will return the keybind at that setting. All input names can be found Here, with the file name being the category and the left-hand variable being the key name. For example, TitanInputSettings.cs contains the variable CoverNape, which can be referenced as “Titan/CoverNape”.获取玩家为按键设置分配的键名。示例:GetKeyName(“General/Forward”) 将返回该设置对应的按键绑定。所有输入名称可在此处找到,文件名代表类别,左侧变量为键名。例如,TitanInputSettings.cs 包含变量 CoverNape,可引用为 “Titan/CoverNape”。
GetKeyHold(key: string)boolWhether or not the key is being held down. Example: GetKey(“Human/HookLeft”)该按键是否正在被按住。示例:GetKey(“Human/HookLeft”)
GetKeyDown(key: string)boolWhether or not the key is first pressed this frame.该按键是否在本帧首次被按下。
GetKeyUp(key: string)boolWhether or not the key is first released this frame.该按键是否在本帧首次被释放。
GetMouseAim()Vector3Gets a Vector3 that represents the point the mouse pointer is aiming at. Note that this is not a direction but a world-space position of the closest object the mouse is aiming at.获取一个表示鼠标指针瞄准点的三维向量。请注意,这不是一个方向,而是鼠标瞄准的最近对象在世界空间中的位置。
GetMouseSpeed()Vector3Gets the user mouse speed.获取用户鼠标的移动速度。
GetMousePosition()Vector3Gets the user mouse position.获取用户鼠标的位置。
CursorAimDirection()Vector3Gets the direction ray of the cursor.获取光标所指方向的射线向量。
GetScreenDimensions()Vector3Gets the user screen dimensions.获取用户屏幕的尺寸。
SetKeyDefaultEnabled(key: string)nullWhether or not keybind default behavior is enabled. If set to false, the keybind will not trigger the normal in-game action.按键绑定的默认行为是否启用。如果设置为 false,该按键绑定将不会触发正常的游戏内操作。
SetKeyHold(key: string)nullWhether or not the keybind is simulated to be held. If set to true, the game will act as if the player is holding down the key.是否模拟按键绑定被按住的状态。如果设置为 true,游戏将表现得好像玩家正在按住该按键。

Math(数学)

Math functions. Note that parameter types can be either int or float unless otherwise specified. Functions may return int or float depending on the parameter types given.

翻译:(数学相关函数。请注意,除非另有说明,参数类型可以是整数或浮点数。函数的返回值类型可能是整数或浮点数,具体取决于所给的参数类型。)

Fields

FieldTypeReadonlyDescription中文描述
PIfloattrueMathf.PI圆周率π的值,等同于Mathf.PI
InfinityfloattrueMathf.Infinity正无穷大,等同于Mathf.Infinity
Rad2DegConstantfloattrueMathf.Rad2Deg弧度转角度的常量,等同于Mathf.Rad2Deg
Deg2RadConstantfloattrueMathf.Deg2Rad角度转弧度的常量,等同于Mathf.Deg2Rad

Functions

FunctionReturnsDescription中文描述
Clamp(value, min, max)int/floatClamps the value between min and max.将值限制在最小值和最大值之间。
Max(a, b)int/floatMaximum of a and b.返回a和b中的最大值。
Min(a, b)int/floatMinimum of a and b.返回a和b中的最小值。
Pow(a, b)floata to the power of b.计算a的b次幂。
Abs(a)int/floatAbsolute value of a.返回a的绝对值。
Sqrt(a)floatSquare root of a.计算a的平方根。
Mod(a, b)intModulo of a % b计算a除以b的余数。
Ceil(a)intRounds to higher int.向上取整,返回大于或等于a的最小整数。
Floor(a)intRounds to lower int.向下取整,返回小于或等于a的最大整数。
Round(a)intRounds to nearest int.四舍五入取整,返回最接近a的整数。
Sin(a)floatSin of a, in degrees.计算a的正弦值,a为角度。
Cos(a)floatCosine of a.计算a的余弦值。
Tan(a)floatTan of a.计算a的正切值。
Asin(a)floatArcsin of a, in degrees.计算a的反正弦值,结果为角度。
Acos(a)floatArccos of a.计算a的反余弦值。
Atan(a)floatArctan of a.计算a的反正切值。
Atan2(a, b)floatAtan2 of a and b.计算a和b的四象限反正切值。
Deg2Rad(a)floatConverts a degrees to radians.将角度a转换为弧度。
Rad2Deg(a)floatConverts a radians to degrees.将弧度a转换为角度。
Lerp(a, b, t)floatLinearly interpolates between a and b by t where t is limited from 0 to 1.在a和b之间进行线性插值,t的取值范围限制在0到1之间。
LerpUnclamped(a, b, t)floatLinearly interpolates between a and b by t with no limit to t.在a和b之间进行线性插值,t的取值没有限制。
Sign(a)floatReturns a value of 1 when a is 0 or greater. Returns a value of -1 when a is negative.当a大于或等于0时返回1,当a为负数时返回 -1。

Random(随机)

Randomization functions.

翻译:(随机化相关功能。)

Functions

FunctionReturnsDescription中文描述
RandomInt(min: int, max: int)intReturns random integer between min and max (exclusive).返回一个介于min和max之间的随机整数(不包含max)。
RandomFloat(min: float, max: float)floatReturns random float between min and max.返回一个介于min和max之间的随机浮点数。
RandomBool()boolReturns random boolean.返回一个随机布尔值。
RandomDirection()Vector3Returns random normalized Vector3.返回一个随机的归一化三维向量。
RandomSign()intReturns either -1 or 1.返回 -1 或者 1。
RandomVector3(min: Vector3, max: Vector3)Vector3Returns a random Vector3 between min and max.返回一个介于min和max之间的随机三维向量。
PerlinNoise(x: float, y: float)floatReturns a point sampled from generated 2d perlin noise. (see Unity Mathf.PerlinNoise for more information)返回从生成的二维柏林噪声中采样的一个点。(更多信息请参考Unity的Mathf.PerlinNoise)

Cutscene(过场动画)

Cutscene functions.

翻译:(过场动画相关功能。)

Functions

FunctionReturnsDescription中文描述
Start(name: string, full: bool)nullStarts cutscene with name. If full is true, will enter cinematic mode. Otherwise will only show dialogue while still allowing gameplay.启动指定名称的过场动画。如果fulltrue,将进入电影模式;否则仅显示对话,同时仍允许进行游戏。
ShowDialogue(icon: string, title: string, content: string)nullShow dialogue screen with given icon, title, and content. Available icons are the same as profile icon names.显示带有指定图标、标题和内容的对话屏幕。可用的图标与个人资料图标名称相同。
ShowDialogueForTime(icon: string, title: string, content: string, time: float)nullShow dialogue screen and automatically hide after time seconds.显示对话屏幕,并在指定的秒数后自动隐藏。
HideDialogue()nullHides the dialogue screen.隐藏对话屏幕。

对于更详细的过场动画,你可以使用Camera类来控制相机。

Camera(相机)

Camera functions.

翻译:(相机相关功能。)

Fields

FieldReturnsReadonlyDescription中文描述
IsManualbooltrueIs camera in manual mode.相机是否处于手动模式。
PositionVector3trueCurrent camera position.当前相机的位置。
RotationVector3trueCurrent camera rotation.当前相机的旋转角度。
VelocityVector3trueCurrent camera velocity, if set using SetVelocity().如果使用SetVelocity()设置了相机速度,这是当前相机的速度。
FOVfloattrueCurrent camera field of view if set using SetFOV().如果使用SetFOV()设置了相机视野,这是当前相机的视野。
FollowDistancefloatfalseCurrent camera follow distance from target character.当前相机与目标角色的跟随距离。
ForwardVector3falseThe forward direction of the camera.相机的前向方向。
RightVector3falseThe right direction of the camera.相机的右向方向。
UpVector3falseThe up direction of the camera.相机的上向方向。
CameraModeStringtrueThe camera mode.相机的模式。

Functions

FunctionReturnsDescription中文描述
SetManual(bool)nullSets the camera manual mode. If true, camera will only be controlled by custom logic. If false, camera will follow the spawned or spectated player and read input.设置相机的手动模式。如果为true,相机将仅由自定义逻辑控制;如果为false,相机将跟随已生成或正在观察的玩家并读取输入。
SetPosition(position: Vector3)nullSets camera position.设置相机的位置。
SetRotation(rotation: Vector3)nullSets camera rotation.设置相机的旋转角度。
SetVelocity(rotation: Vector3)nullSets camera velocity.设置相机的速度。
LookAt(position: Vector3)nullSets the camera forward direction such that it is looking at a world position.设置相机的前向方向,使其朝向一个世界位置。
SetFOV(fov: float)nullSets the camera field of view. Use 0 to use the default field of view.设置相机的视野。使用0可使用默认视野。
SetCameraMode(mode: string)nullForces the player to use a certain camera mode, taking priority over their camera setting. Accepted values are TPS, Original, FPS.强制玩家使用某种相机模式,优先级高于他们的相机设置。可接受的值为TPS、Original、FPS。
ResetDistance()nullResets the follow distance to player’s settings.将跟随距离重置为玩家的设置。
ResetCameraMode()nullResets the camera mode to player’s settings.将相机模式重置为玩家的设置。

RoomData(房间数据)

Store and retrieve room variables. Room data is cleared upon joining or creating a new lobby and does not reset between game rounds. Supports float, string, bool, and int types.

Note that RoomData is local only and does not sync. You must use network messages to sync room variables.

翻译:(存储和检索房间变量。加入或创建新大厅时,房间数据会被清除,且在游戏回合之间不会重置。支持浮点型、字符串型、布尔型和整型。

请注意,RoomData 仅为本地数据,不会进行同步。你必须使用网络消息来同步房间变量。)

Functions

FunctionReturnsDescription中文描述
SetProperty(name: string, value: object)nullSets the property with given name to the object value. Valid value types are float, string, bool, and int.将指定名称的属性设置为给定的对象值。有效的值类型为浮点型、字符串型、布尔型和整型。
GetProperty(name: string, defaultValue: object)objectGets the property with given name. If property does not exist, returns defaultValue.获取指定名称的属性。如果属性不存在,则返回默认值。
Clear()nullClears all room data.清除所有房间数据。

PersistentData(持久化数据)

Store and retrieve persistent data. Persistent data can be saved and loaded from file. Supports float, int, string, and bool types.

Note that any game mode may use the same file names, so it is recommended that you choose unique file names when saving and loading.

Saved files are located in Documents/Aottg2/PersistentData.

翻译:(存储和检索持久化数据。持久化数据可以从文件中保存和加载。支持浮点型、整型、字符串型和布尔型。

请注意,任何游戏模式都可能使用相同的文件名,因此建议在保存和加载时选择唯一的文件名。

保存的文件位于 Documents/Aottg2/PersistentData 目录下。)

Functions

FunctionReturnsDescription中文描述
SetProperty(name: string, value: object)nullSets the property with given name to the object value. Valid value types are float, string, bool, and int.将指定名称的属性设置为给定的对象值。有效的值类型为浮点型、字符串型、布尔型和整型。
GetProperty(name: string, defaultValue: object)objectGets the property with given name. If property does not exist, returns defaultValue.获取指定名称的属性。如果属性不存在,则返回默认值。
Clear()nullClears current persistent data.清除当前的持久化数据。
SaveToFile(fileName: string, encrypted: bool)nullSaves current persistent data to given file name. If encrypted is true, will also encrypt the file instead of using plaintext.将当前的持久化数据保存到指定的文件名中。如果 encrypted 为 true,则会对文件进行加密,而不是使用明文。
LoadFromFile(fileName: string, encrypted: bool)nullLoads persistent data from given file name. If encrypted is true, will treat the file as having been saved as encrypted.从指定的文件名中加载持久化数据。如果 encrypted 为 true,则会将文件视为已加密保存。
IsValidFileName(fileName: string)boolDetermines whether or not the given fileName will be allowed for use when saving/loading a file.确定给定的文件名在保存/加载文件时是否允许使用。
FileExists(fileName: string)boolDetermines whether the file given already exists. Throws an error if given an invalid file name.确定给定的文件是否已经存在。如果给定的文件名无效,则会抛出错误。

Json(JSON)

Serializes and deserializes primitive and struct values from and to json strings. Supports float, int, string, bool, Vector3, Quaternion, Color, Dict, and List. Dict and List must contain only the supported types, and can be nested.

翻译:(将基本类型和结构体值与JSON字符串进行序列化和反序列化。支持浮点型、整型、字符串型、布尔型、三维向量(Vector3)、四元数(Quaternion)、颜色(Color)、字典(Dict)和列表(List)。字典和列表必须仅包含支持的类型,并且可以嵌套。)

Functions

FunctionReturnsDescription中文描述
LoadFromString(value: string)objectDeserializes the object from a json string.从JSON字符串中反序列化对象。
SaveToString(value: object)stringSerializes the object to a json string.将对象序列化为JSON字符串。

Physics(物理)

Some commonly used physics functions.

翻译:(一些常用的物理相关函数。)

Functions

FunctionReturnsDescription中文描述
LineCast(start: Vector3, end: Vector3, collideWith: string)LineCastHitResultPerforms a linecast between start and end vectors and colliding with the collideWith category (such as “Characters”). If an object is found return that object, otherwise return null.在起始向量和结束向量之间进行射线投射,并与指定碰撞类别(如 “Characters”)的物体进行碰撞检测。若找到碰撞物体则返回该物体,否则返回空。
SphereCast(start: Vector3, end: Vector3, radius: float, collideWith: string)objectPerforms a spherecast between start and end vectors with radius and colliding with the collideWith category (such as “Characters”). If an object is found return that object, otherwise return null.在起始向量和结束向量之间进行球形投射,指定半径,并与指定碰撞类别(如 “Characters”)的物体进行碰撞检测。若找到碰撞物体则返回该物体,否则返回空。

Objects

Objects

Component(组件)

Represents a component script attached to a MapObject.

翻译:(表示附加到地图对象(MapObject)上的组件脚本。)

Fields

FieldTypeReadonlyDescription中文描述
MapObjectMapObjecttrueThe MapObject the component is attached to.该组件所附着的地图对象。
NetworkViewNetworkViewtrueThe NetworkView attached to the MapObject, if Networked is enabled.如果启用了网络功能,该字段表示附着在地图对象上的网络视图。

Object(对象)

All the following objects in custom logic inherits from Object.

翻译:(自定义逻辑中以下所有对象均继承自 Object。)

Fields

FieldTypeReadonlyDescription中文描述
TypestringtrueThe type of the object (such as “Human”)对象的类型(例如 “Human”)
IsCharacterbooltrueWhether or not the object is a Character type or any of its inheritors对象是否为 Character 类型或其任何继承者类型

Character(角色)

Inherits from Object. Character is the base class that Human, Titan, and Shifter inherit from.

Only character owner can modify fields and call functions unless otherwise specified.

翻译:(继承自 Object。Character 是 Human、Titan 和 Shifter 继承的基类。

除非另有说明,否则只有角色所有者可以修改字段和调用函数。)

Fields

FieldTypeReadonlyDescription中文描述
PlayerPlayertrueThe player who owns this character.拥有此角色的玩家。
IsMinebooltrueCharacter belongs to my player.角色属于我的玩家。
IsMainCharacterbooltrueCharacter belongs to my player and is the main character (the camera - followed player).角色属于我的玩家,并且是主角色(即相机跟随的玩家)。
IsAIbooltrueIf the Character is AI.该角色是否为 AI。
ViewIDinttrueThe network view ID of the character. This is synced with the room.角色的网络视图 ID,该 ID 会与房间同步。
TransformTransformtrueThe Unity transform of the character.角色的 Unity 变换组件。
PositionVector3falsePosition of the character.角色的位置。
RotationVector3falseRotation of the character.角色的旋转角度。
QuaternionRotationQuaternionfalseQuaternion rotation of the character.角色的四元数旋转。
VelocityVector3falseVelocity of the character.角色的速度。
ForwardVector3falseForward direction of the character.角色的前向方向。
RightVector3falseRight direction of the character.角色的右向方向。
UpVector3falseUp direction of the character.角色的上向方向。
HasTargetDirectionbooltrueIf the character has a target direction it is turning towards.角色是否有一个正在转向的目标方向。
TargetDirectionVector3trueThe character’s target direction.角色的目标方向。
TeamstringfalseTeam character belongs to (“None”, “Blue”, “Red”, “Titan”, “Human”). This can be set to any string, so any combination of teams is allowed. If modified, it takes priority over the Team field under Player.角色所属的团队(“None”、“Blue”、“Red”、“Titan”、“Human”)。可以设置为任意字符串,因此允许任何团队组合。如果修改,其优先级高于 Player 下的 Team 字段。
NamestringfalseThe display name of the character. If modified, it will affect world name (if human) and feed name. All changes are local, and can be modified by non - owners.角色的显示名称。如果修改,会影响世界中的名称(如果是人类角色)和消息显示名称。所有更改都是本地的,非所有者也可以修改。
GuildstringfalseThe guild name of the character. Same restrictions as Name.角色所属公会的名称。与 Name 字段有相同的限制。
HealthfloatfalseCharacter’s current health. Cannot be set higher than MaxHealth.角色的当前生命值。不能设置为高于最大生命值。
MaxHealthfloatfalseCharacter’s maximum health.角色的最大生命值。
CustomDamageEnabledboolfalseIs custom damage dealing enabled.是否启用自定义伤害处理。
CustomDamageintfalseAmount of custom damage to deal per attack.每次攻击造成的自定义伤害量。
CurrentAnimationstringtrueRead the character’s current playing animation. Returns empty string if no animation playing.读取角色当前正在播放的动画。如果没有动画正在播放,则返回空字符串。
GroundedboolfalseRead whether the character is currently grounded - updated every fixed update.读取角色当前是否着地 - 每固定更新一次进行更新。

Functions

FunctionReturnsDescription中文描述
GetKilled(killer: string)nullKills the character. Callable by non - owners.击杀该角色。非所有者也可以调用。
GetDamaged(killer: string, damage: int)nullDamages the character and kills it if its health reaches 0. Callable by non - owners.对角色造成伤害,如果其生命值达到 0 则击杀该角色。非所有者也可以调用。
Emote(emote: string)nullCauses the character to emote. The list of available emotes is the same as those shown in the in - game emote menu.使角色做出表情动作。可用的表情列表与游戏内表情菜单中显示的相同。
PlayAnimation(animation: string, fade: optional float)nullCauses the character to play an animation. If the fade parameter is provided, will crossfade the animation by this timestep. Available animations can be found here: Human, Titan, Annie, Eren. Use the right - hand string value for the animation.使角色播放一个动画。如果提供了 fade 参数,将按此时间步长进行动画淡入淡出过渡。可用的动画可在此处找到:Human、Titan、Annie、Eren。使用右侧的字符串值作为动画名称。
GetAnimationLength(animation: string)floatGets the length of animation.获取动画的长度。
PlaySound(sound: string)nullPlays a sound if present in the character. Available sound names can be found here: Humans, Shifters, Titans. Note that shifters also have all titan sounds.如果角色有该音效,则播放该音效。可用的音效名称可在此处找到:Humans、Shifters、Titans。注意,变身者也拥有所有泰坦的音效。
StopSound(sound: string)nullStops the sound.停止播放该音效。
LookAt(position: Vector3)nullRotates the character such that it is looking towards a world position.旋转角色,使其朝向一个世界位置。
AddForce(force: Vector3, mode[optional]: string)nullAdds a force to the character with given force vector and optional mode. Valid modes are Force, Acceleration, Impulse, VelocityChange with default being Acceleration.给角色施加一个力,使用给定的力向量和可选的模式。有效的模式有 Force、Acceleration、Impulse、VelocityChange,默认模式为 Acceleration。
Reveal(duration: float)nullAdds a white outline visible through walls on the character for duration seconds.在角色身上添加一个能透过墙壁看到的白色轮廓,持续指定的秒数。
AddOutline(color: Color, mode: string)nullAdds an outline effect with the given color and mode. Valid modes are: OutlineAll, OutlineVisible, OutlineHidden, OutlineAndSilhouette, SilhouetteOnly, OutlineAndLightenColor以给定的颜色和模式添加轮廓效果。有效的模式有:OutlineAll、OutlineVisible、OutlineHidden、OutlineAndSilhouette、SilhouetteOnly、OutlineAndLightenColor
RemoveOutline()nullRemoves the outline effect from the character.移除角色身上的轮廓效果。

Human(人类)

Inherits from Character.

Only character owner can modify fields and call functions unless otherwise specified.

翻译:(继承自 Character。

除非另有说明,否则只有角色所有者可以修改字段和调用函数。)

Fields

FieldTypeReadonlyDescription中文描述
WeaponstringtrueHuman’s current weapon (“Blade”, “AHSS”, “Thunderspear”, “APG”).人类当前使用的武器(“Blade”、“AHSS”、“Thunderspear”、“APG”)。
CurrentGasfloatfalseCurrent gas. Cannot be set higher than max gas.当前的瓦斯量。不能设置得高于最大瓦斯量。
MaxGasfloatfalseMax gas.最大瓦斯量。
CurrentBladeintfalseCurrent number of blades left. Cannot be set higher than max blades.当前剩余的刀刃数量。不能设置得高于最大刀刃数量。
MaxBladeintfalseMax number of blades.最大刀刃数量。
CurrentBladeDurabilityfloatfalseCurrent blade durability. Cannot be set higher than max durability. Breaks blades when set to 0.当前刀刃的耐久度。不能设置得高于最大耐久度。设置为 0 时刀刃会损坏。
MaxBladeDurabilityfloatfalseMaximum blade durability.最大刀刃耐久度。
CurrentAmmoRoundintfalseCurrent ammo in current round.当前弹夹中的弹药数量。
MaxAmmoRoundintfalseMax ammo per round.每弹夹的最大弹药数量。
CurrentAmmoLeftintfalseCurrent ammo left.当前剩余的总弹药数量。
MaxAmmoTotalintfalseMaximum total ammo.最大总弹药数量。
AccelerationintfalseAcceleration stat.加速度属性。
SpeedintfalseRun speed stat.奔跑速度属性。
HorseSpeedfloatfalseHorse run speed.马匹奔跑速度。
IsMountedbooltrueIs the human mounted to an object (does not count horses)人类是否骑乘在某个物体上(不包括马匹)。
MountedMapObjectMapObjecttrueReturns the current mounted map object.返回当前骑乘的地图对象。
MountedTransformTransformtrueReturns the current mounted transform.返回当前骑乘的变换组件。
CurrentSpecialstringtrueReturns the current special.返回当前的特殊技能。
AutoRefillGasbooltrueIf the human has the input setting AutoRefillGas enabled. Character owner only.人类是否启用了自动补充瓦斯的输入设置。仅角色所有者可查看。
StatestringtrueAnimation state of the human. Valid states are: Idle, Attack, GroundDodge, AirDodge, Reload, Refill, Die, Grab, EmoteAction, SpecialAttack, SpecialAction, Slide, Run, Land, MountingHorse, Stun, WallSlide.人类的动画状态。有效的状态有:Idle(闲置)、Attack(攻击)、GroundDodge(地面闪避)、AirDodge(空中闪避)、Reload(装填弹药)、Refill(补充瓦斯/弹药)、Die(死亡)、Grab(抓取)、EmoteAction(表情动作)、SpecialAttack(特殊攻击)、SpecialAction(特殊动作)、Slide(滑行)、Run(奔跑)、Land(落地)、MountingHorse(骑乘马匹)、Stun(眩晕)、WallSlide(墙壁滑行)。
CanDodgeboolfalseDisables/Enables dodging.禁用/启用闪避功能。
LeftHookEnabledboolfalseDisables/Enables the left hook.禁用/启用左钩爪。
RightHookEnabledboolfalseDisables/Enables the right hook.禁用/启用右钩爪。
IsInvincibleboolfalseDisables/Enables whether human is invincible.禁用/启用人类的无敌状态。
InvincibleTimeLeftfloatfalseAmount of time before IsInvincible is set to false.无敌状态剩余的时间,之后无敌状态将被设置为 false。
SpecialCooldownfloatfalseMaximum cooldown on special ability.特殊技能的最大冷却时间。
ShifterLiveTimefloatfalseIf shifter special is equipped, how much live time for transforming.如果装备了变身者特殊技能,变身的剩余时长。
SpecialCooldownRatiofloattrueRatio of CurrentCooldown / SpecialCooldown. 1.0 Means ability is ready.当前冷却时间与特殊技能最大冷却时间的比例。1.0 表示技能已就绪。

Functions

FunctionReturnsDescription中文描述
Refill()boolCauses the human to enter refill animation and refreshes all gas/ammo at the end. Returns true if the human actually needed refill.使人类进入补充动画,结束时刷新所有瓦斯和弹药。如果人类确实需要补充,则返回 true。
RefillImmediate()nullImmediately refreshes all gas/ammo without animation.立即刷新所有瓦斯和弹药,不播放动画。
ClearHooks()nullCauses the human to disable both hooks if any are active.如果任何一个钩爪处于激活状态,使人类禁用两个钩爪。
ClearLeftHook()nullCauses the human to disable the left hook if it is active.如果左钩爪处于激活状态,使人类禁用左钩爪。
ClearRightHook()nullCauses the human to disable the right hook if it is active.如果右钩爪处于激活状态,使人类禁用右钩爪。
MountMapObject(obj: MapObject, positionOffset: Vector3, rotationOffset: Vector3)nullMounts the human to the given MapObject.使人类骑乘到给定的地图对象上。
MountTransform(obj: Transform, positionOffset: Vector3, rotationOffset: Vector3)nullMounts the human to the given Transform.使人类骑乘到给定的变换组件上。
Unmount()nullUnmounts the human from an object.使人类从物体上下来。
SetSpecial(special: string)nullSets the human special. Available specials can be found here. Example: Potato设置人类的特殊技能。可用的特殊技能可在此处找到。例如:Potato
ActivateSpecial()nullTriggers the special to activate.触发特殊技能激活。
SetWeapon(weapon: string)nullSets the human weapon. (see Game.Loadouts to get allowed loadouts for the current room settings). Valid loadouts are Blades, AHSS, APG, Thunderspears.设置人类的武器。(查看 Game.Loadouts 以获取当前房间设置允许的装备。有效的装备有 Blades(刀刃)、AHSS、APG、Thunderspears(雷枪))。
DisablePerks()nullDisables all perks.禁用所有 perks(特殊能力/加成)。

Titan(泰坦)

Inherits from Character.

Only character owner can modify fields and call functions unless otherwise specified.

翻译:(继承自 Character。

除非另有说明,否则只有角色所有者可以修改字段和调用函数。)

Fields

FieldTypeReadonlyDescription中文描述
SizefloatfalseTitan’s size.泰坦的体型大小。
DetectRangefloatfalse(AI) titan’s detect range.(AI)泰坦的探测范围。
FocusRangefloatfalse(AI) titan’s focus range.(AI)泰坦的聚焦范围。
FocusTimefloatfalse(AI) titan’s focus time.(AI)泰坦的聚焦时间。
RunSpeedBasefloatfalseTitan’s base run speed. Final run speed is RunSpeedBase + Size * RunSpeedPerLevel.泰坦的基础奔跑速度。最终奔跑速度为基础奔跑速度加上体型大小乘以每级奔跑速度加成。
WalkSpeedBasefloatfalseTitan’s base walk speed. Final walk speed is WalkSpeedBase + Size * WalkSpeedPerLevel.泰坦的基础行走速度。最终行走速度为基础行走速度加上体型大小乘以每级行走速度加成。
RunSpeedPerLevelfloatfalseTitan’s run speed added per size.泰坦每单位体型增加的奔跑速度。
WalkSpeedPerLevelfloatfalseTitan’s walk speed added per size.泰坦每单位体型增加的行走速度。
TurnSpeedfloatfalseTitan’s turn animation speed.泰坦转身动画的速度。
RotateSpeedfloatfalseTitan’s rotate speed.泰坦旋转的速度。
JumpForcefloatfalseTitan’s jump force.泰坦的跳跃力。
ActionPausefloatfalseTitan’s pause delay after performing an action.泰坦执行一个动作后的停顿延迟时间。
AttackPausefloatfalseTitan’s pause delay after performing an attack.泰坦进行一次攻击后的停顿延迟时间。
TurnPausefloatfalseTitan’s pause delay after performing a turn.泰坦转身之后的停顿延迟时间。
FarAttackCooldownfloatfalse(AI) Titan’s cooldown after performing a ranged attack.(AI)泰坦进行一次远程攻击后的冷却时间。
AttackWaitfloatfalse(AI) Titan’s wait time between being in range and performing an attack.(AI)泰坦进入攻击范围到发起攻击之间的等待时间。
CanRunboolfalse(AI) Titan can run or only walk.(AI)泰坦是否可以奔跑(否则只能行走)。
AttackSpeedMultiplierfloatfalseTitan’s attack animation speed.泰坦攻击动画的速度。
NapePositionVector3trueThe titan’s nape position.泰坦后颈的位置。
IsCrawlerbooltrueIs titan a crawler.泰坦是否是爬行类泰坦。
UsePathfindingboolfalseDetermines whether the (AI) titan uses pathfinding. (Smart Movement in titan settings)决定(AI)泰坦是否使用寻路功能(泰坦设置中的智能移动)。
HeadMountTransformtrueTitan’s head transform.泰坦头部的变换组件。
NeckMountTransformtrueTitan’s neck transform.泰坦颈部的变换组件。
StaminafloatfalsePT Stamina.纯种泰坦(PT)的耐力值。
Max StaminafloatfalsePT Max Stamina.纯种泰坦的最大耐力值。

Functions

FunctionReturnsDescription中文描述
Blind()nullCauses the titan to enter the blind state.使泰坦进入失明状态。
Cripple(time: float)nullCauses the titan to enter the cripple state for time seconds. Using 0 will use the default cripple time.使泰坦进入残废状态,持续指定的秒数。使用 0 则采用默认的残废时间。
MoveTo(position: Vector3, range: float, ignoreEnemies: bool)nullCauses the (AI) titan to move towards a position and stopping when within specified range. If ignoreEnemies is true, will not engage enemies along the way.使(AI)泰坦朝指定位置移动,到达指定范围后停止。如果 ignoreEnemies 为 true,则途中不会攻击敌人。
Target(enemy: Character | MapTargetable, focusTime: float)nullCauses the (AI) titan to target an enemy character or MapTargetable for focusTime seconds. If focusTime is 0 it will use the default focus time.使(AI)泰坦将一个敌方角色或可攻击的地图目标作为目标,持续指定的聚焦时间。如果聚焦时间为 0,则采用默认聚焦时间。
Idle(time: float)nullCauses the (AI) titan to idle for time seconds before beginning to wander. During idle the titan will not react or move at all.使(AI)泰坦静止指定的秒数,之后开始随机游荡。静止期间,泰坦不会有任何反应或移动。
Wander()nullCauses the (AI) titan to cancel any move commands and begin wandering randomly.使(AI)泰坦取消任何移动命令,开始随机游荡。
Emote(emote: string)nullCauses the titan to emote.使泰坦做出表情动作。

Shifter(变身者)

Inherits from Character.

Only character owner can modify fields and call functions unless otherwise specified.

翻译:(继承自 Character。

除非另有说明,否则只有角色所有者可以修改字段和调用函数。)

Fields

FieldTypeReadonlyDescription中文描述
SizefloatfalseShifter’s size.变身者的体型大小。
DetectRangefloatfalse(AI) shifter’s detect range.(AI)变身者的探测范围。
FocusRangefloatfalse(AI) shifter’s focus range.(AI)变身者的聚焦范围。
FocusTimefloatfalse(AI) shifter’s focus time before switching targets.(AI)变身者在切换目标前的聚焦时间。
RunSpeedBasefloatfalseShifter’s base run speed. Final run speed is RunSpeedBase + Size * RunSpeedPerLevel.变身者的基础奔跑速度。最终奔跑速度为基础奔跑速度加上体型大小乘以每级奔跑速度加成。
WalkSpeedBasefloatfalseShifter’s base walk speed. Final walk speed is WalkSpeedBase + Size * WalkSpeedPerLevel.变身者的基础行走速度。最终行走速度为基础行走速度加上体型大小乘以每级行走速度加成。
RunSpeedPerLevelfloatfalseShifter’s run speed added per level.变身者每级增加的奔跑速度。
WalkSpeedPerLevelfloatfalseShifter’s walk speed added per level.变身者每级增加的行走速度。
TurnSpeedfloatfalseShifter’s turn speed when running turn animation.变身者执行转身动画时的速度。
RotateSpeedfloatfalseShifter’s rotate speed when rotating body.变身者旋转身体时的速度。
JumpForcefloatfalseShifter’s jump force when jumping.变身者跳跃时的力量。
ActionPausefloatfalseShifter’s pause delay after performing an action.变身者执行一个动作后的停顿延迟时间。
AttackPausefloatfalseShifter’s pause delay after performing an attack.变身者进行一次攻击后的停顿延迟时间。
TurnPausefloatfalseShifter’s pause delay after performing a turn.变身者转身之后的停顿延迟时间。
FarAttackCooldownfloatfalse(AI) Shifter’s cooldown after performing a ranged attack.(AI)变身者进行一次远程攻击后的冷却时间。
AttackWaitfloatfalse(AI) Shifter’s wait time between being in range to attack and performing the attack.(AI)变身者进入攻击范围到发起攻击之间的等待时间。
AttackSpeedMultiplierfloatfalseShifter’s attack animation speed.变身者攻击动画的速度。
UsePathfindingboolfalse(AI) Shifter uses pathfinding.(AI)变身者是否使用寻路功能。
NapePositionVector3trueThe shifter’s nape position.变身者后颈的位置。
DeathAnimLengthfloatfalseThe length of the death animation.死亡动画的时长。

Functions

FunctionReturnsDescription中文描述
Blind()nullCauses the shifter to enter the blind state.使变身者进入失明状态。
Cripple()nullCauses the shifter to enter the cripple state.使变身者进入残废状态。
MoveTo(position: Vector3, ignoreEnemies: bool)nullCauses the (AI) shifter to move towards a position. If ignoreEnemies is true, will not engage enemies along the way.使(AI)变身者朝指定位置移动。如果 ignoreEnemies 为 true,则途中不会攻击敌人。
Target(enemy: Character | MapTargetable, focusTime: float)nullCauses the (AI) shifter to target an enemy character or MapTargetable for focusTime seconds. If focusTime is 0 it will use the default focus time.使(AI)变身者将一个敌方角色或可攻击的地图目标作为目标,持续指定的聚焦时间。如果聚焦时间为 0,则采用默认聚焦时间。
Idle(time: float)nullCauses the (AI) shifter to idle for time seconds before beginning to wander. During idle the titan will not react or move at all.使(AI)变身者静止指定的秒数,之后开始随机游荡。静止期间,变身者不会有任何反应或移动。
Wander()nullCauses the (AI) shifter to cancel any move commands and begin wandering randomly.使(AI)变身者取消任何移动命令,开始随机游荡。
Emote(emote: string)nullCauses the shifter to emote.使变身者做出表情动作。

MapObject(地图对象)

Inherits from Object. MapObject represents a map object created in the editor.
翻译:(继承自 Object。MapObject 代表在编辑器中创建的地图对象。)

Fields

FieldTypeReadonlyDescription中文描述
NamestringtrueName of the map object.地图对象的名称。
PositionVector3falsePosition of the map object.地图对象的位置。
LocalPositionVector3falseLocal position of the map object. This is the same as Position if there is no parent.地图对象的本地位置。如果没有父对象,此值与 Position 相同。
RotationVector3falseRotation of the map object.地图对象的旋转角度。
LocalRotationVector3falseLocal rotation of the map object. This is the same as Rotation if there is no parent.地图对象的本地旋转角度。如果没有父对象,此值与 Rotation 相同。
QuaternionRotationQuaternionfalseQuaternion rotation of the map object.地图对象的四元数旋转。
QuaternionLocalRotationQuaternionfalseQuaternion local rotation of the map object.地图对象的本地四元数旋转。
ForwardVector3falseForward vector of the map object.地图对象的前向向量。
UpVector3falseUp vector of the map object.地图对象的上向向量。
RightVector3falseRight vector of the map object.地图对象的右向向量。
ScaleVector3falseScale of the map object.地图对象的缩放比例。
ParentMapObjectfalseParent of the map object. Returns null if there is no parent.地图对象的父对象。如果没有父对象,则返回 null。
ActiveboolfalseWhether or not the map object is active.地图对象是否处于激活状态。
StaticbooltrueWhether or not the map object is static.地图对象是否为静态对象。
TransformTransformtrueGets the transform component of the map object.获取地图对象的变换组件。
ColorColorfalseThe main color of the map object.地图对象的主颜色。
IDinttrueThe ID of the map object.地图对象的 ID。
HasRendererbooltrueWhether the MapObject has a renderer attached.地图对象是否附有渲染器。
TextureTilingXfloatfalseSets the texture tiling x of the first renderer. Throws an exception if it does not exist or is static.设置第一个渲染器的纹理 x 方向的平铺参数。如果渲染器不存在或对象是静态的,则抛出异常。
TextureTilingYfloatfalseSets the texture tiling y of the first renderer. Throws an exception if it does not exist or is static.设置第一个渲染器的纹理 y 方向的平铺参数。如果渲染器不存在或对象是静态的,则抛出异常。
TextureOffsetXfloatfalseSets the texture offset x of the first renderer. Throws an exception if it does not exist or is static.设置第一个渲染器的纹理 x 方向的偏移量。如果渲染器不存在或对象是静态的,则抛出异常。
TextureOffsetYfloatfalseSets the texture offset y of the first renderer. Throws an exception if it does not exist or is static.设置第一个渲染器的纹理 y 方向的偏移量。如果渲染器不存在或对象是静态的,则抛出异常。

Functions

FunctionReturnsDescription中文描述
GetComponent(name: string)ComponentGets the component with given name.获取具有指定名称的组件。
AddComponent(name: string)ComponentAdds the component to the object, calls Init, and returns the component.向对象添加组件,调用 Init 方法,并返回该组件。
RemoveComponent(name: string)nullRemoves the component if found on the object.如果对象上存在指定名称的组件,则移除该组件。
SetComponentEnabled(name: string, enabled: bool)nullSets the attached component to enabled or not.设置附加组件的启用状态。
SetComponentsEnabled(enabled: bool)nullSets all attached components to enabled or not.设置所有附加组件的启用状态。
GetChild(name: string)MapObjectGets the child with given name.获取具有指定名称的子对象。
GetChildren()ListGets a list of direct children of the map object.获取地图对象的直接子对象列表。
GetTransform(name: string)TransformGets the child transform with given name.获取具有指定名称的子对象的变换组件。
AddSphereCollider(collideMode: string, collideWith: string, center: Vector3, radius: float)nullAdds a sphere collider with given mode, collide, center, and radius. Valid collide modes are “Physical”, “Region”, “None”. Valid collide with are “All”, “MapObjects”, “Characters”, “Projectiles”, “Titans”, “Humans”, “Entities”, “Hitboxes”.添加一个球形碰撞器,指定碰撞模式、碰撞对象、中心位置和半径。有效的碰撞模式有 “Physical”(物理碰撞)、“Region”(区域碰撞)、“None”(无碰撞);有效的碰撞对象有 “All”(所有)、“MapObjects”(地图对象)、“Characters”(角色)、“Projectiles”(投射物)、“Titans”(泰坦)、“Humans”(人类)、“Entities”(实体)、“Hitboxes”(碰撞箱)。
AddBoxCollider(collideMode: string, collideWith: string, center: Vector3, size: Vector3)nullAdds a box collider with given mode, collide, center, and size. Removing center and size fields will attempt to auto - size the collider to the bounds of the object.添加一个盒形碰撞器,指定碰撞模式、碰撞对象、中心位置和大小。如果不指定中心和大小字段,将尝试自动将碰撞器大小调整为对象的边界大小。
AddSphereTarget(team: string, center: Vector3, radius: float)MapTargetableAdds a sphere collider as a region with the layer of “HitBoxes” and sets it as a targetable object. See MapTargetable for more details.添加一个球形碰撞器作为区域,设置其层为 “HitBoxes”,并将其设置为可攻击的目标对象。更多详情请参阅 MapTargetable。
AddBoxTarget(team: string, center: Vector3, size: Vector3)MapTargetableAdds a boxcollider as a region with the layer of “HitBoxes” and sets it as a targetable object.添加一个盒形碰撞器作为区域,设置其层为 “HitBoxes”,并将其设置为可攻击的目标对象。
SetColorAll(color: Color)nullSets all colors on the MapObject.设置地图对象的所有颜色。
InBounds(position: Vector3)boolReturns true if the position is inside the bounds of the MapObject’s colliders.如果指定位置在地图对象的碰撞器边界内,则返回 true。
GetBoundsAverageCenterVector3Gets the center of all of the bounds of all hitboxes on the object. Returns Vector3.Zero if there are no colliders.获取对象上所有碰撞箱边界的平均中心位置。如果没有碰撞器,则返回 Vector3.Zero。
GetBoundsCenterVector3Gets the center of the first (main) hitbox on the object. Use this for objects with a single model/collider (geometry). Returns null if there are no colliders.获取对象上第一个(主)碰撞箱的中心位置。适用于具有单个模型/碰撞器(几何体)的对象。如果没有碰撞器,则返回 null。
GetBoundsSizeVector3Gets the size of the bounds. Returns null if there are no colliders.获取边界的大小。如果没有碰撞器,则返回 null。
GetBoundsMinVector3Gets the lower corner of the Bounds. Returns null if there are no colliders.获取边界的左下角位置。如果没有碰撞器,则返回 null。
GetBoundsMaxVector3Gets the upper corner of the Bounds. Returns null if there are no colliders.获取边界的右上角位置。如果没有碰撞器,则返回 null。
GetCornersList(Vector3)Gets all eight corners of the bounds. Returns null if there are no colliders.获取边界的所有八个角的位置。如果没有碰撞器,则返回 null。

Transform(变换组件)

Inherits from Object. Transform represents an internal Unity transform on the MapObject’s GameObject. This should only be used in special cases where you want to manipulate an internal transform that isn’t exposed in the map system - otherwise, you should be using MapObject.

翻译:(继承自 Object。Transform 表示 MapObject 的 GameObject 内部的 Unity 变换组件。仅在你想操作地图系统中未公开的内部变换的特殊情况下使用 - 否则,你应该使用 MapObject。)

Fields

FieldTypeReadonlyDescription中文描述
PositionVector3falsePosition of the transform.变换组件的位置。
LocalPositionVector3falseLocal rotation of the transform. This is the same as Position if there is no parent.变换组件的本地位置。如果没有父对象,此值与 Position 相同。
RotationVector3falseRotation of the transform.变换组件的旋转角度。
LocalRotationVector3falseLocal rotation of the transform. This is the same as Rotation if there is no parent.变换组件的本地旋转角度。如果没有父对象,此值与 Rotation 相同。
QuaternionRotationQuaternionfalseQuaternion rotation of the transform.变换组件的四元数旋转。
QuaternionLocalRotationQuaternionfalseLocal quaternion rotation of the transform.变换组件的本地四元数旋转。
ScaleVector3falseScale of the transform.变换组件的缩放比例。
ForwardVector3falseForward vector of the transform.变换组件的前向向量。
UpVector3falseUp vector of the transform.变换组件的上向向量。
RightVector3falseRight vector of the transform.变换组件的右向向量。

Functions

FunctionReturnsDescription中文描述
GetTransform(name: string)TransformGets the child transform with given name.获取具有指定名称的子变换组件。
GetTransforms()ListReturns a list of direct child transforms.返回直接子变换组件的列表。
PlayAnimation(name: string, fade: optional float)nullPlays the animation by name. Transform must have a Unity (Legacy) Animation component. If fade is provided, will fade the animation by this timestep.按名称播放动画。变换组件必须有一个 Unity(旧版)动画组件。如果提供了 fade 参数,将按此时间步长淡入淡出动画。
GetAnimationLength(name: string)floatGets the length of an animation.获取动画的长度。
PlaySound()nullPlays the sound attached to this transform. Must have a Unity AudioSource component.播放附加到该变换组件的声音。必须有一个 Unity 音频源组件。
StopSound()nullStops the sound.停止播放声音。
ToggleParticle(toggle: bool)nullEnables or disables the particle system attached to this transform. Must have a Unity ParticleSystem component.启用或禁用附加到该变换组件的粒子系统。必须有一个 Unity 粒子系统组件。
Rotate(eulers: Vector3)nullApplies a rotation of eulerAngles.z degrees around the z - axis, eulerAngles.x degrees around the x - axis, and eulerAngles.y degrees around the y - axis (in that order).绕 z 轴旋转 eulerAngles.z 度,绕 x 轴旋转 eulerAngles.x 度,绕 y 轴旋转 eulerAngles.y 度(按此顺序)。
RotateAround(point: Vector3, axis: Vector3, angle: float)nullRotates the transform around a point, given axis and angle.绕指定点、指定轴旋转指定角度。
LookAt(position: Vector3)nullRotates the transform such that it is facing the point.旋转变换组件使其面向指定点。
InverseTransformPoint(position: Vector3)Vector3Transforms position from world space to local space.将位置从世界空间转换到本地空间。
InverseTransformDirection(direction: Vector3)Vector3Transforms a direction from world space to local space.将方向从世界空间转换到本地空间。
TransformPoint(position: Vector3)Vector3Transforms a position from local space to world space.将位置从本地空间转换到世界空间。
TransformDirection(direction: Vector3)Vector3Transforms a direction from local space to world space.将方向从本地空间转换到世界空间。
SetRenderersEnabled(enabled: bool)nullToggles the renderers attached to the transform and its children.切换附加到该变换组件及其子对象的渲染器的启用状态。

Player(玩家)

Inherits from Object. Represents a network player. Only master client or player may modify fields.

翻译:(继承自 Object。表示一个网络玩家。只有主机客户端或玩家本人可以修改字段。)

Fields

FieldTypeReadonlyDescription中文描述
CharacterCharactertruePlayer’s current character, if alive.玩家当前存活的角色。
ConnectedfloattruePlayer is still connected to the room.玩家是否仍连接到房间。
IDinttruePlayer unique ID.玩家的唯一 ID。
NamestringtruePlayer name.玩家名称。
GuildstringtruePlayer guild.玩家所属公会。
TeamstringtruePlayer’s chosen team (“None”, “Blue”, “Red”, “Titan”, “Human”). Note that this may be different from the character’s final team (Character.Team field) if the character’s team field is modified.玩家选择的团队(“None”、“Blue”、“Red”、“Titan”、“Human”)。请注意,如果角色的团队字段被修改,这可能与角色最终的团队(Character.Team 字段)不同。
StatusstringtruePlayer’s spawn status (“Alive”, “Dead”, “Spectating”).玩家的生成状态(“Alive”、“Dead”、“Spectating”)。
CharacterTypestringtruePlayer’s chosen character (“Human”, “Titan”, “Shifter”)玩家选择的角色类型(“Human”、“Titan”、“Shifter”)。
LoadoutstringtruePlayer’s chosen loadout (“Blades”, “AHSS”, “APG”, “Thunderspears”).玩家选择的装备(“Blades”、“AHSS”、“APG”、“Thunderspears”)。
PinginttrueThe player’s connection ping.玩家的网络延迟。
SpectateIDinttrueThe player’s spectating ID. If not spectating anyone, returns -1.玩家正在观察的玩家 ID。如果没有观察任何人,则返回 -1。
KillsintfalsePlayer kills.玩家的击杀数。
DeathsintfalsePlayer deaths.玩家的死亡数。
HighestDamageintfalsePlayer highest damage.玩家造成的最高伤害。
TotalDamageintfalsePlayer total damage.玩家造成的总伤害。
SpawnPointVector3falsePlayer’s respawn point. Is initially null and can be set back to null, at which point map spawn points are used.玩家的重生点。初始值为 null,也可以设置回 null,此时将使用地图的重生点。

Functions

FunctionReturnsDescription中文描述
GetCustomProperty(key: string)ObjectGet a custom property at given key. Must be a primitive type. This is synced to all clients.获取指定键的自定义属性。属性必须是基本类型。此属性会同步到所有客户端。
SetCustomProperty(key: string, value: Object)nullSets a custom property at given key. Must be a primitive type. This is synced to all clients.设置指定键的自定义属性。属性必须是基本类型。此属性会同步到所有客户端。
ClearKDR()nullClears kills, deaths, highestdamage, and totaldamage properties.清除击杀数、死亡数、最高伤害和总伤害属性。

NetworkView(网络视图)

Inherits from Object. Represents a network view on a map object that has the “networked” flag.

翻译:(继承自 Object。表示具有“网络同步”标志的地图对象上的网络视图。)

Fields

FieldTypeReadonlyDescription中文描述
OwnerPlayertrueThe network view’s owner.网络视图的所有者。

Functions

FunctionReturnsDescription中文描述
Transfer(target: Player)nullOwner only. Transfer ownership of this NetworkView to another player.仅所有者可操作。将此网络视图的所有权转移给另一个玩家。
SendMessage(target: Player, message: string)nullSend a message to a target player. This will be received in any of the MapObject attached components through the OnNetworkMessage callback.向目标玩家发送一条消息。该消息将通过附加在 MapObject 上的任何组件中的 OnNetworkMessage 回调接收。
SendMessageAll(message: string)nullSend a message to all players including myself.向包括自己在内的所有玩家发送一条消息。
SendMessageOthers(message: string)nullSend a message to players excluding myself.向除自己之外的玩家发送一条消息。
SendStream(item: Object)nullSend an object to the network sync stream. This represents sending data from the object owner to all non - owner observers, and should only be called in the SendNetworkStream callback in the attached component. It only works with some object types: primitives and Vector3.向网络同步流发送一个对象。这表示从对象所有者向所有非所有者观察者发送数据,并且应该仅在附加组件的 SendNetworkStream 回调中调用。它仅适用于某些对象类型:基本类型和 Vector3。
ReceiveStream(item: Object)nullReceive an object through the network sync stream. This represents receiving data from the object owner as a non - owner observer, and should only be called in the OnNetworkStream callback.通过网络同步流接收一个对象。这表示作为非所有者观察者从对象所有者接收数据,并且应该仅在 OnNetworkStream 回调中调用。

Color(颜色)

Inherits from Object. Is a struct, meaning that assignments will create copies and comparisons will return true if all fields are equivalent.

翻译:(继承自 Object。是一个结构体,这意味着赋值操作会创建副本,并且如果所有字段都相等,比较操作将返回 true。)

Initialization
Color takes four ints R, G, B, and A as parameters when initializing. Values are between 0 and 255.
翻译:(初始化)
翻译:(Color 在初始化时接受四个整数 R、G、B 和 A 作为参数。这些值的范围在 0 到 255 之间。)

# create a 255,255,255,255 color
color = Color();

# create a 128,56,48,255 color
color = Color(128, 56, 48);

# create a 128, 56, 48, 128 color
color = Color(128, 56, 48, 128);

# create a color from hex string
color = Color("#FF0000");

Fields

FieldTypeReadonlyDescription中文描述
RintfalseRed红色通道值
GintfalseGreen绿色通道值
BintfalseBlue蓝色通道值
AintfalseAlpha透明度通道值

Functions

FunctionReturnsDescription中文描述
ToHexString()stringConverts the color to a hex string将颜色转换为十六进制字符串
Gradient(a: Color, b: Color, fade: float)ColorReturns a gradient color between a and b using the fade value.使用 fade 值返回颜色 a 和颜色 b 之间的渐变颜色

Vector3(三维向量)

Inherits from Object. Is a struct, meaning that assignments will create copies and comparisons will return true if all fields are equivalent.

翻译:(继承自 Object。它是一个结构体,这意味着赋值操作会创建副本,并且当所有字段都相等时,比较操作将返回 true。)

Initialization

Vector3 takes up to three floats X, Y, and Z as parameters when initializing.
翻译:(初始化)
翻译:(Vector3 在初始化时最多可以接受三个浮点数参数:X、Y 和 Z。)

# create an empty 0,0,0 vector
vector = Vector3();

# create a vector with x=5.5, y=6.0, z=24.8
vector = Vector3(5.5, 6.0, 24.8);

# create a vector with x,y,z = 1.2
vector = Vector3(1.2);

# create a vector with x=5.5, y=6.0, z=0
vector = Vector3(5.5, 6.0);

中文解释

# 创建一个值为 (0, 0, 0) 的空向量
vector = Vector3();

# 创建一个 x = 5.5,y = 6.0,z = 24.8 的向量
vector = Vector3(5.5, 6.0, 24.8);

# 创建一个 x、y、z 都等于 1.2 的向量
vector = Vector3(1.2);

# 创建一个 x = 5.5,y = 6.0,z = 0 的向量
vector = Vector3(5.5, 6.0);

Fields

FieldTypeReadonlyDescription中文描述
XfloatfalseX axis of the vector.向量的 X 轴分量。
YfloatfalseY axis of the vector.向量的 Y 轴分量。
ZfloatfalseZ axis of the vector.向量的 Z 轴分量。
NormalizedVector3trueNormalized version of the vector.向量的归一化版本。
MagnitudefloattrueReturns the magnitude of the vector.返回向量的模(长度)。

Functions

FunctionReturnsDescription中文描述
Scale(scale: float)Vector3Returns the Vector3 multiplied by scale.返回将该向量乘以缩放因子后的向量。

静态字段(Static Fields)

可通过直接引用Vector3来访问(例如:Vector3.Up)

FieldTypeDescription中文描述
UpVector3向上的向量3
DownVector3向下的向量3
LeftVector3向左的向量3
RightVector3向右的向量3
ForwardVector3向前的向量3
BackVector3向后的向量3
ZeroVector3零向量3
OneVector3全为1的向量3

静态函数(Static functions)

FunctionReturnsDescriptionDescription中文描述
Lerp(a: Vector3, b: Vector3, t: float)Vector3Returns a Vector3 lerped between a and b using scale t. T must be between 0 and 1.返回使用缩放因子t在a和b之间线性插值得到的三维向量。t必须在0到1之间。
LerpUnclamped(a: Vector3, b: Vector3, t: float)Vector3Returns a Vector3 lerped between a and b using scale t. T can be outside 0 and 1.返回使用缩放因子t在a和b之间线性插值得到的三维向量。t可以在0和1之外。
Slerp(a: Vector3, b: Vector3, t: float)Vector3Returns a Vector3 spherical lerped between a and b using scale t. T must be between 0 and 1.返回使用缩放因子t在a和b之间球面插值得到的三维向量。t必须在0到1之间。
SlerpUnclamped(a: Vector3, b: Vector3, t: float)Vector3Returns a Vector3 spherical lerped between a and b using scale t. T can be outside 0 and 1.返回使用缩放因子t在a和b之间球面插值得到的三维向量。t可以在0和1之外。
GetRotationDirection(a: Vector3, b: Vector3)Vector3Gets the relational Vector3 b using a as a reference. This is equivalent to setting MapObject.Forward to Vector a, and finding the relative b vector.以a为参考获取相对的三维向量b。这相当于将MapObject.Forward设为向量a ,并找到相对的b向量。
Distance(a: Vector3, b: Vector3)floatReturns the distance between two Vector3s.返回两个三维向量之间的距离。
Project(a: Vector3, b: Vector3)Vector3Returns a projected on b.返回a在b上的投影。
Multiply(a: Vector3, b: Vector3)Vector3Returns the Vector3 of each element in a multiplied by each element of b. It returns the Vector3(a.X * b.X, a.Y * b.Y, a.Z * b.Z).返回a中每个元素与b中每个元素相乘得到的三维向量。即返回Vector3(a.X * b.X, a.Y * b.Y, a.Z * b.Z)。
Divide(a: Vector3, b: Vector3)Vector3Returns the Vector3 of each element in a divided by each element of b.返回a中每个元素除以b中每个元素得到的三维向量。
Angle(a: Vector3, b: Vector3)floatReturns the angle between a and b. Always a positive value.返回a和b之间的角度。始终为正值。
SignedAngle(a: Vector3, b: Vector3, axis: Vector3)floatReturns the signed angle between a and b using the given axis.使用给定轴返回a和b之间的有符号角度。
Cross(a: Vector3, b: Vector3)VectorReturns the cross product of a and b.返回a和b的叉积。
Dot(a: Vector3, b: Vector3)floatReturns the dot product of a and b.返回a和b的点积。
RotateTowards(a: Vector3, b: Vector3, maxAngle: float, maxMagnitude: float)Vector3Returns the Vector3 that is rotated from a to b using maxAngle degrees and changing magnitude by at most maxMagnitude.返回从a旋转到b的三维向量,使用最大角度maxAngle度 ,并且幅度变化最多为maxMagnitude。

Quaternion(四元数)

Inherits from Object. Is a struct, meaning that assignments will create copies and comparisons will return true if all fields are equivalent.

翻译:(继承自 Object。是一个结构体,这意味着赋值操作会创建副本,并且当所有字段都相等时,比较操作将返回 true。)

Initialization
Quaternion takes four floats X, Y, Z and W as parameters when initializing.
Example: quaternion = Quaternion(0.5, 0.5, 0.5, 0.5);
翻译:(初始化)
翻译:(Quaternion 在初始化时接受四个浮点数参数:X、Y、Z 和 W。
示例:quaternion = Quaternion(0.5, 0.5, 0.5, 0.5);)

Fields

FieldTypeReadonlyDescription中文描述
XfloatfalseX value of the quaternion.四元数的 X 值。
YfloatfalseY value of the quaternion.四元数的 Y 值。
ZfloatfalseZ value of the quaternion.四元数的 Z 值。
WfloatfalseW value of the quaternion.四元数的 W 值。
EulerVector3trueReturns the euler angles of the quaternion as a Vector3.以 Vector3 形式返回四元数对应的欧拉角。

静态字段(Static Fields)

可通过直接引用四元数(Quaternion)来访问(例如:Quaternion.Identity)

FieldTypeDescriptionDescription中文描述
IdentityQuaternionReturns the identity quaternion (0,0,0,0).返回单位四元数 (0, 0, 0, 0)。

静态函数(Static functions)

FunctionReturnsDescriptionDescription中文描述
Lerp(a: Quaternion, b: Quaternion, t: float)QuaternionReturns a Quaternion lerped between a and b using scale t. T must be between 0 and 1.返回使用缩放因子 t 在 a 和 b 之间线性插值得到的四元数。t 必须在 0 到 1 之间。
LerpUnclamped(a: Quaternion, b: Quaternion, t: float)QuaternionReturns a Quaternion lerped between a and b using scale t. T can be outside 0 and 1.返回使用缩放因子 t 在 a 和 b 之间线性插值得到的四元数。t 可以在 0 和 1 之外。
Slerp(a: Quaternion, b: Quaternion, t: float)QuaternionReturns a Quaternion spherical lerped between a and b using scale t. T must be between 0 and 1.返回使用缩放因子 t 在 a 和 b 之间球面插值得到的四元数。t 必须在 0 到 1 之间。
SlerpUnclamped(a: Quaternion, b: Quaternion, t: float)QuaternionReturns a Quaternion spherical lserped between a and b using scale t. T can be outside 0 and 1.返回使用缩放因子 t 在 a 和 b 之间球面插值得到的四元数。t 可以在 0 和 1 之外。
FromEuler(v: Vector3)QuaternionReturns the Quaternion rotation from the given euler angles.根据给定的欧拉角返回四元数旋转。
LookRotation(forward: Vector3, [optional] up: Vector3)QuaternionReturns the Quaternion rotation with the specified forward and (optional) up Vector.返回具有指定的向前方向和(可选)向上方向向量的四元数旋转。
FromToRotation(from: Vector3, to: Vector3)QuaternionReturns the Quaternion rotation between the from and to Vector.返回从 from 向量到 to 向量之间的四元数旋转。
Inverse(a: Quaternion)QuaternionReturns the inverse of the given Quaternion.返回给定四元数的逆。
RotateTowards(from: Quaternion, to: Quaternion, maxDegrees: float)QuaternionReturns the quaternion rotated towards To with a maximum degree change.返回朝着 to 旋转且最大度数变化的四元数。

Dict(字典)

Inherits from Object. Dict (dictionaries) allow you to add and reference objects by key and value.

翻译:(继承自 Object。字典(Dict)允许你通过键和值来添加和引用对象。)

Fields

FieldTypeReadonlyDescription中文描述
KeysList(Object)trueList of keys in the dictionary.字典中所有键的列表。
ValuesList(Object)trueList of values in the dictionary.字典中所有值的列表。
CountinttrueNumber of entries.字典中条目的数量。

Functions

FunctionReturnsDescription中文描述
ClearnullClears the dictionary.清空字典中的所有条目。
Get(key: Object, optional default: Object)ObjectReturns the value at given key. If the optional parameter default is provided, will return default if no key is found.返回指定键对应的值。如果提供了可选参数 default,且未找到该键,则返回 default。
Set(key: Object, value: Object)nullSets the value at given key.设置指定键对应的值。如果键已存在,则更新其值;如果不存在,则添加新的键值对。
Remove(key: Object)nullRemoves the entry at given key.移除指定键对应的条目。
Contains(key: Object)boolWhether or not the dictionary contains the key.判断字典中是否包含指定的键。

List(列表)

Inherits from Object. Lists allow you to keep an ordered array of objects.

翻译:(继承自 Object。列表允许你保存一个有序的对象数组。)

Fields

FieldTypeReadonlyDescription中文描述
CountinttrueNumber of items.列表中元素的数量。

Functions

FunctionReturnsDescription中文描述
ClearnullClears the list.清空列表中的所有元素。
Get(index: int)ObjectReturns the item at given index.返回指定索引位置的元素。
Set(index: int, item: Object)nullSets the item at given index.设置指定索引位置的元素。
Add(item: Object)nullAdds an item to the end of the list.在列表末尾添加一个元素。
InsertAt(index: int, item: Object)nullInserts an item at the given index.在指定索引位置插入一个元素。
RemoveAt(index: int)nullRemoves the item at the given index.移除指定索引位置的元素。
Remove(item: Object)nullRemoves the item from the list.从列表中移除指定的元素。
Contains(item: Object)boolReturns true if the item is contained in the list.如果列表中包含指定元素,则返回 true。
SortnullSorts the items in the list in place if the items are comparable (int, float, string).如果列表中的元素是可比较的(如整数、浮点数、字符串),则对列表进行原地排序。
RandomizenullRandomizes the list order.随机打乱列表中元素的顺序。

Range(范围)

Inherits from List. Allows you to create lists of integers for convenient iteration, particularly in for loops.

翻译:(继承自 List。允许你创建整数列表,方便进行迭代操作,尤其适用于 for 循环。)

Initialization

Range takes three ints Start, End (exclusive), and Step.
翻译:(初始化)
翻译:(Range 在初始化时接受三个整数参数:起始值(Start)、结束值(End,不包含该值)和步长(Step)。)

Example

Range(0, 10, 1) will return the list [0, 1... 9], while Range(0, 10, 2) will return the list [0, 2, 4... 8)

中文解释

Range(0, 10, 1) 将返回列表 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],而 Range(0, 10, 2) 将返回列表 [0, 2, 4, 6, 8]

Rule

If Start > End and Step is negative, then the list will be in reverse order.

中文解释

如果起始值(Start)大于结束值(End),并且步长(Step)为负数,那么列表将按降序排列。

Reverse Example

Range(9, -1, -1) will return the list [9, 8, 7... 0]

中文解释

Range(9, -1, -1) 将返回列表 [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]

LineCastHitResult(射线投射命中结果)

Line cast hit result from Physics.LineCast.

翻译:(来自 Physics.LineCast 的射线投射命中结果。)

Fields

TypeReadonlyDescription中文描述
IsCharacterbooltrueWhether or not the LineCast hit a player
IsMapObjectbooltrueWhether or not the LineCast hit a MapObject
PointVector3trueThe hit point.
NormalVector3trueThe normal vector of the face that was hit by the LineCast.
DistancefloattrueThe distance between the LineCast origin and the hit point.
ColliderobjecttrueThe collider hit by the LineCast.

MapTargetable(地图可攻击目标)

MapTargetable object returned from MapObject.AddTarget method.

Creating a map targetable is similar to adding a collider to the MapObject, except this collider can be targeted by AI such as titans. Map targetables that are on a different team than the AI will be targeted by the titan, and will trigger the OnGetHit callback on the attached MapObject.

翻译:(通过 MapObject.AddTarget 方法返回的地图可攻击目标对象。

创建一个地图可攻击目标类似于给地图对象添加一个碰撞器,不同之处在于这个碰撞器可以被诸如泰坦之类的 AI 作为目标。与 AI 不同团队的地图可攻击目标会被泰坦攻击,并且会触发附加在地图对象上的 OnGetHit 回调。)

Fields

TypeReadonlyDescription中文描述
TeamstringfalseTeam map targetable belongs to.
EnabledboolfalseWhether the map targetable is enabled or not.
PositionVector3trueWorld position of the map targetable.

Random(随机)

概述
Random 类用于生成随机数。它既可以作为实例化的类使用,通过传入一个字符串作为种子值进行初始化;也可以直接作为静态类引用。使用种子值初始化的好处是可以生成可重复的随机数序列,相同种子生成的随机数序列是一样的。

初始化
Random can be initialized as a class with a string given as the seed value.

Note that this is optional, and you can reference Random directly as a static class.
翻译:(初始化)
翻译:(Random 可以作为一个类进行初始化,需要传入一个字符串作为种子值。

请注意,这是可选的,你也可以直接将 Random 作为静态类引用。)

代码示例解释

# Create an instance of Random with a seed of 123
generator = Random(123);

# Use it
a = generator.RandomInt(0, 100);

# Seed allows repeatable random values
generator2 = Random(123);
b = generator.RandomInt(0, 100);

compared = a == b;    # Always True

中文解释

# 创建一个以 123 为种子的 Random 实例
generator = Random(123);

# 使用该实例生成一个 0 到 100 之间(包含 0,不包含 100)的随机整数
a = generator.RandomInt(0, 100);

# 由于使用相同的种子 123 创建另一个 Random 实例,会得到相同的随机数序列
generator2 = Random(123);
b = generator.RandomInt(0, 100);

# 比较两个随机数,由于种子相同,它们会相等,所以结果总是 True
compared = a == b;    

Callbacks

Callbacks

Main(主类)

These callback functions are available on both the Main class and all component classes.

翻译:(以下这些回调函数在主类(Main class)和所有组件类中均可用。)

Function

FunctionDescription中文描述
Init()Called upon class creation在类创建时调用
OnGameStart()Called upon game start在游戏开始时调用
OnTick()Called every fixed update frame (0.02 seconds)每固定更新帧(0.02 秒)调用一次
OnFrame()Called every update frame每更新帧调用一次
OnLateFrame()Called after every update frame在每更新帧之后调用
OnSecond()Called every second每秒调用一次
OnChatInput(message: string)Called upon chat input from the player. You can return false in this function to prevent input from being sent to the chat window.当玩家输入聊天信息时调用。在此函数中返回 false 可阻止输入信息发送到聊天窗口。
OnPlayerSpawn(player: Player, character: Character)Called upon any player spawning当任何玩家生成时调用
OnCharacterSpawn(character: Character)Called upon any character spawning当任何角色生成时调用
OnCharacterReloaded(character: Character)Called upon any character being reloaded (changing weapon/character model at gas).当任何角色重新装填(在补充瓦斯时更换武器/角色模型)时调用
OnCharacterDie(victim: Character, killer: Character, killerName: string)Called upon a character dying. Killer may be null.当角色死亡时调用。杀手角色可能为空。
OnCharacterDamaged(victim: Character, killer: Character, killerName: string, damage: Int)Called upon a character being damaged. Killer may be null.当角色受到伤害时调用。杀手角色可能为空。
OnPlayerJoin(player: Player)Called upon a player joining the room当玩家加入房间时调用
OnPlayerLeave(player: Player)Called upon a player leaving the room当玩家离开房间时调用
OnNetworkMessage(sender: Player, message: string)Called upon receiving Network.SendMessage.当接收到 Network.SendMessage 发送的消息时调用。
OnButtonClick(buttonName: string)Called upon a UI button with given name being pressed.当指定名称的 UI 按钮被按下时调用。

例子—游戏模式

Survive(生存)

The Survive gamemode spawns a set number of titans and ends when either all titans or all humans are dead.
翻译:(Survive 游戏模式会生成一定数量的泰坦,并在所有泰坦或所有人类都死亡时结束)

class Main
{   
    Description = "Survive a single round of titans.";
    Titans = 15;
    _hasSpawned = false;

    function OnGameStart()
    {
        if (Network.IsMasterClient)
        {
            Game.SpawnTitans("Default", self.Titans);
        }
    }

    function OnTick()
    {
        if (Network.IsMasterClient && !Game.IsEnding)
        {
            titans = Game.Titans.Count;
            humans = Game.Humans.Count;
            playerShifters = Game.PlayerShifters.Count;
            if (humans > 0 || playerShifters > 0)
            {
                self._hasSpawned = true;
            }
            if (titans == 0)
            {
                UI.SetLabelAll("MiddleCenter", "Humanity wins!");
                Game.End(10.0);
                return;
            }
            if (humans == 0 && playerShifters == 0 && self._hasSpawned)
            {
                UI.SetLabelAll("MiddleCenter", "Humanity failed!");
                Game.End(10.0);
                return;
            }
            UI.SetLabelAll("TopCenter", "Titans Left: " + Convert.ToString(titans));
        }
    }
}

Waves(波数)

The Waves gamemode spawns an increasing number of titans for a certain number of waves.

翻译:(Waves 游戏模式会为一定数量的 Waves 生成越来越多的泰坦。)

class Main
{   
    Description = "Survive multiple waves of titans.";
    StartTitans = 3;
    AddTitansPerWave = 1;
    MaxWaves = 20;
    RespawnOnWave = true;
    GradualSpawn = true;
    GradualSpawnTooltip = "Spawn new titans gradually over time. Helpful for reducing lag.";
    _currentWave = 0;
    _hasSpawned = false;

    function OnGameStart()
    {
        if (Network.IsMasterClient)
        {
            self.NextWave();
        }
    }

    function OnCharacterSpawn(character)
    {
        if (character.IsMine && character.Type == "Titan")
        {
            character.DetectRange = 2000;
        }
    }

    function OnTick()
    {
        if (Network.IsMasterClient && !Game.IsEnding)
        {
            titans = Game.Titans.Count;
            humans = Game.Humans.Count;
		    playerShifters = Game.PlayerShifters.Count;
            if (humans > 0 || playerShifters > 0)
            {
                self._hasSpawned = true;
            }
            if (titans == 0)
            {
                self.NextWave();
            }
            if (humans == 0 && playerShifters == 0 && self._hasSpawned)
            {
                UI.SetLabelAll("MiddleCenter", "Humanity failed!");
                Game.End(10.0);
                return;
            }
            UI.SetLabelAll("TopCenter", "Titans Left: " + Convert.ToString(titans) + "  " + "Wave: " + Convert.ToString(self._currentWave));
        }
    }

    function NextWave()
    {
        self._currentWave = self._currentWave + 1;
        if (self._currentWave > self.MaxWaves)
        {
            UI.SetLabelAll("MiddleCenter", "All waves cleared, humanity wins!");
            Game.End(10.0);
            return;
        }
        amount = self.AddTitansPerWave * (self._currentWave - 1) + self.StartTitans;
        if (self.GradualSpawn)
        {
            Game.SpawnTitansAsync("Default", amount);
        }
        else
        {
            Game.SpawnTitans("Default", amount);
        }
        if (self.RespawnOnWave)
        {
            Game.SpawnPlayerAll(false);
        }
    }
}

Endless(无尽 )

The Endless gamemode never ends, and continuously respawns titans and players.

翻译:(无尽游戏模式永无止境,并不断重生泰坦和玩家。)

class Main
{   
    Description = "Endless respawn, endless titans.";
    MaxTitans = 10;
    TitanSpawnEvery = 3.0;
    RespawnDelay = 5.0;
    InfiniteGas = false;
    _spawnTimeLeft = 0.0;
    _dieTimeLeft = 0.0;

    function OnGameStart()
    {
        if (Network.IsMasterClient)
        {
            Game.SpawnTitans("Default", self.MaxTitans);
        }
    }

    function OnCharacterSpawn(character)
    {
        if (character.IsMainCharacter && character.Type == "Human" && self.InfiniteGas)
        {
            character.MaxGas = 100000;
            character.CurrentGas = 100000;
        }
    }

    function OnCharacterDie(victim, killer, killerName)
    {
        if (victim.IsMainCharacter)
        {
            self._dieTimeLeft = self.RespawnDelay;
        }
    }

    function OnTick()
    {
        self._dieTimeLeft = self._dieTimeLeft - Time.TickTime;
        if (Network.MyPlayer.Status == "Dead" && self._dieTimeLeft <= 0.0)
        {
            Game.SpawnPlayer(Network.MyPlayer, false);
        }
        if (Network.IsMasterClient)
        {
            titans = Game.Titans.Count;
            if (titans < self.MaxTitans)
            {
                self._spawnTimeLeft = self._spawnTimeLeft - Time.TickTime;
                if (self._spawnTimeLeft <= 0.0)
                {
                    Game.SpawnTitans("Default", 1);
                    self._spawnTimeLeft = self.TitanSpawnEvery;
                }
            }
            else
            {
                self._spawnTimeLeft = self.TitanSpawnEvery;
            }
            UI.SetLabelAll("TopCenter", "Titans Left: " + Convert.ToString(titans));
        }
    }
}

Racing(竞速)

The Racing gamemode starts by removing a start barrier and ends when a player reaches the end region.

翻译:(Racing 游戏模式从移除开始障碍开始,到玩家到达结束区域时结束。)

class Main
{   
    Description = "Navigate the obstacle course as quickly as possible. Move towards green checkpoints and avoid the red kill regions.";
    StartDelay = 10.0;
    EndAfterWin = true;
    InfiniteLives = true;
    Lives = 0;
    RespawnDelay = 1.5;
    _started = false;
    _startBarriers = null;
    _dieTimeLeft = 0.0;
    _livesLeft = 0;
    _finished = false;
    _hasSpawned = false;

    function OnGameStart()
    {
        self._startBarriers = Map.FindMapObjectsByTag("RacingStartBarrier");
        self._livesLeft = self.Lives;
        Network.MyPlayer.SetCustomProperty("NoLivesLeft", false);
        Game.SetPlaylist("Racing");
    }

    function FinishRace(human)
    {
        if (!self._finished)
        {
            Game.PrintAll(human.Player.Name + " finished at " + String.FormatFloat(Time.GameTime - self.StartDelay, 2));
            Network.SendMessage(Network.MasterClient, "Finish");
            self._finished = true;
        }
    }

    function OnNetworkMessage(sender, message)
    {
        if (Network.IsMasterClient && message == "Finish" && !Game.IsEnding && self.EndAfterWin)
        {
            UI.SetLabelAll("MiddleCenter", sender.Name + " has won the race!");
            Game.End(10);
        }
    }

    function OnCharacterDie(victim, killer, killerName)
    {
        if (victim.IsMainCharacter)
        {
            self._dieTimeLeft = self.RespawnDelay;
        }
    }


    function OnTick()
    {
        if (!self._started)
        {
            Game.SpawnPlayer(Network.MyPlayer, false);
            UI.SetLabel("TopCenter", "Race Starts In: " + String.FormatFloat(self.StartDelay - Time.GameTime, 2));
            if (Time.GameTime > self.StartDelay)
            {
                self._started = true;
                for (barrier in self._startBarriers)
                {
                    barrier.Active = false;
                }
                if (Network.MyPlayer.Status == "Alive")
                {
                    self._hasSpawned = true;
                }
            }
        }
        else
        {
            if (!self.InfiniteLives)
            {
                UI.SetLabel("TopCenter", "Racing Time: " + String.FormatFloat(Time.GameTime - self.StartDelay, 2) + ", Lives: " + Convert.ToString(self._livesLeft));
            }
            else
            {
                UI.SetLabel("TopCenter", "Racing Time: " + String.FormatFloat(Time.GameTime - self.StartDelay, 2));
            }
            self._dieTimeLeft = self._dieTimeLeft - Time.TickTime;
            if (!self._hasSpawned && Network.MyPlayer.Status == "Dead")
            {
                Game.SpawnPlayer(Network.MyPlayer, false);
                self._hasSpawned = true;
            }
            elif (Network.MyPlayer.Status == "Dead" && self._dieTimeLeft <= 0.0)
            {
                if (self._livesLeft > 0 || self.InfiniteLives)
                {
                    Game.SpawnPlayer(Network.MyPlayer, false);
                    self._livesLeft = self._livesLeft - 1;
                }
                else
                {
                    Network.MyPlayer.SetCustomProperty("NoLivesLeft", true);
                }
            }
            if (Network.IsMasterClient && !Game.IsEnding)
            {
                anyPlayerAlive = false;
                anyPlayerSpawned = false;
                for (player in Network.Players)
                {
                    if (player.Status != "Spectating")
                    {
                        anyPlayerSpawned = true;
                        noLivesLeft = player.GetCustomProperty("NoLivesLeft");
                        if (player.Status == "Alive" || (noLivesLeft != null && !noLivesLeft))
                        {
                            anyPlayerAlive = true;
                        }
                    }
                }
                if (anyPlayerSpawned && !anyPlayerAlive)
                {
                    UI.SetLabelAll("MiddleCenter", "All players have no lives left.");
                    Game.End(10);
                }
            }
        }
    }
}

Blade PVP

The Blade PVP gamemode is a player versus player mode using only blades.

翻译:(Blade PVP 游戏模式是仅使用刀片的玩家对玩家模式。)

class Main
{   
    PointMode = false;
    MaxPoints = 25;
    RespawnDelay = 5.0;
    _hasSpawned = false;
    _dieTimeLeft = 0.0;

    function OnTick()
    {
        if (Game.IsEnding)
        {
            return;
        }
        if (self.PointMode)
        {
            self.UpdatePointMode();
        }
        else
        {
            self.UpdateLastManMode();
        }
    }

    function OnGameStart()
    {
        Game.SetPlaylist("Battle");
        if (self.PointMode)
        {
            Network.MyPlayer.ClearKDR();
        }
    }

    function OnCharacterDie(victim, killer, killerName)
    {
        if (victim.IsMainCharacter)
        {
            self._dieTimeLeft = self.RespawnDelay;
        }
    }

    function UpdatePointMode()
    {
        self._dieTimeLeft = self._dieTimeLeft - Time.TickTime;
        if (Network.MyPlayer.Status == "Dead" && self._dieTimeLeft <= 0.0)
        {
            Game.SpawnPlayer(Network.MyPlayer, false);
        }
        if (Game.GetMiscSetting("PVP") == 2)
        {
            redKills = 0;
            blueKills = 0;
            for (player in Network.Players)
            {
                if (player.Team == "Red")
                {
                    redKills = redKills + player.Kills;
                }
                elif (player.Team == "Blue")
                {
                    blueKills = blueKills + player.Kills;
                }
            }
            if (Network.IsMasterClient)
            {
                if (redKills >= self.MaxPoints)
                {
                    UI.SetLabelAll("MiddleCenter", "Red team wins!");
                    Game.End(10.0);
                }
                elif (blueKills >= self.MaxPoints)
                {
                    UI.SetLabelAll("MiddleCenter", "Blue team wins!");
                    Game.End(10.0);
                }
            }
            UI.SetLabel("TopCenter", "Red: " + Convert.ToString(redKills) + "   Blue: " + Convert.ToString(blueKills));
        }
        else
        {
            if (Network.IsMasterClient)
            {
                for (player in Network.Players)
                {
                    if (player.Kills >= self.MaxPoints)
                    {
                        UI.SetLabelAll("MiddleCenter", player.Name + " wins!");
                        Game.End(10.0);
                    }
                }
            }
            UI.SetLabel("TopCenter", "Points: " + Convert.ToString(Network.MyPlayer.Kills));
        }
    }

    function UpdateLastManMode()
    {
        humans = Game.Humans.Count;
        if (Network.IsMasterClient)
        {
            if (humans > 1)
            {
                self._hasSpawned = true;
            }
            elif (humans == 1 && self._hasSpawned)
            {
                UI.SetLabelAll("MiddleCenter", Game.Humans.Get(0).Player.Name + " wins!");
                Game.End(10.0);
            }
            elif (humans == 0 && self._hasSpawned)
            {
                UI.SetLabelAll("MiddleCenter", "Nobody wins!");
                Game.End(10.0);
            }
        }
        UI.SetLabel("TopCenter", "Players alive: " + Convert.ToString(humans));
    }
}

Thunderspear PVP

The Thunderspear PVP gamemode is a player versus player mode using only thunderspears.

翻译:(Thunderspear PVP 游戏模式是仅使用 Thunderspear 的玩家对玩家模式。)

class Main
{   
    PointMode = false;
    MaxPoints = 25;
    RespawnDelay = 5.0;
    InfiniteGas = true;
    _hasSpawned = false;
    _dieTimeLeft = 0.0;

    function OnTick()
    {
        if (Game.IsEnding)
        {
            return;
        }
        if (self.PointMode)
        {
            self.UpdatePointMode();
        }
        else
        {
            self.UpdateLastManMode();
        }
    }

    function OnGameStart()
    {
        Game.SetPlaylist("Battle");
        if (self.PointMode)
        {
            Network.MyPlayer.ClearKDR();
        }
    }

    function OnCharacterSpawn(character)
    {
        if (character.IsMainCharacter && character.Type == "Human" && self.InfiniteGas)
        {
            character.MaxGas = 100000;
            character.CurrentGas = 100000;
        }
    }

    function OnCharacterDie(victim, killer, killerName)
    {
        if (victim.IsMainCharacter)
        {
            self._dieTimeLeft = self.RespawnDelay;
        }
    }

    function UpdatePointMode()
    {
        self._dieTimeLeft = self._dieTimeLeft - Time.TickTime;
        if (Network.MyPlayer.Status == "Dead" && self._dieTimeLeft <= 0.0)
        {
            Game.SpawnPlayer(Network.MyPlayer, false);
        }
        if (Game.GetMiscSetting("PVP") == 2)
        {
            redKills = 0;
            blueKills = 0;
            for (player in Network.Players)
            {
                if (player.Team == "Red")
                {
                    redKills = redKills + player.Kills;
                }
                elif (player.Team == "Blue")
                {
                    blueKills = blueKills + player.Kills;
                }
            }
            if (Network.IsMasterClient)
            {
                if (redKills >= self.MaxPoints)
                {
                    UI.SetLabelAll("MiddleCenter", "Red team wins!");
                    Game.End(10.0);
                }
                elif (blueKills >= self.MaxPoints)
                {
                    UI.SetLabelAll("MiddleCenter", "Blue team wins!");
                    Game.End(10.0);
                }
            }
            UI.SetLabel("TopCenter", "Red: " + Convert.ToString(redKills) + "   Blue: " + Convert.ToString(blueKills));
        }
        else
        {
            if (Network.IsMasterClient)
            {
                for (player in Network.Players)
                {
                    if (player.Kills >= self.MaxPoints)
                    {
                        UI.SetLabelAll("MiddleCenter", player.Name + " wins!");
                        Game.End(10.0);
                    }
                }
            }
            UI.SetLabel("TopCenter", "Points: " + Convert.ToString(Network.MyPlayer.Kills));
        }
    }

    function UpdateLastManMode()
    {
        humans = Game.Humans.Count;
        if (Network.IsMasterClient)
        {
            if (humans > 1)
            {
                self._hasSpawned = true;
            }
            elif (humans == 1 && self._hasSpawned)
            {
                UI.SetLabelAll("MiddleCenter", Game.Humans.Get(0).Player.Name + " wins!");
                Game.End(10.0);
            }
            elif (humans == 0 && self._hasSpawned)
            {
                UI.SetLabelAll("MiddleCenter", "Nobody wins!");
                Game.End(10.0);
            }
        }
        UI.SetLabel("TopCenter", "Players alive: " + Convert.ToString(humans));
    }
}

Titan Explode(巨人爆炸模式)

The Titan Explode gamemode has titans explode and kill all players in radius upon death

翻译:(泰坦爆炸游戏模式让泰坦在死亡时爆炸并杀死范围内的所有玩家。)

class Main
{   
    Description = "Titans will explode on death.";
    ExplodeRadius = 30.0;
    MaxTitans = 10;
    TitanSpawnEvery = 3.0;
    _spawnTimeLeft = 0.0;
    _hasSpawned = false;

    function OnGameStart()
    {
        if (Network.IsMasterClient)
        {
            Game.SpawnTitans("Default", self.MaxTitans);
        }
    }

    function OnCharacterDie(victim, killer, killerName)
    {
        if (victim.Type == "Titan" && victim.IsMine)
        {
            if (victim.IsCrawler)
            {
                self.Explode(victim.NapePosition, 2.0);
            }
            else
            {
                self.Explode(victim.NapePosition, 1.0);
            }
        }
    }

    coroutine Explode(position, time)
    {
        wait time;
        Game.SpawnEffect("ThunderspearExplode", position, Vector3.Zero, self.ExplodeRadius * 2.0, Color(255, 255, 255, 255));
        for (human in Game.Humans)
        {
            if (Vector3.Distance(human.Position, position) < self.ExplodeRadius)
            {
                human.GetKilled("Explosion");
            }
        }
    }

    function OnTick()
    {
        if (Network.IsMasterClient && !Game.IsEnding)
        {
            humans = Game.Humans.Count;
            playerShifters = Game.PlayerShifters.Count;
            titans = Game.Titans.Count;
            if (humans > 0 || playerShifters > 0)
            {
                self._hasSpawned = true;
            }
            if (titans < self.MaxTitans)
            {
                self._spawnTimeLeft = self._spawnTimeLeft - Time.TickTime;
                if (self._spawnTimeLeft <= 0.0)
                {
                    Game.SpawnTitans("Default", 1);
                    self._spawnTimeLeft = self.TitanSpawnEvery;
                }
            }
            else
            {
                self._spawnTimeLeft = self.TitanSpawnEvery;
            }
            if (humans == 0 && playerShifters == 0 && self._hasSpawned)
            {
                UI.SetLabelAll("MiddleCenter", "Humanity failed!");
                Game.End(10.0);
                return;
            }
            UI.SetLabelAll("TopCenter", "Titans Left: " + Convert.ToString(titans));
        }
    }
}

Cranked

The cranked gamemode has players die after a certain time limit, but killing titans increases the time remaining.

Created by Player2.

翻译:(曲柄游戏模式让玩家在一定时间限制后死亡,但杀死泰坦会增加剩余时间。由 Player2 创建。)

class Main
{   
    Description = "Survive as long as possible under a time limit. Killing titans adds time. Created by p2.";
    MaxTitans = 15;
    TitanSpawnEvery = 3.0;
    StartTimeLimit = 45.0;
    TitanAddTime = 6.0;
    _CrankedTimeDangerZone = 10.0;
    _hasSpawned = false;
    _hasMyPlayerSpawned = false;
    _spawnTimeLeft = 0.0;
    _startTime = -1.0;
    _endTime = -1.0;

    function OnGameStart()
    {
        if (Network.IsMasterClient)
        {
            Game.SpawnTitans("Default", self.MaxTitans);
        }
    }

    function OnCharacterDie(victim, killer, killerName)
    {
        if (victim.Type == "Titan" && killer.IsMainCharacter)
        {
            self.StartTimeLimit = self.StartTimeLimit + self.TitanAddTime;
        }
        if (victim.IsMainCharacter)
        {
            self._endTime = Time.GameTime;
            self.StartTimeLimit = 0.0;
            self._hasMyPlayerSpawned = false;
        }
    }

    function OnPlayerSpawn(player, character)
    {
        if (player == Network.MyPlayer)
        {
            self._startTime = Time.GameTime;
            self._hasMyPlayerSpawned = true;
        }
    }

    function OutOfTime()
    {
        character = Network.MyPlayer.Character;
        if (character != null && (character.Type == "Human" || character.Type == "Shifter"))
        {
            character.GetKilled("Out of time");
            position = character.Position;
            if (character.Type == "Shifter")
            {
                position = character.NapePosition;
            }
            Game.SpawnEffect("ThunderspearExplode", position, Vector3.Zero, 50.0, Color(255, 255, 255, 255), "Air");
        }
    }

    function OnTick()
    {
        titans = Game.Titans.Count;
        if (!Game.IsEnding && Network.IsMasterClient)
        {
            humans = Game.Humans.Count;
            playerShifters = Game.PlayerShifters.Count;
            if (humans > 0 || playerShifters > 0)
            {
                self._hasSpawned = true;
            }
            if (titans < self.MaxTitans)
            {
                self._spawnTimeLeft = self._spawnTimeLeft - Time.TickTime;
                if (self._spawnTimeLeft <= 0.0)
                {
                    Game.SpawnTitans("Default", 1);
                    self._spawnTimeLeft = self.TitanSpawnEvery;
                }
            }
            else
            {
                self._spawnTimeLeft = self.TitanSpawnEvery;
            }
            if (humans == 0 && playerShifters == 0 && self._hasSpawned)
            {
                UI.SetLabelAll("MiddleCenter", "Humanity failed!");
                Game.End(10.0);
                return;
            }
        }
        if (!self._hasMyPlayerSpawned)
        {
            return;
        }

        self.StartTimeLimit = self.StartTimeLimit - Time.TickTime;
        if (Game.IsEnding)
        {
            self.StartTimeLimit = 0.0;
        }
        if (self.StartTimeLimit <= self._CrankedTimeDangerZone)
        {
            CrankedTimeDisplay = "Cranked Time: <color=#ff0000>" + String.FormatFloat(self.StartTimeLimit, 2) + "</color>"; 
        }
        else
        {
            CrankedTimeDisplay = "Cranked Time: " + Convert.ToString(Convert.ToInt(self.StartTimeLimit)); 
        }
        if (self.StartTimeLimit <= 0)
        {
            self.OutOfTime();
            CrankedTimeDisplay = "Cranked Time: <color=#ff0000>0.00!</color>";
            if (self._endTime != -1.0 && self._startTime != -1.0)
            {
                self._startTime = Math.Min(self._startTime, self._endTime);
                surviveTime = self._endTime - self._startTime;
                CrankedTimeDisplay = CrankedTimeDisplay + String.Newline + "You survived <color=#ffd700>" + String.FormatFloat(surviveTime, 2) + "</color> seconds";
            }
        }
        UI.SetLabel("TopCenter", "Titans Left: " + Convert.ToString(titans) + String.Newline + CrankedTimeDisplay);
    }
}

例子—组件

SupplyStation(补给站)

The SupplyStation component allows humans to refill gas and blades when in a certain region.

翻译:(SupplyStation 组件允许人类在某个区域重新填充气体和叶片。)

component SupplyStation
{
    UnlimitedRefills = true;
    MaxRefills = 0;
    _currentHumanRefill = null;
    _currentHuman = null;

    function Init()
    {
        self._refillsLeft = self.MaxRefills;
        self.MapObject.AddBoxCollider("Region", "Characters", Vector3(0,-2,0), Vector3(14,8,14));
    }

    function OnCollisionStay(other)
    {
        if (other.Type == "Human" && other.IsMine && (self.UnlimitedRefills || self._refillsLeft > 0))
        {
            self._currentHuman = other;
            self._currentHumanRefill = other;
            UI.SetLabelForTime("MiddleCenter", "Press " + Input.GetKeyName("Interaction/Interact") + " to refill." + String.Newline + "Press " + Input.GetKeyName("Interaction/Interact2") + " to change loadout.", 0.1);
        }
    }

    function OnFrame()
    {
        if (self._currentHumanRefill != null)
        {
            if ((self._currentHumanRefill.AutoRefillGas || Input.GetKeyDown("Interaction/Interact")) && self._currentHumanRefill.Refill(true))
            {
                self._currentHumanRefill = null;
                self._refillsLeft = self._refillsLeft - 1;
            }
        }
        if (self._currentHuman != null)
        {
            if (Input.GetKeyDown("Interaction/Interact2"))
            {
                self._currentHuman = null;
                UI.ShowChangeCharacterMenu();
            }
        }
    }

    function OnCollisionExit(other)
    {
        if (other.Type == "Human" && other.IsMine)
        {
            self._currentHuman = null;
            self._currentHumanRefill = null;
        }
    }
}

Daylight(全局光)

The Daylight component allows adding directional lighting to a map.

翻译:(Daylight 组件允许向地图添加定向照明。)

component Daylight
{
    Color = Color(255, 255, 255, 255);
    Intensity = 1.0;
    WeatherControlled = true;

    function Init()
    {
        self.MapObject.AddBuiltinComponent("Daylight", self.Color, self.Intensity, self.WeatherControlled);
    }
}

PointLight(局域光)

The PointLight component allows adding point lighting to a map. This creates light that comes from a point source with a specific range, rather than a global direction like Daylight.

翻译:(PointLight 组件允许向地图添加点光照。这将创建来自具有特定范围的点源的灯光,而不是像 Daylight 这样的全局方向。)

component PointLight
{
    Color = Color(255, 255, 255, 255);
    Intensity = 1.0;
    Range = 10.0;

    function Init()
    {
        self.MapObject.AddBuiltinComponent("PointLight", self.Color, self.Intensity, self.Range);
    }
}

Rigidbody(刚体)

The Rigidbody component allows adding physics to a map object. Once added, you can use the SetVelocity and AddForce methods on the component to simulate physics, and GetVelocity to get the current velocity.

翻译:(Rigidbody 组件允许向地图对象添加物理特性。添加后,您可以在组件上使用 SetVelocity 和 AddForce 方法来模拟物理特性,并使用 GetVelocity 来获取当前速度。)

component Rigidbody
{
    Mass = 1.0;
    Gravity = Vector3(0.0, -20.0, 0.0);
    FreezeRotation = false;
    Interpolate = false;

    function Init()
    {
        self.MapObject.AddBuiltinComponent("Rigidbody", self.Mass, self.Gravity, self.FreezeRotation, self.Interpolate);
    }

    function SetVelocity(velocity)
    {
        self.MapObject.UpdateBuiltinComponent("Rigidbody", "SetVelocity", velocity);
    }

    function AddForce(force)
    {
        self.MapObject.UpdateBuiltinComponent("Rigidbody", "AddForce", force);
    }

    function AddForceWithMode(force, mode)
    {
        self.MapObject.UpdateBuiltinComponent("Rigidbody", "AddForce", force, mode);
    }

    function AddForceWithModeAtPoint(force, point, mode)
    {
        self.MapObject.UpdateBuiltinComponent("Rigidbody", "AddForce", force, mode, point);
    }

    function AddTorque(force, mode)
    {
        self.MapObject.UpdateBuiltinComponent("Rigidbody", "AddTorque", force, mode);
    }

    function GetVelocity()
    {
        return self.MapObject.ReadBuiltinComponent("Rigidbody", "Velocity");
    }

    function GetAngularVelocity()
    {
        return self.MapObject.ReadBuiltinComponent("Rigidbody", "AngularVelocity");
    }
}

NavMeshObstacle(寻路网格障碍物)

Wraps the object in a NavMeshObstacle unity component auto-sized based on the collider sizes. If “Smart Movement” is enabled in Titan settings, titans will pathfind around obstacles unless trying to target a human which overrides navigation with aottg1’s AI movement.

翻译:(将对象包裹在 NavMeshObstacle Unity 组件中,该组件根据碰撞器大小自动调整大小。如果在 Titan 设置中启用了“Smart Movement”,则 Titans 将在障碍物周围寻路,除非试图以人类为目标,从而覆盖了 aottg1 的 AI 移动导航。)

component NavMeshObstacle
{
    Description = "Adds a navMeshObstacle to the object";
    _nav = null;

    function Init()
    {
        # Add the component like how we add Rigidbody
        _nav = self.MapObject.AddBuiltinComponent("NavMeshObstacle", false);
    }
}

Cannon(大炮)

The Cannon component allows Cannon2 and Cannon3 to become functional networked cannons. Do not use this on any other objects.

翻译:(Cannon 组件允许 Cannon2 和 Cannon3 成为功能性网络加农炮。请勿对任何其他对象使用此项。)

component Cannon
{
    UnlimitedAmmo = true;
    MaxAmmo = 0;
    Cooldown = 3.0;
    _rotateSpeed = 20;
    _ballSpeed = 300.0;
    _barrel = null;
    _humanMount = null;
    _barrelEnd = null;
    _inUse = false;
    _cooldownLeft = 0.0;
    _ammoLeft = 0;
    _human = null;
    _collidingHuman = null;

    function Init()
    {
        self._barrel = self.MapObject.GetTransform("Barrel");
        self._barrelEnd = self._barrel.GetTransform("End");
        self._humanMount = self.MapObject.GetTransform("HumanMount");
        self.MapObject.AddSphereCollider("Region", "Characters", Vector3.Zero, 15.0);
        self._ammoLeft = self.MaxAmmo;
    }

    function SendNetworkStream()
    {
        self.NetworkView.SendStream(self._barrel.LocalRotation);
        self.NetworkView.SendStream(self._inUse);
        self.NetworkView.SendStream(self._ammoLeft);
    }

    function OnNetworkStream()
    {
        rotation = self.NetworkView.ReceiveStream();
        self._barrel.LocalRotation = rotation;
        self._inUse = self.NetworkView.ReceiveStream();
        self._ammoLeft = self.NetworkView.ReceiveStream();
    }

    function OnNetworkMessage(sender, message)
    {
        if (Network.IsMasterClient && self.NetworkView.Owner == Network.MyPlayer && !self._inUse && message == "request")
        {
            self.NetworkView.Transfer(sender);
        }
    }

    function OnNetworkTransfer(oldOwner, newOwner) 
    {
        if (newOwner == Network.MasterClient && Network.IsMasterClient)
        {
            self._inUse = false;
            self.ResetBarrel();
        }
        elif (newOwner == Network.MyPlayer)
        {
            self._inUse = true;
            human = Network.MyPlayer.Character;
            if (human != null && human.Type == "Human")
            {
                human.MountTransform(self._humanMount, Vector3.Zero, Vector3.Zero);
                self._human = human;
            }
        }
    }

    function OnCollisionStay(other)
    {
        if (other.Type == "Human" && other.IsMine && !self._inUse)
        {
            UI.SetLabelForTime("MiddleCenter", "Press " + Input.GetKeyName("Interaction/Interact") + " to use cannon.", 0.1);
            self._collidingHuman = other;
        }
    }

    function OnTick()
    {
        self._collidingHuman = null;
    }

    function OnFrame()
    {
        if (self._inUse && self.NetworkView.Owner == Network.MyPlayer)
        {
            self._cooldownLeft = self._cooldownLeft - Time.FrameTime;
            message = "Cooldown: " + Convert.ToString(Convert.ToInt(Math.Clamp(self._cooldownLeft, 0.0, self.Cooldown)));
            if (!self.UnlimitedAmmo)
            {
                message = message + " Ammo: " + Convert.ToString(self._ammoLeft);
            }
            UI.SetLabelForTime("MiddleCenter", message, 0.1);
            barrelRotation = self._barrel.LocalRotation;
            baseRotation = self.MapObject.Rotation;
            if (Input.GetKeyHold("General/Left"))
            {
                baseRotation.Y = baseRotation.Y - self._rotateSpeed * Time.FrameTime;
            }
            elif (Input.GetKeyHold("General/Right"))
            {
                baseRotation.Y = baseRotation.Y + self._rotateSpeed * Time.FrameTime;
            }
            if (Input.GetKeyHold("General/Forward"))
            {
                barrelRotation.X = barrelRotation.X - self._rotateSpeed * Time.FrameTime;
            }
            elif (Input.GetKeyHold("General/Back"))
            {
                barrelRotation.X = barrelRotation.X + self._rotateSpeed * Time.FrameTime;
            }
            barrelRotation.X = Math.Clamp(barrelRotation.X, -45.0, 45.0);
            self._barrel.LocalRotation = barrelRotation;
            self.MapObject.Rotation = baseRotation;
            hasAmmo = self._ammoLeft > 0 || self.UnlimitedAmmo;
            if (self._cooldownLeft <= 0.0 && hasAmmo && Input.GetKeyHold("Human/AttackDefault"))
            {
                self.Fire();
            }
            if (Input.GetKeyDown("Interaction/Interact"))
            {
                self._human.Unmount();
                self.NetworkView.Transfer(Network.MasterClient);
                self._inUse = false;
                self.ResetBarrel();
                return;
            }
        }
        if (self.NetworkView.Owner == Network.MyPlayer && self._inUse)
        {
            if (self.NetworkView.Owner.Character == null || self.NetworkView.Owner.Character.Type != "Human" || self.NetworkView.Owner.Character.MountedTransform != self._humanMount)
            {
                self.NetworkView.Transfer(Network.MasterClient);
                self._inUse = false;
                self.ResetBarrel();
                return;
            }
        }
        if (!self._inUse && self._collidingHuman != null)
        {
            if (Input.GetKeyDown("Interaction/Interact")) 
            {
                if (self.NetworkView.Owner == Network.MyPlayer) 
                {
                    self._inUse = true;
                    self._collidingHuman.MountTransform(self._humanMount, Vector3.Zero, Vector3.Zero);
                    self._human = self._collidingHuman;
                }
                else
                {
                    self.NetworkView.SendMessage(self.NetworkView.Owner, "request");
                }
            }
        }
    }

    function ResetBarrel()
    {
        self._barrel.LocalRotation = Vector3(0, 0, 0);
    }

    function Fire()
    {
        self._cooldownLeft = self.Cooldown;
        self._ammoLeft = self._ammoLeft - 1;
        if (self._human != null)
        {
            Game.SpawnEffect("Boom2", self._barrelEnd.Position, self.MapObject.Rotation, 0.5);
            Game.SpawnProjectileWithOwner("CannonBall", self._barrelEnd.Position, Vector3.Zero, self._barrel.Forward.Normalized * self._ballSpeed, 
            Vector3(0, -20, 0), 2.0, self._human);
        }
    }
}

Dummy(虚拟傀儡假人)

The Dummy component allows Dummy2 to become a functional networked dummy titan. Do not use this on any other objects.

翻译:(Dummy 组件允许 Dummy2 成为功能性网络虚拟 Titan。请勿对任何其他对象使用此项。)

component Dummy
{
    ResetCount = 0;
    ResetDelay = 5.0;
    _state = "Alive";
    _currentResetTime = 0.0;

    function Init()
    {
        self.MapObject.Transform.PlayAnimation("Armature|dummy_idle");
        self.MapObject.AddSphereCollider("Region", "Hitboxes", Vector3(0, 12.4, -3.7), 1.0);
    }

    function OnNetworkMessage(sender, message)
    {
        if (message == "hit")
        {
            if (self._state == "Alive")
            {
                self.MapObject.Transform.PlayAnimation("Armature|dummy_fall");
                self.MapObject.GetTransform("FallSound").PlaySound();
            }
            self._currentResetTime = self.ResetDelay;
            self._state = "Dead";
        }
    }

    function OnTick()
    {
        self._currentResetTime = self._currentResetTime - Time.TickTime;
        if (self._state == "Dead")
        {
            if (self._currentResetTime <= 0 && self.ResetCount > 0)
            {
                self.ResetCount = self.ResetCount - 1;
                self._state = "Rise";
                self.MapObject.Transform.PlayAnimation("Armature|dummy_rise");
                self.MapObject.GetTransform("RiseSound").PlaySound();
                self._currentResetTime = 1.0;
            }
        }
        elif (self._state == "Rise")
        {
            if (self._currentResetTime <= 0)
            {
                self._state = "Alive";
                self.MapObject.Transform.PlayAnimation("Armature|dummy_idle");
            }
        }
    }

    function OnGetHit(character, name, damage, type)
    {
        if (self._state == "Alive")
        {
            self.NetworkView.SendMessageAll("hit");
        }
    }
}

Wagon(马车)

The Wagon component allows Wagon2 to become a functional networked wagon. Do not use this on any other objects.

翻译:(Wagon 组件允许 Wagon2 成为功能性的联网 Wagon。请勿对任何其他对象使用此项。)

component Wagon
{
    MoveForce = 20.0;
    MaxMoveSpeed = 50.0;
    RotateSpeed = 3.0;
    _inUse = false;
    _riding = false;
    _horse = null;
    _human = null;
    _collidingHuman = null;
    _collidingDrive = false;
    _collidingRide = false;
    _collidingGas = false;
    _rigidbody = null;
    _leftWheel = null;
    _rightWheel = null;
    _leftSitTransform = null;
    _rightSitTransform = null;

    function Init()
    {
        self._horse = self.MapObject.GetTransform("Horse");
        self.MapObject.AddSphereCollider("Region", "Characters", Vector3.Zero, 10.0);
        self._rigidbody = self.MapObject.GetComponent("Rigidbody");
        self._leftWheel = self.MapObject.GetTransform("Carriage/Wheels/LeftWheelPivot");
        self._rightWheel = self.MapObject.GetTransform("Carriage/Wheels/RightWheelPivot");
        self._leftSitTransform = self.MapObject.GetTransform("SitRegionBottomLeft");
        self._rightSitTransform = self.MapObject.GetTransform("SitRegionBottomRight");
    }

    function OnNetworkMessage(sender, message)
    {
        if (Network.IsMasterClient && self.NetworkView.Owner == Network.MyPlayer && !self._inUse && message == "request")
        {
            self.NetworkView.Transfer(sender);
        }
    }

    function OnNetworkTransfer(oldOwner, newOwner) 
    {
        if (newOwner == Network.MasterClient && Network.IsMasterClient)
        {
            self._inUse = false;
        }
        elif (newOwner == Network.MyPlayer)
        {
            self._inUse = true;
            human = Network.MyPlayer.Character;
            if (human != null && human.Type == "Human")
            {
                human.MountTransform(self._horse, Vector3(0, 1.95, 0), Vector3.Zero);
                self._human = human;
            }
        }
    }

    function OnCollisionStay(other)
    {
        if (other.Type == "Human" && other.IsMine)
        {
            diff = (other.Position - self.MapObject.Position);
            project = Vector3.Project(diff, self.MapObject.Forward);
            if (project.Magnitude > 3 * self.MapObject.Scale.Z && project.Normalized == self.MapObject.Forward)
            {
                if (!self._inUse && !self._riding)
                {
                    UI.SetLabelForTime("MiddleCenter", "Press " + Input.GetKeyName("Interaction/Interact") + " to drive wagon.", 0.1);
                    self._collidingHuman = other;
                    self._collidingDrive = true;
                }
            }
            elif (project.Magnitude > 4 * self.MapObject.Scale.Z && project.Normalized == self.MapObject.Forward * -1.0)
            {
                if (!self._riding)
                {
                    UI.SetLabelForTime("MiddleCenter", "Press " + Input.GetKeyName("Interaction/Interact") + " to ride wagon.", 0.1);
                    self._collidingHuman = other;
                    self._collidingRide = true;
                }
            }
            else
            {
                if (!self._inUse && !self._riding)
                {
                    UI.SetLabelForTime("MiddleCenter", "Press " + Input.GetKeyName("Interaction/Interact") + " to refill.", 0.1);
                    self._collidingHuman = other;
                    self._collidingGas = true;
                }
            }
        }
    }

    function OnTick()
    {
        self._collidingHuman = null;
        self._collidingDrive = false;
        self._collidingRide = false;
        self._collidingGas = false;

        if (self._leftWheel != null && self._rightWheel != null)
        {
            L = Vector3.Distance(self._leftWheel.Position, self._rightWheel.Position);
            r = self._leftWheel.Scale.Y / 2;

            localVelocity = self.MapObject.Transform.InverseTransformDirection(self._rigidbody.GetVelocity());
            angularVelocity = self._rigidbody.GetAngularVelocity();
            
            v_x = localVelocity.Z;
            omega = angularVelocity.Y;

            leftWheelRotationSpeed = (v_x - (L / 2) * omega) / r;
            rightWheelRotationSpeed = (v_x + (L / 2) * omega) / r;

            leftWheelRotation = leftWheelRotationSpeed * Time.TickTime * Math.Rad2DegConstant * 0.3; # Character moves too fast for irl physics
            rightWheelRotation = rightWheelRotationSpeed * Time.TickTime * Math.Rad2DegConstant * 0.3;

            self._leftWheel.Rotate(Vector3(leftWheelRotation, 0, 0));
            self._rightWheel.Rotate(Vector3(rightWheelRotation, 0, 0));

        }
    }

    function OnFrame()
    {
        if (self.NetworkView.Owner == Network.MyPlayer)
        {
            if (self._inUse)
            {
                if (self._human.HasTargetDirection)
                {
                    self.MapObject.Forward = Vector3.Lerp(self.MapObject.Forward, self._human.TargetDirection, self.RotateSpeed * Time.FrameTime);
                    self._rigidbody.AddForce(self.MapObject.Forward * self.MoveForce);
                    velocity = self._rigidbody.GetVelocity();
                    self._rigidbody.SetVelocity(velocity.Normalized * Math.Min(velocity.Magnitude, self.MaxMoveSpeed));
                }
                else
                {
                    velocity = self._rigidbody.GetVelocity();
                    if (velocity.Magnitude < 1)
                    {
                        self._rigidbody.SetVelocity(Vector3.Up * velocity.Y);
                    }
                    else
                    {
                        self._rigidbody.AddForce(-0.5 * velocity.Normalized * velocity.Magnitude);
                    }
                }
                if (self._rigidbody.GetVelocity().Magnitude > 1)
                {
                    self._human.PlayAnimation("Armature|horse_run");
                }
                else
                {
                    self._human.PlayAnimation("Armature|horse_idle");
                }
                if (Input.GetKeyDown("Interaction/Interact"))
                {
                    self._human.Unmount();
                    self.NetworkView.Transfer(Network.MasterClient);
                    self._inUse = false;
                    return;
                }
                if (self.NetworkView.Owner.Character == null || self.NetworkView.Owner.Character.Type != "Human" || self.NetworkView.Owner.Character.MountedTransform != self._horse)
                {
                    self.NetworkView.Transfer(Network.MasterClient);
                    self._inUse = false;
                    return;
                }
            }
            else
            {
                velocity = self._rigidbody.GetVelocity();
                if (velocity.Magnitude < 1)
                {
                    self._rigidbody.SetVelocity(Vector3.Up * velocity.Y);
                }
                else
                {
                    self._rigidbody.AddForce(-0.5 * velocity.Normalized * velocity.Magnitude);
                }
            }
        }
        if (self._riding)
        {
            if (self._human == null || self._human.MountedMapObject != self.MapObject)
            {
                self._riding = false;
                return;
            }
            if (Input.GetKeyDown("Interaction/Interact"))
            {
                self._human.Unmount();
                self._riding = false;
            }
            else
            {
                self._human.PlayAnimation("Armature|horse_idle");
            }
        }
        if (self._collidingHuman != null)
        {
            if (Input.GetKeyDown("Interaction/Interact"))
            {
                if (self._collidingDrive && !self._inUse)
                {
                    if (self.NetworkView.Owner == Network.MyPlayer) 
                    {
                        self._inUse = true;
                        self._collidingHuman.MountTransform(self._horse, Vector3(0, 1.95, 0), Vector3.Zero);
                        self._human = self._collidingHuman;
                    }
                    else
                    {
                        self.NetworkView.SendMessage(self.NetworkView.Owner, "request");
                    }
                }
                elif (self._collidingGas && !self._inUse)
                {
                    self._collidingHuman.Refill(true);
                }
                elif (self._collidingRide && !self._riding)
                {
                    self._riding = true;
                    self._human = self._collidingHuman;
                    posA = self._leftSitTransform.LocalPosition; # Vector3(-1.0, 1.78, -3.5);
                    posB = self._rightSitTransform.LocalPosition; # Vector3(1.0, 1.78, 1.0);
                    self._human.MountMapObject(self.MapObject, Random.RandomVector3(posA, posB), Vector3(0, 0, 0));
                }
            }
        }
        self.UpdateHorse();
    }

    function UpdateHorse()
    {
        if (self._rigidbody.GetVelocity().Magnitude > 1)
        {
            self._horse.PlayAnimation("horse_Run");
            self.MapObject.GetTransform("RunSound").PlaySound();
            self.MapObject.GetTransform("Dust").ToggleParticle(true);
        }
        else
        {
            self._horse.PlayAnimation("horse_idle0");
            self.MapObject.GetTransform("RunSound").StopSound();
            self.MapObject.GetTransform("Dust").ToggleParticle(false);
        }
    }
}

Tag(标签)

The Tag component allows us to search for the MapObject by tag name.

翻译:(Tag 组件允许我们按标签名称搜索 MapObject。)

component Tag
{
    Name = "";

    function Init()
    {
        self.MapObject.AddBuiltinComponent("Tag", self.Name);
    }
}

KillRegion(杀戮区域)

The KillRegion component kills characters that enter the region.

翻译:(KillRegion 组件会杀死进入该区域的角色。)

component KillRegion
{
    Team = "None";
    KillHumans = true;
    KillTitans = true;
    KillShifters = true;
    KillMessage = "Server";

    function OnCollisionEnter(other)
    {
        if (other.IsCharacter && other.IsMine)
        {
            if (other.Type == "Human" && !self.KillHumans)
            {
                return;
            }
            if (other.Type == "Titan" && !self.KillTitans)
            {
                return;
            }
            if (other.Type == "Shifter" && !self.KillShifters)
            {
                return;
            }
            if (other.Team != self.Team && self.Team != "None")
            {
                return;
            }
            other.GetKilled(self.KillMessage);
        }
    }
}

DamageRegion(伤害区域)

The DamageRegion component damages characters that enter the region.

翻译:(DamageRegion 组件会损坏进入该区域的字符。)

component DamageRegion
{
    Damage = 1;
    Team = "None";
    DamageHumans = true;
    DamageTitans = true;
    DamageShifters = true;
    KillMessage = "Server";

    function OnCollisionEnter(other)
    {
        if (other.IsCharacter && other.IsMine)
        {
            if (other.Type == "Human" && !self.DamageHumans)
            {
                return;
            }
            if (other.Type == "Titan" && !self.DamageTitans)
            {
                return;
            }
            if (other.Type == "Shifter" && !self.DamageShifters)
            {
                return;
            }
            if (other.Team != self.Team && self.Team != "None")
            {
                return;
            }
            other.GetDamaged(self.KillMessage, self.Damage);
        }
    }
}

MovePingPong(两点间位置移动)

The MovePingPong component moves an object between two positions. If RelativePositions is false, it will use the world position instead of the local position.

翻译:(MovePingPong 组件在两个位置之间移动对象。如果 RelativePositions 为 false,它将使用世界位置而不是本地位置。)

component MovePingPong
{
    RelativePositions = true;
    StartPosition = Vector3(0, 0, 0);
    EndPosition = Vector3(0, 0, 0);
    Speed = 10.0;
    PauseTime = 0.0;
    _currentProgress = 0.0;
    _backwards = false;
    _pauseTimeLeft = 0.0;

    function Init()
    {
        if (self.RelativePositions)
        {
            self.StartPosition = self.MapObject.Position + self.StartPosition;
            self.EndPosition = self.MapObject.Position + self.EndPosition;
        }

        distance = Vector3.Distance(self.StartPosition, self.EndPosition);
        self._step = 1.0;
        if (distance > 0)
        {
            self._step = self.Speed / distance;
        }
    }

    function OnTick()
    {
        if (self._pauseTimeLeft > 0)
        {
            self._pauseTimeLeft = self._pauseTimeLeft - Time.TickTime;
            return;
        }
        if (self._backwards)
        {
            self._currentProgress = self._currentProgress - Time.TickTime * self._step;
            if (self._currentProgress <= 0.0)
            {
                self._currentProgress = 0.0;
                self._backwards = false;
                self._pauseTimeLeft = self.PauseTime;
            }
            self.MapObject.Position = Vector3.Lerp(self.StartPosition, self.EndPosition, self._currentProgress);
        }
        else
        {
            self._currentProgress = self._currentProgress + Time.TickTime * self._step;
            if (self._currentProgress >= 1.0)
            {
                self._currentProgress = 1.0;
                self._backwards = true;
                self._pauseTimeLeft = self.PauseTime;
            }
            self.MapObject.Position = Vector3.Lerp(self.StartPosition, self.EndPosition, self._currentProgress);
        }
    }
}

RacingCheckpointRegion(竞速存档区域)

The RacingCheckpointRegion component refills human gas and sets the respawn point if the current game mode is racing.

翻译:(如果当前游戏模式是竞速,则 RacingCheckpointRegion 组件会重新填充人体气体并设置重生点。)

component RacingCheckpointRegion
{
    Refill = true;
    PlaySound = true;

    function OnCollisionEnter(other)
    {
        if (other.Type == "Human" && other.IsMine)
        {
            if (self.Refill)
            {
                other.RefillImmediate();
            }
            if (self.PlaySound)
            {
                other.PlaySound("Checkpoint");
            }
            other.Player.SpawnPoint = self.MapObject.Position;
        }
    }
}

RacingFinishRegion(竞速完成区域)

The RacingFinishRegion component finishes the race if the current gamemode is Racing.

翻译:(如果当前游戏模式为 Racing,则 RacingFinishRegion 组件将完成比赛。)

component RacingFinishRegion
{
    function OnCollisionEnter(other)
    {
        if (other.Type == "Human" && other.IsMine)
        {
            Main.FinishRace(other);
        }
    }
}

TeleportRegion(传送区域)

The TeleportRegion component teleports characters who enter the region to another position.

翻译:(TeleportRegion 组件将进入该区域的角色传送到另一个位置。)

component TeleportRegion
{
    RelativePosition = false;
    Position = Vector3(0, 0, 0);
    TeleportHumans = true;
    TeleportTitans = true;
    TeleportShifters = true;

    function Init()
    {
        if (self.RelativePosition)
        {
            self.Position = self.MapObject.Position + self.Position;
        }
    }

    function OnCollisionEnter(other)
    {
        if (other.IsCharacter && other.IsMine)
        {
            if (other.Type == "Human" && !self.TeleportHumans)
            {
                return;
            }
            if (other.Type == "Titan" && !self.TeleportTitans)
            {
                return;
            }
            if (other.Type == "Shifter" && !self.TeleportShifters)
            {
                return;
            }
            other.Position = self.Position;
        }
    }
}

Animal(赋予行为特征)

Used to give some animal map objects some life. Don’t attach to other objects.

翻译:(用于为某些 Animal Map 对象赋予一些生命。不要附加到其他对象。)

component Animal
{
    Wanders = true;
    WanderRadius = 50.0;
    WanderSpeed = 5.0;
    WalkAnimation = "";
    IdleAnimations = "";
    ActionAnimations = "";
    ActionSounds = "";
    _stateTimeLeft = 0.0;
    _idleAnimations = List();
    _actionAnimations = List();
    _actionSounds = List();
    _transform = null;
    _originalPosition = null;
    _state = "Idle";
    _targetRotation = null;
    _hasAction = false;

    function Init()
    {
        for (anim in String.Split(self.IdleAnimations, "/"))
        {
            if (anim != "")
            {
                self._idleAnimations.Add(anim);
            }
        }
        for (anim in String.Split(self.ActionAnimations, "/"))
        {
            if (anim != "")
            {
                self._actionAnimations.Add(anim);
            }
        }
        for (anim in String.Split(self.ActionSounds, "/"))
        {
            if (anim != "")
            {
                self._actionSounds.Add(anim);
            }
        }
        self._transform = self.MapObject.Transform;
        self._originalPosition = self._transform.Position;
        self._hasAction = self._actionAnimations.Count > 0;
        self._rigidbody = self.MapObject.GetComponent("Rigidbody");
        self.Idle();
    }

    function OnFrame()
    {  
        self._stateTimeLeft = self._stateTimeLeft - Time.FrameTime;
        if (self._state == "Wander")
        {
            if (Vector3.Distance(self._originalPosition, self._transform.Position) > self.WanderRadius)
            {
                self.Idle();            
            }
            else
            {
                if (self._targetRotation != Vector3.Zero)
                {
                    self.MapObject.Forward = Vector3.Lerp(self.MapObject.Forward, self._targetRotation, 5.0 * Time.FrameTime);
                }
                self._rigidbody.SetVelocity(self.MapObject.Forward * self.WanderSpeed);
            }
        }
        elif (self._state == "Returning")
        {
            if (self._targetRotation != Vector3.Zero)
            {
                self.MapObject.Forward = Vector3.Lerp(self.MapObject.Forward, self._targetRotation, 5.0 * Time.FrameTime);
            }
            self._rigidbody.SetVelocity(self.MapObject.Forward * self.WanderSpeed);
        }
        else
        {
            self._rigidbody.SetVelocity(Vector3.Up * self._rigidbody.GetVelocity().Y);
        }
        if (self._stateTimeLeft <= 0.0)
        {
            if (self._state == "Idle")
            {
                if (self._hasAction && Random.RandomFloat(0.0, 1.0) < 0.7)
                {
                    self.Action();
                }
                else
                {
                    self.Wander();
                }
            }
            else
            {
                self.Idle();
            }
        }
    }

    function Idle()
    {
        self._state = "Idle";
        anim = self._idleAnimations.Get(Random.RandomInt(0, self._idleAnimations.Count));
        self._transform.PlayAnimation(anim, 0.2);
        self._stateTimeLeft = Random.RandomFloat(4.0, 8.0);
    }

    function Action()
    {
        self._state = "Action";
        index = Random.RandomInt(0, self._actionAnimations.Count);
        anim = self._actionAnimations.Get(index);
        self._transform.PlayAnimation(anim, 0.2);
        self._stateTimeLeft = self._transform.GetAnimationLength(anim) + 0.2;
        if (self._actionSounds.Count > index)
        {
            sound = self._actionSounds.Get(index);
            if (sound != "None")
            {
                self._transform.GetTransform(sound).PlaySound();
            }
        }
    }

    function Wander()
    {
        self._state = "Wander";
        self._transform.PlayAnimation(self.WalkAnimation, 0.2);
        self._stateTimeLeft = Random.RandomFloat(3.0, 6.0);
        if (Vector3.Distance(self._transform.Position, self._originalPosition) > self.WanderRadius * 0.7)
        {
            x = self._originalPosition.X - self._transform.Position.X;
            z = self._originalPosition.Z - self._transform.Position.Z;
            self._targetRotation = Vector3(x, 0, z).Normalized;
            self._state = "Returning";
        }
        else
        {
            self._targetRotation = Vector3(Random.RandomFloat(-1.0, 1.0), 0, Random.RandomFloat(-1.0, 1.0)).Normalized;
        }
    }
}

SignalMover(信号移动器)

This and all other Signal components are useful for more complicated animated movement. You can use the SignalSender activating the SignalMover. (Ex: Setting a trigger with Signal Sender that when hit kicks off a SignalMover)

When using this component, please mark the object as Networked and not Static.

翻译:(此组件和所有其他 Signal组件对于更复杂的动画运动非常有用。您可以使用 SignalSender 激活 SignalMover。(例如:使用 Signal Sender 设置触发器,当按下该触发器时,会启动 SignalMover)

翻译:(使用此组件时,请将对象标记为 Networked 而不是 Static。)

component SignalMover
{
    Activate = true;
    Reverse = false;
    Easing = "Linear";
    ReverseFlipsCurve = false;
    TargetPosition = Vector3(0,0,0);
    TimesPerSecond = 1.0;
    RepeatTimes = 0;
    Infinite = true;
    Interpolate = false;
    
    Description = "Moves the object. Activate auto-disables after operation is done, re-send signal to restart. Use SignalSender component if Modular use is necessary.";
    ActivateTooltip = "Enable to start operation. Counts as 1 repeat time.";
    ReverseTooltip = "Returns to original position after Target movement.";
    ReverseFlipsCurveTooltip = "If reverse is enabled, this alternates the easing for the In/Out counterparts. Does nothing for InOut or Linear.";
    InterpolateTooltip = "Smoothens movement using frames. Avoid unless necessary.";
    InfiniteTooltip = "Infinitely moves while activated, regardless of Repeat times.";
    TimesPerSecondTooltip = "The speed of the operation.";
    RepeatTimesTooltip = "How many operations will be done.";
    EasingTooltip = "The type of weight to apply to the animation.";

    EasingDropbox = "Linear, EaseIn, EaseOut, EaseInOut, BackIn, BackOut, BackInOut";

    _StartPosition = Vector3(0,0,0);
    _GoalPosition = Vector3(0,0,0);
    _OriginalPosition = Vector3(0,0,0);

    _Forwards = true;
    _Running = false;
    _TimesPerSecond = 0.0;
    _TickTimer = 0.0;
    _FrameTimer = 0.0;
    _XTime = 0.0;
    _RepeatTimes = 0;
    _ForwardTimes = 0;
    _ReverseTimes = 0;

    function Init()
    {
        self._OriginalPosition = self.MapObject.Position;
        self._StartPosition = self.MapObject.Position;
        self._GoalPosition = self.MapObject.Position + self.TargetPosition;
        self._RepeatTimes = self.RepeatTimes;
        self._TimesPerSecond = self.TimesPerSecond;
    }
    function OnTick()
    {   
        if (!Network.IsMasterClient)
        {
            return;
        }
        if ((self.Infinite || self._RepeatTimes > 0 || self._ForwardTimes > 0 || self._ReverseTimes > 0) && self.Activate && !self._Running)
        {
            self._Running = true;
            if (self._ForwardTimes > 0)
            {
                self._StartPosition = self.MapObject.Position;
                self._GoalPosition = self._StartPosition + self.TargetPosition;
                self._ForwardTimes = self._ForwardTimes - 1;
            }
            elif (self._ReverseTimes > 0)
            {
                self._StartPosition = self.MapObject.Position;
                self._GoalPosition = self._StartPosition - self.TargetPosition;
                self._ReverseTimes = self._ReverseTimes - 1;
            }
            elif (self.Infinite || self._RepeatTimes > 0)
            {
                if (!self.Infinite)
                {
                    self._RepeatTimes = self._RepeatTimes - 1;
                }
                if (self._Forwards)
                {
                    self._Forwards = false;
                    self._StartPosition = self.MapObject.Position;
                    self._GoalPosition = self._StartPosition + self.TargetPosition;
                }
                elif (!self._Forwards && self.Reverse == true)
                {
                    self._Forwards = true;
                    self._StartPosition = self.MapObject.Position;
                    self._GoalPosition = self._StartPosition - self.TargetPosition;
                    if (self.ReverseFlipsCurve)
                    {
                        self.Easing = ReverseEasing(self.Easing);
                    }
                }
                elif (!self._Forwards && self.Reverse == false)
                {
                    self._StartPosition = self.MapObject.Position;
                    self._GoalPosition = self._StartPosition + self.TargetPosition;
                }
            }
        }
        elif (!self.Infinite && self._RepeatTimes == 0 && self._ForwardTimes == 0 && self._ReverseTimes == 0 && !self._Running)
        {
            self.Activate = false;
            self._TimesPerSecond = self.TimesPerSecond;
        }

        if (self._Running && !self.Interpolate && self._TickTimer < (0.99 / self._TimesPerSecond))
        {
            self._TickTimer = self._TickTimer + Time.TickTime;
            XTime = self._TickTimer * self._TimesPerSecond;
            self.Calculate(XTime);
        }
        elif (self._Running && !self.Interpolate)
        {
            self._TickTimer = 0.0;
            self._Running = false;
            self.MapObject.Position = self._GoalPosition;
        }
    }
    function OnFrame()
    {
        if (!Network.IsMasterClient)
        {
            return;
        }
        if (self._Running && self.Interpolate && self._FrameTimer < (0.998 / self._TimesPerSecond))
        {
            self._FrameTimer = self._FrameTimer + Time.FrameTime;
            XTime = self._FrameTimer * self._TimesPerSecond;
            self.Calculate(XTime);
        }
        elif (self._Running && self.Interpolate)
        {
            self._FrameTimer = 0.0;
            self._Running = false;
            self.MapObject.Position = self._GoalPosition;
        }
    }
    function ReverseEasing(Easing)
    {
    if (Easing == "EaseIn")
    {
        Easing = "EaseOut";
    }
    elif (Easing == "EaseOut")
    {
        Easing = "EaseIn";
    }
    elif (Easing == "BackIn")
    {
        Easing = "BackOut";
    }
    elif (Easing == "BackOut")
    {
        Easing = "BackIn";
    }
    return Easing;
    }
    function Calculate(XTime)
    {    
        if (!Network.IsMasterClient)
        {
            return;
        }
        #Easing handling
        c1 = 1.70158;
        c2 = c1 * 1.525;
        c3 = c1 + 1;
        if (self.Easing == "Linear")
        {
            self.MapObject.Position = Vector3.Lerp(self._StartPosition, self._GoalPosition, XTime);
        }
        elif (self.Easing == "EaseIn")
        {
            self.MapObject.Position = Vector3.Lerp(self._StartPosition, self._GoalPosition, Math.Pow(XTime , 3));
        }
        elif (self.Easing == "EaseOut")
        {
            self.MapObject.Position = Vector3.Lerp(self._StartPosition, self._GoalPosition, 1 - Math.Pow(1 - XTime, 3));
        }
        elif (self.Easing == "EaseInOut")
        {
            if (XTime < 0.5)
            {
                XTime = 4 * XTime * XTime * XTime;
            }
            elif (XTime >= 0.5)
            {
                XTime = 1 - Math.Pow(-2 * XTime + 2, 3) / 2;
            }
            self.MapObject.Position = Vector3.Lerp(self._StartPosition, self._GoalPosition, XTime);
        }
        elif (self.Easing == "BackIn")
        {
            XTime = c3 * XTime * XTime * XTime - c1 * XTime * XTime;
            self.MapObject.Position = Vector3.LerpUnclamped(self._StartPosition, self._GoalPosition, XTime);
        }
        elif (self.Easing == "BackOut")
        {
            XTime = 1 + c3 * Math.Pow(XTime - 1, 3) + c1 * Math.Pow(XTime - 1, 2);
            self.MapObject.Position = Vector3.LerpUnclamped(self._StartPosition, self._GoalPosition, XTime);
        }
        elif (self.Easing == "BackInOut")
        {
            if (XTime < 0.5)
            {
                XTime = (Math.Pow(2 * XTime, 2) * ((c2 + 1) * 2 * XTime - c2)) / 2;
            }
            elif (XTime >= 0.5)
            {
                XTime = (Math.Pow(2 * XTime - 2, 2) * ((c2 + 1) * (XTime * 2 - 2) + c2) + 2) / 2;
            }
            self.MapObject.Position = Vector3.LerpUnclamped(self._StartPosition, self._GoalPosition, XTime);
        }
    }
}

SignalSender(信号发送器)

Use in tandem with other compatible Signal components for specific operation and activation. Make sure the component has reverse enabled if needed.

翻译:(与其他兼容的 Signal 组件配合使用,以实现特定的作和激活。如果需要,请确保组件已启用反向功能。)

component SignalSender
{
    ReceiverObjectIDs = "0";
    SignalTrigger = "Any";
    ComponentName = "SignalMover";
    SetEasing = "Original";
    SetXYZ = Vector3(0, 0, 0);
    SetTimesPerSecond = 0.0;
    RepeatTimes = 1;
    SetInfinite = false;
    Uses = 0;
    InfiniteUses = true;
    OnStayTimer = 0.0;
    InteractDistance = 0;
    StopOnConstrains = false;
    ForwardOrReverse = "Both";

    Description = "Use in tandem with other compatible Signal components for specific operation and activation. Make sure the component has reverse enabled if needed.";
    ReceiverObjectIDsTooltip = "ID  for the receiving objects, use space to separate multiple receivers.";
    SignalTriggerTooltip = "How the signal is activated. (OnGetHit only works with cubes and Interact is not included for 'Any')";
    ComponentNameTooltip = "What component to send the signal to";
    SetXYZTooltip = "Only modifies original values if set to anything but (0, 0, 0)"
    SetTimesPerSecondTooltip = "Modify the speed value of target object, is ignored if value is 0";
    UsesTooltip = "How many times this signal can be used";
    StopOnConstrainsTooltip = "Receiver object will stop at start and end position. Use for things like doors.";
    ForwardOrReverseTooltip = "Whether the signal can only make the object go in one direction or both";
    OnStayTimerTooltip = "If OnCollisionStay trigger is selected. Will use the time input before signal is sent.";

    SetEasingDropbox = "Original, Linear, EaseIn, EaseOut, EaseInOut, BackIn, BackOut, BackInOut";
    SignalTriggerDropbox = "Any, OnCollisionEnter, OnCollisionStay, OnCollisionExit, OnGetHit, OnGetHooked, Interact";
    ComponentNameDropbox = "SignalArcMover, SignalMover, SignalRotator, SignalScaler";
    ForwardOrReverseDropbox = "Both, Forward, Reverse";

    _OnStayTimer = 0.0;
    _HumanInRange = null;

    _Receivers = List();
    _Components = List();
    function Init()
    {
        self._OnStayTimer = self.OnStayTimer;
        ReceiverIDs = String.Split(self.ReceiverObjectIDs, " ");
        for (i in Range(0, ReceiverIDs.Count, 1))
        {
            self._Receivers.Add(Map.FindMapObjectByID(Convert.ToInt(ReceiverIDs.Get(i))));
            self._Components.Add(self._Receivers.Get(i).GetComponent(self.ComponentName));
        }
        if (self.SignalTrigger == "OnGetHit" || self.SignalTrigger == "Any")
        {
            self.MapObject.AddBoxCollider("Physical", "Hitboxes", Vector3(0,self.MapObject.Scale.Y * 5, 0), Vector3(self.MapObject.Scale.X * 10,self.MapObject.Scale.Y * 10,self.MapObject.Scale.Z * 10));
        }
        if (self.SignalTrigger == "Interact")
        {
            self.MapObject.AddBoxCollider("Region", "Characters", Vector3(0,self.MapObject.Scale.Y * 5,0), Vector3(self.MapObject.Scale.X * 10 + self.InteractDistance,self.MapObject.Scale.Y * 10 + self.InteractDistance,self.MapObject.Scale.Z * 10 + self.InteractDistance));
        }
    }
    function OnCollisionEnter(other)
    {
        if (self.SignalTrigger == "OnCollisionEnter" || self.SignalTrigger == "Any")
        {
            for (i in Range(0, self._Receivers.Count, 1))
            {
                self.SendSignal(self._Receivers.Get(i), self._Components.Get(i));
            }
        }
    }
    function OnCollisionStay(other)
    {
        if (self.SignalTrigger == "OnCollisionStay" || self.SignalTrigger == "Any")
        {
            if (self._OnStayTimer <= 0.0)
            {
                for (i in Range(0, self._Receivers.Count, 1))
                {
                    self.SendSignal(self._Receivers.Get(i), self._Components.Get(i));
                }
            self._OnStayTimer = self.OnStayTimer;
            }
            else
            {
                self._OnStayTimer = self._OnStayTimer - Time.TickTime;
            }
        }
        if (self.SignalTrigger == "Interact" && other.Type == "Human" && other.IsMine && (self.Uses > 0 || self.InfiniteUses))
        {
            self._HumanInRange = other;
            UI.SetLabelForTime("MiddleCenter", "Press " + Input.GetKeyName("Interaction/Interact") + " to interact", 0.1);
        }
    }
    function OnCollisionExit(other)
    {
        self._OnStayTimer = self.OnStayTimer;
        self._HumanInRange = null;
        if (self.SignalTrigger == "OnCollisionExit" || self.SignalTrigger == "Any")
        {
            for (i in Range(0, self._Receivers.Count, 1))
            {
                self.SendSignal(self._Receivers.Get(i), self._Components.Get(i));
            }
        }
    }
    function OnGetHit(character, name, damage, type)
    {
        if (self.SignalTrigger == "OnGetHit" || self.SignalTrigger == "Any")
        {
            for (i in Range(0, self._Receivers.Count, 1))
            {
                self.SendSignal(self._Receivers.Get(i), self._Components.Get(i));
            }
        }
    }
    function OnGetHooked(Human, HookPos, LeftHook)
    {
        if (self.SignalTrigger == "OnGetHooked" || self.SignalTrigger == "Any")
        {
            for (i in Range(0, self._Receivers.Count, 1))
            {
                self.SendSignal(self._Receivers.Get(i), self._Components.Get(i));
            }
        }
    }
    function OnFrame()
    {
        if (self._HumanInRange != null)
        {
            if (Input.GetKeyDown("Interaction/Interact") && (self.Uses > 0 || self.InfiniteUses))
            {
                for (i in Range(0, self._Receivers.Count, 1))
                {
                    self.SendSignal(self._Receivers.Get(i), self._Components.Get(i));
                }
            }
        }
    }
    function SendSignal(Receiver, Component)
    {
        if ((self.Uses > 0 || self.InfiniteUses) && !Component._Running)
        {
            if (!self.InfiniteUses)
            {
                self.Uses = self.Uses - 1;
            }
            if (self.ComponentName == "SignalArcMover")
            {
                if (self.ForwardOrReverse == "Forward")
                {
                    if (Component.MapObject.Position != (Component._OriginalPosition + Component.TargetPosition) && self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ForwardTimes = self.RepeatTimes;
                    }
                    elif (!self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ForwardTimes = self.RepeatTimes;
                    }
                }
                elif (self.ForwardOrReverse == "Reverse")
                {
                    if (Component.MapObject.Position != Component._OriginalPosition && self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ReverseTimes = self.RepeatTimes;
                    }
                    elif (!self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ReverseTimes = self.RepeatTimes;
                    }
                }
                elif (self.ForwardOrReverse == "Both")
                {
                    Component.Activate = true;
                    Component._RepeatTimes = self.RepeatTimes;
                }
                if (Component.Activate)  
                {
                    if (self.SetXYZ != Vector3(0, 0, 0))
                    {
                        Component.TargetPosition = self.SetXYZ;
                    }
                    if (self.SetEasing != "Original")
                    {
                        Component.Easing = self.SetEasing;
                    }
                    if (self.SetTimesPerSecond != 0.0)
                    {
                        Component._TimesPerSecond = self.SetTimesPerSecond;
                    }
                    Receiver.Active = true;
                }
            }
            if (self.ComponentName == "SignalMover")
            {
                if (self.ForwardOrReverse == "Forward")
                {
                    if (Component.MapObject.Position != (Component._OriginalPosition + Component.TargetPosition) && self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ForwardTimes = self.RepeatTimes;
                    }
                    elif (!self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ForwardTimes = self.RepeatTimes;
                    }
                }
                elif (self.ForwardOrReverse == "Reverse")
                {
                    if (Component.MapObject.Position != Component._OriginalPosition && self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ReverseTimes = self.RepeatTimes;
                    }
                    elif (!self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ReverseTimes = self.RepeatTimes;
                    }
                }
                elif (self.ForwardOrReverse == "Both")
                {
                    Component.Activate = true;
                    Component._RepeatTimes = self.RepeatTimes;
                }
                if (Component.Activate)  
                {
                    if (self.SetXYZ != Vector3(0, 0, 0))
                    {
                        Component.TargetPosition = self.SetXYZ;
                    }
                    if (self.SetEasing != "Original")
                    {
                        Component.Easing = self.SetEasing;
                    }
                    if (self.SetTimesPerSecond != 0.0)
                    {
                        Component._TimesPerSecond = self.SetTimesPerSecond;
                    }
                    Receiver.Active = true;
                }
            }
            elif (self.ComponentName == "SignalRotator")
            {
                if (self.ForwardOrReverse == "Forward")
                {
                    if (Component.MapObject.Rotation != (Component._OriginalRotation + Component.Rotation) && self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ForwardTimes = self.RepeatTimes;
                    }
                    elif (!self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ForwardTimes = self.RepeatTimes;
                    }
                }
                elif (self.ForwardOrReverse == "Reverse")
                {
                    if (Component.MapObject.Rotation != Component._OriginalRotation && self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ReverseTimes = self.RepeatTimes;
                    }
                    elif (!self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ReverseTimes = self.RepeatTimes;
                    }
                }
                elif (self.ForwardOrReverse == "Both")
                {
                    Component.Activate = true;
                    Component._RepeatTimes = self.RepeatTimes;
                }
                if (Component.Activate)  
                {
                    if (self.SetXYZ != Vector3(0, 0, 0))
                    {
                        Component.Rotation = self.SetXYZ;
                    }
                    if (self.SetEasing != "Original")
                    {
                        Component.Easing = self.SetEasing;
                    }
                    if (self.SetTimesPerSecond != 0.0)
                    {
                        Component._TimesPerSecond = self.SetTimesPerSecond;
                    }
                    Receiver.Active = true;
                }   
            }
            elif (self.ComponentName == "SignalScaler")
            {
                if (self.ForwardOrReverse == "Forward")
                {
                    if (Component.MapObject.Scale != Vector3.Multiply(Component._OriginalScale, Component.MultiplyScale) && self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ForwardTimes = self.RepeatTimes;
                    }
                    elif (!self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ForwardTimes = self.RepeatTimes;
                    }
                }
                elif (self.ForwardOrReverse == "Reverse")
                {
                    if (Component.MapObject.Scale != Component._OriginalScale && self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ReverseTimes = self.RepeatTimes;
                    }
                    elif (!self.StopOnConstrains)
                    {
                        Component.Activate = true;
                        Component._ReverseTimes = self.RepeatTimes;
                    }
                }
                elif (self.ForwardOrReverse == "Both")
                {
                    Component.Activate = true;
                    Component._RepeatTimes = self.RepeatTimes;
                }
                if (Component.Activate)  
                {
                    if (self.SetXYZ != Vector3(0, 0, 0))
                    {
                        Component.MultiplyScale = self.SetXYZ;
                    }
                    if (self.SetEasing != "Original")
                    {
                        Component.Easing = self.SetEasing;
                    }
                    if (self.SetTimesPerSecond != 0.0)
                    {
                        Component._TimesPerSecond = self.SetTimesPerSecond;
                    }
                    Receiver.Active = true;
                }
            }
        }
    }  
}

其他

动作/动画/特效/声音

Annie
    public KeybindSetting Kick = new KeybindSetting(new string[] { "LeftControl", "None" });
    public KeybindSetting Jump = new KeybindSetting(new string[] { "Space", "None" });
    public KeybindSetting Walk = new KeybindSetting(new string[] { "LeftAlt", "None" });
    public KeybindSetting AttackCombo = new KeybindSetting(new string[] { "Mouse0", "None" });
    public KeybindSetting AttackSwing = new KeybindSetting(new string[] { "Mouse1", "None" });
    public KeybindSetting AttackStomp = new KeybindSetting(new string[] { "Q", "None" });
    public KeybindSetting AttackBite = new KeybindSetting(new string[] { "E", "None" });
    public KeybindSetting AttackHead = new KeybindSetting(new string[] { "Alpha1", "None" });
    public KeybindSetting AttackBrushBack = new KeybindSetting(new string[] { "Alpha2", "None" });
    public KeybindSetting AttackBrushFront = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackBrushHead = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackGrabBottom = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackGrabMid = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackGrabUp = new KeybindSetting(new string[] { "None", "None" });

Eren
    public KeybindSetting Kick = new KeybindSetting(new string[] { "LeftControl", "None" });
    public KeybindSetting Jump = new KeybindSetting(new string[] { "Space", "None" });
    public KeybindSetting Walk = new KeybindSetting(new string[] { "LeftAlt", "None" });
    public KeybindSetting AttackCombo = new KeybindSetting(new string[] { "Mouse0", "None" });


General
    public KeybindSetting Forward = new KeybindSetting(new string[] { "W", "None" });
    public KeybindSetting Back = new KeybindSetting(new string[] { "S", "None" });
    public KeybindSetting Left = new KeybindSetting(new string[] { "A", "None" });
    public KeybindSetting Right = new KeybindSetting(new string[] { "D", "None" });
    public KeybindSetting Up = new KeybindSetting(new string[] { "E", "None" });
    public KeybindSetting Down = new KeybindSetting(new string[] { "Q", "None" });
    public KeybindSetting Modifier = new KeybindSetting(new string[] { "LeftShift", "None" });
    public KeybindSetting Autorun = new KeybindSetting(new string[] { "Period", "None" });
    public KeybindSetting Pause = new KeybindSetting(new string[] { "P", "None" });
    public KeybindSetting ChangeCharacter = new KeybindSetting(new string[] { "T", "None" });
    public KeybindSetting RestartGame = new KeybindSetting(new string[] { "F5", "None" });
    public KeybindSetting ToggleScoreboard = new KeybindSetting(new string[] { "Tab", "None" });
    public KeybindSetting ToggleMap = new KeybindSetting(new string[] { "M", "None" });
    public KeybindSetting Chat = new KeybindSetting(new string[] { "Return", "None" });
    public KeybindSetting PushToTalk = new KeybindSetting(new string[] { "V", "None" });
    public KeybindSetting ChangeCamera = new KeybindSetting(new string[] { "C", "None" });
    public KeybindSetting HideCursor = new KeybindSetting(new string[] { "X", "None" });
    //public KeybindSetting MinimapMaximize = new KeybindSetting(new string[] { "M", "None" });
    public KeybindSetting SpectatePreviousPlayer = new KeybindSetting(new string[] { "1", "None" });
    public KeybindSetting SpectateNextPlayer = new KeybindSetting(new string[] { "2", "None" });
    public KeybindSetting SkipCutscene = new KeybindSetting(new string[] { "Y", "None" });
    public BoolSetting TapScoreboard = new BoolSetting(true);
    public BoolSetting TapMap = new BoolSetting(true);
    public KeybindSetting HideUI = new KeybindSetting(new string[] { "F6", "None" });

Human
    public KeybindSetting AttackDefault = new KeybindSetting(new string[] { "Mouse0", "None" });
    public KeybindSetting AttackSpecial = new KeybindSetting(new string[] { "Mouse1", "None" });
    public KeybindSetting HookLeft = new KeybindSetting(new string[] { "Q", "None" });
    public KeybindSetting HookRight = new KeybindSetting(new string[] { "E", "None" });
    public KeybindSetting HookBoth = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting Dash = new KeybindSetting(new string[] { "LeftControl", "None" });
    public KeybindSetting ReelIn = new KeybindSetting(new string[] { "WheelDown", "None" });
    public KeybindSetting ReelOut = new KeybindSetting(new string[] { "LeftAlt", "None" });
    public KeybindSetting Dodge = new KeybindSetting(new string[] { "LeftControl", "None" });
    public KeybindSetting Jump = new KeybindSetting(new string[] { "LeftShift", "None" });
    public KeybindSetting Reload = new KeybindSetting(new string[] { "R", "None" });
    public KeybindSetting HorseMount = new KeybindSetting(new string[] { "LeftControl", "None" });
    public KeybindSetting HorseWalk = new KeybindSetting(new string[] { "LeftShift", "None" });
    public KeybindSetting HorseJump = new KeybindSetting(new string[] { "Space", "None" });
    public KeybindSetting NapeLock = new KeybindSetting(new string[] { "None", "None" });
  

Interaction
    public KeybindSetting Interact = new KeybindSetting(new string[] { "G", "None" });
    public KeybindSetting Interact2 = new KeybindSetting(new string[] { "H", "None" });
    public KeybindSetting Interact3 = new KeybindSetting(new string[] { "J", "None" });
    public KeybindSetting ItemMenu = new KeybindSetting(new string[] { "F", "None" });
    public KeybindSetting EmoteMenu = new KeybindSetting(new string[] { "N", "None" });
    public KeybindSetting MenuNext = new KeybindSetting(new string[] { "Space", "None" });
    public KeybindSetting QuickSelect1 = new KeybindSetting(new string[] { "Alpha1", "None" });
    public KeybindSetting QuickSelect2 = new KeybindSetting(new string[] { "Alpha2", "None" });
    public KeybindSetting QuickSelect3 = new KeybindSetting(new string[] { "Alpha3", "None" });
    public KeybindSetting QuickSelect4 = new KeybindSetting(new string[] { "Alpha4", "None" });
    public KeybindSetting QuickSelect5 = new KeybindSetting(new string[] { "Alpha5", "None" });
    public KeybindSetting QuickSelect6 = new KeybindSetting(new string[] { "Alpha6", "None" });
    public KeybindSetting QuickSelect7 = new KeybindSetting(new string[] { "Alpha7", "None" });
    public KeybindSetting QuickSelect8 = new KeybindSetting(new string[] { "Alpha8", "None" });
    public KeybindSetting Function1 = new KeybindSetting(new string[] { "F1", "None" });
    public KeybindSetting Function2 = new KeybindSetting(new string[] { "F2", "None" });
    public KeybindSetting Function3 = new KeybindSetting(new string[] { "F3", "None" });
    public KeybindSetting Function4 = new KeybindSetting(new string[] { "F4", "None" });

Titan
    public KeybindSetting Kick = new KeybindSetting(new string[] { "LeftControl", "None" });
    public KeybindSetting Jump = new KeybindSetting(new string[] { "Space", "None" });
    public KeybindSetting Sit = new KeybindSetting(new string[] { "Z", "None" });
    public KeybindSetting Walk = new KeybindSetting(new string[] { "LeftAlt", "None" });
    public KeybindSetting Sprint = new KeybindSetting(new string[] { "LeftShift", "None" });
    public KeybindSetting CoverNape1 = new KeybindSetting(new string[] { "Mouse2", "None" });
    public KeybindSetting AttackPunch = new KeybindSetting(new string[] { "Mouse0", "None" });
    public KeybindSetting AttackBellyFlop = new KeybindSetting(new string[] { "Mouse1", "None" });
    public KeybindSetting AttackSlapL = new KeybindSetting(new string[] { "Q", "None" });
    public KeybindSetting AttackSlapR = new KeybindSetting(new string[] { "E", "None" });
    public KeybindSetting AttackRockThrow = new KeybindSetting(new string[] { "R", "None" });
    public KeybindSetting AttackBiteL = new KeybindSetting(new string[] { "Alpha1", "None" });
    public KeybindSetting AttackBiteF = new KeybindSetting(new string[] { "Alpha2", "None" });
    public KeybindSetting AttackBiteR = new KeybindSetting(new string[] { "Alpha3", "None" });
    public KeybindSetting AttackHitFace = new KeybindSetting(new string[] { "Alpha4", "None" });
    public KeybindSetting AttackHitBack = new KeybindSetting(new string[] { "Alpha5", "None" });
    public KeybindSetting AttackSlam = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackStomp = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackSwing = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackGrabAirFar = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackGrabAir = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackGrabBody = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackGrabCore = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackGrabGround = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackGrabHead = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackGrabHigh = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackSlapHighL = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackSlapHighR = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackSlapLowL = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackSlapLowR = new KeybindSetting(new string[] { "None", "None" });
    public KeybindSetting AttackBrushChest = new KeybindSetting(new string[] { "None", "None" });


Effects 特效
    public static string ThunderspearExplode = "ThunderspearExplodeEffect";
    public static string GasBurst = "GasBurstEffect";
    public static string GroundShatter = "GroundShatterEffect";
    public static string Blood1 = "Blood1Effect";
    public static string Blood2 = "Blood2Effect";
    public static string PunchHit = "PunchHitEffect";
    public static string GunExplode = "GunExplodeEffect";
    public static string CriticalHit = "CriticalHitEffect";
    public static string TitanSpawn = "TitanSpawnEffect";
    public static string TitanDie1 = "TitanDie1Effect";
    public static string TitanDie2 = "TitanDie2Effect";
    public static string Boom1 = "Boom1Effect";
    public static string Boom2 = "Boom2Effect";
    public static string Boom3 = "Boom3Effect";
    public static string Boom4 = "Boom4Effect";
    public static string Boom5 = "Boom5Effect";
    public static string Boom6 = "Boom6Effect";
    public static string Boom7 = "Boom7Effect";
    public static string Splash = "SplashEffect";
    public static string TitanBite = "BiteEffect";
    public static string ShifterThunder = "ShifterThunderEffect";
    public static string BladeThrowHit = "BladeThrowHitEffect";
    public static string APGTrail = "APGTrailEffect";
    public static string SingleSplash = "SplashEffect";
    public static string Splash1 = "Splash1Effect";
    public static string Splash2 = "Splash2Effect";
    public static string Splash3 = "Splash3Effect";
    public static string WaterWake = "WaterWakeEffect";



PlayAnimation播放动画
Human
namespace Characters
{
    class HumanAnimations
    {
        public static string HorseMount = "Armature|horse_geton";
        public static string HorseDismount = "Armature|horse_getoff";
        public static string HorseIdle = "Armature|horse_idle";
        public static string HorseRun = "Armature|horse_run";
        public static string IdleF = "Armature|idle_F";
        public static string IdleM = "Armature|idle_M";
        public static string IdleAHSSM = "Armature|idle_AHSS_F";
        public static string IdleAHSSF = "Armature|idle_AHSS_M";
        public static string IdleTSF = "Armature|idle_TS_F";
        public static string IdleTSM = "Armature|idle_TS_M";
        public static string Jump = "Armature|jump";
        public static string Run = "Armature|run";
        public static string RunTS = "Armature|run_TS";
        public static string RunBuffed = "Armature|run_sasha";
        public static string Dodge = "Armature|dodge";
        public static string Land = "Armature|dash_land";
        public static string Slide = "Armature|slide";
        public static string Grabbed = "Armature|grabbed";
        public static string Dash = "Armature|dash";
        public static string Refill = "Armature|resupply";
        public static string ToRoof = "Armature|toRoof";
        public static string WallRun = "Armature|wallrun";
        public static string OnWall = "Armature|onWall";
        public static string ChangeBlade = "Armature|changeBlade";
        public static string ChangeBladeAir = "Armature|changeBlade_air";
        public static string AHSSHookForwardBoth = "Armature|AHSS_hook_both";
        public static string AHSSHookForwardL = "Armature|AHSS_hook_L";
        public static string AHSSHookForwardR = "Armature|AHSS_hook_R";
        public static string AHSSShootR = "Armature|AHSS_shoot_R";
        public static string AHSSShootL = "Armature|AHSS_shoot_L";
        public static string AHSSShootBoth = "Armature|AHSS_shooth_both";
        public static string AHSSShootRAir = "Armature|AHSS_shoot_air_R";
        public static string AHSSShootLAir = "Armature|AHSS_shoot_air_L";
        public static string AHSSShootBothAir = "Armature|AHSS_shooth_air_both";
        public static string AHSSGunReloadBoth = "Armature|AHSS_reload_both";
        public static string AHSSGunReloadBothAir = "Armature|AHSS_reload_air_both";
        public static string TSShootR = "Armature|TS_shoot_R";
        public static string TSShootL = "Armature|TS_shoot_L";
        public static string TSShootRAir = "Armature|TS_shoot_air_R";
        public static string TSShootLAir = "Armature|TS_shoot_air_L";
        public static string AirHookLJust = "Armature|air_hook_l_just";
        public static string AirHookRJust = "Armature|air_hook_r_just";
        public static string AirHookL = "Armature|air_hook_l";
        public static string AirHookR = "Armature|air_hook_r";
        public static string AirHook = "Armature|air_hook";
        public static string AirRelease = "Armature|air_release";
        public static string AirFall = "Armature|air_fall";
        public static string AirRise = "Armature|air_rise";
        public static string Air2 = "Armature|air2";
        public static string Air2Right = "Armature|air2_right";
        public static string Air2Left = "Armature|air2_left";
        public static string Air2Backward = "Armature|air2_backward";
        public static string Attack1HookL1 = "Armature|attack1_hook_l1";
        public static string Attack1HookL2 = "Armature|attack1_hook_l2";
        public static string Attack1HookR1 = "Armature|attack1_hook_r1";
        public static string Attack1HookR2 = "Armature|attack1_hook_r2";
        public static string Attack1 = "Armature|attack1";
        public static string Attack2 = "Armature|attack2";
        public static string Attack4 = "Armature|attack4";
        public static string SpecialArmin = "Armature|special_armin";
        public static string SpecialMarco0 = "Armature|special_marco_0";
        public static string SpecialMarco1 = "Armature|special_marco_1";
        public static string SpecialSasha = "Armature|special_sasha";
        public static string SpecialMikasa1 = "Armature|attack_3_1";
        public static string SpecialMikasa2 = "Armature|attack_3_2";
        public static string SpecialLevi = "Armature|special_levi";
        public static string SpecialPetra = "Armature|special_petra";
        public static string SpecialJean = "Armature|grabbed_jean";
        public static string SpecialShifter = "Armature|special_shift_0";
        public static string EmoteSalute = "Armature|emote_salute";
        public static string EmoteNo = "Armature|emote_no";
        public static string EmoteYes = "Armature|emote_yes";
        public static string EmoteWave = "Armature|emote_wave";
    }
}


Titan
namespace Characters
{
    class BasicTitanAnimations: BaseTitanAnimations
    {
        public override string Idle => "Amarture_VER2|idle";
        public string[] Runs = new string[] {"Amarture_VER2|run.abnormal", "Amarture_VER2|run.abnormal.1" };
        public override string Sprint => "Amarture_VER2|run.abnormal.1";
        public string RunCrawler = "Amarture_VER2|crawler.run";
        public string IdleCrawler = "Amarture_VER2|crawler.idle";
        public string JumpCrawler = "Amarture_VER2|attack.crawler.jump.0";
        public string FallCrawler = "Amarture_VER2|attack.crawler.jump.1";
        public string LandCrawler = "Amarture_VER2|attack.crawler.jump.2";
        public override string Walk => "Amarture_VER2|run.walk";
        public override string Jump => "Amarture_VER2|attack.jumper.0";
        public override string Fall => "Amarture_VER2|attack.jumper.1";
        public override string Land => "Amarture_VER2|attack.jumper.2";
        public override string Stun => "Amarture_VER2|hit.eren.L";
        public string StunLeft = "Amarture_VER2|hit.eren.L";
        public string StunRight = "Amarture_VER2|hit.eren.R";
        public string DieBack = "Amarture_VER2|die.back";
        public string DieFront = "Amarture_VER2|die.front";
        public string DieGround = "Amarture_VER2|die.ground";
        public string DieCrawler = "Amarture_VER2|crawler.die";
        public override string DieSit => "Amarture_VER2|sit_die";
        public string AttackPunchCombo = "Amarture_VER2|attack.combo";
        public string AttackPunch = "Amarture_VER2|attack.comboPunch";
        public string AttackSlam = "Amarture_VER2|attack.front.ground";
        public string AttackBellyFlop = "Amarture_VER2|attack.abnormal.jump";
        public string AttackBellyFlopGetup = "Amarture_VER2|attack.abnormal.getup";
        public string AttackKick = "Amarture_VER2|attack.kick";
        public string AttackStomp = "Amarture_VER2|attack.stomp";
        public string AttackSwingL = "Amarture_VER2|attack.swing.l";
        public string AttackSwingR = "Amarture_VER2|attack.swing.r";
        public string AttackBiteF = "Amarture_VER2|bite";
        public string AttackBiteL = "Amarture_VER2|bite.l";
        public string AttackBiteR = "Amarture_VER2|bite.r";
        public string AttackGrabAirFarL = "Amarture_VER2|grab.air.far.l";
        public string AttackGrabAirFarR = "Amarture_VER2|grab.air.far.r";
        public string AttackGrabAirL = "Amarture_VER2|grab.air.short.l";
        public string AttackGrabAirR = "Amarture_VER2|grab.air.short.r";
        public string AttackGrabBackL = "Amarture_VER2|grab.back.l";
        public string AttackGrabBackR = "Amarture_VER2|grab.back.r";
        public string AttackGrabCoreL = "Amarture_VER2|grab.core.L";
        public string AttackGrabCoreR = "Amarture_VER2|grab.core.R";
        public string AttackGrabGroundBackL = "Amarture_VER2|grab.ground.back.l";
        public string AttackGrabGroundBackR = "Amarture_VER2|grab.ground.back.r";
        public string AttackGrabGroundFrontL = "Amarture_VER2|grab.ground.front.l";
        public string AttackGrabGroundFrontR = "Amarture_VER2|grab.ground.front.r";
        public string AttackGrabHeadBackL = "Amarture_VER2|grab.head.back.l";
        public string AttackGrabHeadBackR = "Amarture_VER2|grab.head.back.r";
        public string AttackGrabHeadFrontL = "Amarture_VER2|grab.head.front.1";
        public string AttackGrabHeadFrontR = "Amarture_VER2|grab.head.front.r";
        public string AttackGrabHighL = "Amarture_VER2|grab.high.l";
        public string AttackGrabHighR = "Amarture_VER2|grab.high.r";
        public string AttackGrabStomachL = "Amarture_VER2|grab.stomach.l";
        public string AttackGrabStomachR = "Amarture_VER2|grab.stomach.r";
        public string AttackEatL = "Amarture_VER2|eat.l";
        public string AttackEatR = "Amarture_VER2|eat.r";
        public string AttackSlapHighL = "Amarture_VER2|attack.anti.AE.high.l";
        public string AttackSlapHighR = "Amarture_VER2|attack.anti.AE.high.r";
        public string AttackSlapL = "Amarture_VER2|attack.anti.AE.l";
        public string AttackSlapR = "Amarture_VER2|attack.anti.AE.r";
        public string AttackSlapLowL = "Amarture_VER2|attack.anti.AE.low.l";
        public string AttackSlapLowR = "Amarture_VER2|attack.anti.AE.low.r";
        public string AttackBrushChestL = "Amarture_VER2|attack.chest.L";
        public string AttackBrushChestR = "Amarture_VER2|attack.chest.R";
        public string AttackHitBack = "Amarture_VER2|attack.slap.back";
        public string AttackHitFace = "Amarture_VER2|attack.slap.face";
        public string AttackRockThrow = "Amarture_VER2|attack.throw";
        public string AttackJump = "Amarture_VER2|attack.jumper.0";
        public string AttackJumpCrawler = "Amarture_VER2|attack.crawler.jump.0";
        public override string SitIdle => "Amarture_VER2|sit_idle";
        public string SitIdleCrawler = "Amarture_VER2|crawler.sit.idle";
        public override string SitDown => "Amarture_VER2|sit_down";
        public override string SitUp => "Amarture_VER2|sit_getup";
        public string SitUpCrawler = "Amarture_VER2|crawler.getup";
        public override string SitFall => "Amarture_VER2|sit_hunt_down";
        public string SitFallCrawler = "Amarture_VER2|crawler.hunt.down";
        public override string Turn90L => "Amarture_VER2|turnaround.L";
        public override string Turn90R => "Amarture_VER2|turnaround.R";
        public string Turn90LCrawler = "Amarture_VER2|crawler.turnaround.L";
        public string Turn90RCrawler = "Amarture_VER2|crawler.turnaround.R";
        public override string Blind => "Amarture_VER2|hit.eye";
        public override string SitBlind => "Amarture_VER2|sit_hit_eye";
        public string BlindCrawler = "Amarture_VER2|crawler.hiteyes";
        public string ArmHurtL = "Amarture_VER2|arm_hurt_L";
        public string ArmHurtR = "Amarture_VER2|arm_hurt_R";
        public string CoverNape = "Amarture_VER2|idle.recovery";
        public string EmoteLaugh = "Amarture_VER2|laugh";
        public string EmoteNod = "Amarture_VER2|emote_titan_yes";
        public string EmoteShake = "Amarture_VER2|emote_titan_no";
        public string EmoteRoar = "Amarture_VER2|attack.scream";
    }
}

Annie
namespace Characters
{
    class AnnieAnimations: BaseTitanAnimations
    {
        public override string Idle => "Armature_FemT|ft_idle";
        public override string Run => "Armature_FemT|ft_run";
        public override string Walk => "Armature_FemT|ft_walk";
        public override string Jump => "Armature_FemT|ft_jump_start";
        public override string Fall => "Armature_FemT|ft_jump_air";
        public override string Land => "Armature_FemT|ft_jump_land";
        public override string Die => "Armature_FemT|ft_die_shifter";
        public override string Stun => "Armature_FemT|ft_hit_titan";
        public override string SitFall => "Armature_FemT|ft_legHurt";
        public override string SitIdle => "Armature_FemT|ft_legHurt_loop";
        public override string SitUp => "Armature_FemT|ft_legHurt_getup";
        public string AttackCombo = "Armature_FemT|ft_attack_combo_full";
        public string AttackComboBlind = "Armature_FemT|ft_attack_combo_blind_full";
        public string AttackSwing = "Armature_FemT|ft_attack_front";
        public string AttackBrushBack = "Armature_FemT|ft_attack_sweep_back";
        public string AttackBrushFrontL = "Armature_FemT|ft_attack_sweep_front_left";
        public string AttackBrushFrontR = "Armature_FemT|ft_attack_sweep_front_right";
        public string AttackBrushHeadL = "Armature_FemT|ft_attack_sweep_head_b_l";
        public string AttackBrushHeadR = "Armature_FemT|ft_attack_sweep_head_b_r";
        public string AttackGrabBottomLeft = "Armature_FemT|ft_attack_grab_bottom_left";
        public string AttackGrabBottomRight = "Armature_FemT|ft_attack_grab_bottom_right";
        public string AttackGrabMidLeft = "Armature_FemT|ft_attack_grab_mid_left";
        public string AttackGrabMidRight = "Armature_FemT|ft_attack_grab_mid_right";
        public string AttackGrabUp = "Armature_FemT|ft_attack_grab_up";
        public string AttackGrabUpLeft = "Armature_FemT|ft_attack_grab_up_left";
        public string AttackGrabUpRight = "Armature_FemT|ft_attack_grab_up_right";
        public string AttackKick = "Armature_FemT|ft_attack_sweep";
        public string AttackStomp = "Armature_FemT|ft_attack_core";
        public string AttackHead = "Armature_FemT|ft_attack_head";
        public string AttackBite = "Armature_FemT|ft_attack_bite";
        public string EmoteSalute = "Armature_FemT|ft_emote_salute";
        public string EmoteTaunt = "Armature_FemT|ft_emote_taunt";
        public string EmoteWave = "Armature_FemT|ft_emote_wave";
        public string EmoteRoar = "Armature_FemT|ft_mad1";
    }
}

Eren
namespace Characters
{
    class ErenAnimations: BaseTitanAnimations
    {
        public override string Idle => "ErenRig_VER2|et_idle";
        public override string Run => "ErenRig_VER2|et_run";
        public override string Walk => "ErenRig_VER2|et_walk";
        public override string Jump => "ErenRig_VER2|et_jump_start";
        public override string Fall => "ErenRig_VER2|et_jump_air";
        public override string Land => "ErenRig_VER2|et_jump_land";
        public override string Die => "ErenRig_VER2|et_die";
        public string AttackCombo = "ErenRig_VER2|et_attack_combo_full";
        public string AttackKick = "ErenRig_VER2|et_attack_kick";
        public override string Stun => "ErenRig_VER2|et_hit_titan";
        public string EmoteNod = "ErenRig_VER2|et_yes";
        public string EmoteRoar = "ErenRig_VER2|et_born";
    }
}


PlaySound播放声音
Human
namespace Characters
{
    class HumanSounds
    {
        public static string BladeBreak = "BladeBreak";
        public static string BladeHit = "BladeHit";
        public static string OldBladeHit = "OldBladeHit";
        public static string NapeHit = "NapeHit";
        public static string LimbHit = "LimbHit";
        public static string OldNapeHit = "OldNapeHit";
        public static string BladeReloadAir = "BladeReloadAir";
        public static string BladeReloadGround = "BladeReloadGround";
        public static string GunReload = "GunReload";
        public static string BladeSwing1 = "BladeSwing1";
        public static string BladeSwing2 = "BladeSwing2";
        public static string BladeSwing3 = "BladeSwing3";
        public static string BladeSwing4 = "BladeSwing4";
        public static string OldBladeSwing = "OldBladeSwing";
        public static string Dodge = "Dodge";
        public static string FlareLaunch = "FlareLaunch";
        public static string ThunderspearLaunch = "ThunderspearLaunch";
        public static string GasBurst = "GasBurst";
        public static string HookLaunch = "HookLaunch";
        public static string OldHookLaunch = "OldHookLaunch";
        public static string HookRetractLeft = "HookRetractLeft";
        public static string HookRetractRight = "HookRetractRight";
        public static string HookImpact = "HookImpact";
        public static string HookImpactLoud = "HookImpactLoud";
        public static string GasStart = "GasStart";
        public static string GasLoop = "GasLoop";
        public static string GasEnd = "GasEnd";
        public static string ReelIn = "ReelIn";
        public static string ReelOut = "ReelOut";
        public static string CrashLand = "CrashLand";
        public static string Jump = "Jump";
        public static string Land = "Land";
        public static string NoGas = "NoGas";
        public static string Refill = "Refill";
        public static string Slide = "Slide";
        public static string Footstep1 = "Footstep1";
        public static string Footstep2 = "Footstep2";
        public static string Death1 = "Death1";
        public static string Death2 = "Death2";
        public static string Death3 = "Death3";
        public static string Death4 = "Death4";
        public static string Death5 = "Death5";
        public static string Checkpoint = "Checkpoint";
        public static string GunExplode = "GunExplode";
        public static string GunExplodeLoud = "GunExplodeLoud";
        public static string WaterSplash = "WaterSplash";
        public static string Switchback = "Switchback";
        public static string APGShot1 = "APGShot1";
        public static string APGShot2 = "APGShot2";
        public static string APGShot3 = "APGShot3";
        public static string APGShot4 = "APGShot4";
        public static string BladeNape1Var1 = "BladeNape1Var1";
        public static string BladeNape1Var2 = "BladeNape1Var2";
        public static string BladeNape1Var3 = "BladeNape1Var3";
        public static string BladeNape2Var1 = "BladeNape2Var1";
        public static string BladeNape2Var2 = "BladeNape2Var2";
        public static string BladeNape2Var3 = "BladeNape2Var3";
        public static string BladeNape3Var1 = "BladeNape3Var1";
        public static string BladeNape3Var2 = "BladeNape3Var2";
        public static string BladeNape3Var3 = "BladeNape3Var3";
        public static string BladeNape4Var1 = "BladeNape4Var1";
        public static string BladeNape4Var2 = "BladeNape4Var2";
        public static string BladeNape4Var3 = "BladeNape4Var3";
        public static string AHSSGunShot1 = "AHSSGunShot1";
        public static string AHSSGunShot2 = "AHSSGunShot2";
        public static string AHSSGunShot3 = "AHSSGunShot3";
        public static string AHSSGunShot4 = "AHSSGunShot4";
        public static string AHSSGunShotDouble1 = "AHSSGunShotDouble1";
        public static string AHSSGunShotDouble2 = "AHSSGunShotDouble2";
        public static string AHSSNape1Var1 = "AHSSNape1Var1";
        public static string AHSSNape1Var2 = "AHSSNape1Var2";
        public static string AHSSNape2Var1 = "AHSSNape2Var1";
        public static string AHSSNape2Var2 = "AHSSNape2Var2";
        public static string AHSSNape3Var1 = "AHSSNape3Var1";
        public static string AHSSNape3Var2 = "AHSSNape3Var2";
        public static string TSLaunch1 = "TSLaunch1";
        public static string TSLaunch2 = "TSLaunch2";


        public static string GetRandom(params string[] sounds)
        {
            return sounds[UnityEngine.Random.Range(0, sounds.Length)];
        }

        public static string GetRandomTSLaunch()
        {
            return GetRandom(TSLaunch1, TSLaunch2);
        }

        public static string GetRandomAPGShot()
        {
            return GetRandom(APGShot1, APGShot2, APGShot3, APGShot4);
        }

        public static string GetRandomAHSSNapeHitVar1()
        {
            return GetRandom(AHSSNape1Var1, AHSSNape2Var1, AHSSNape3Var1);
        }

        public static string GetRandomAHSSNapeHitVar2()
        {
            return GetRandom(AHSSNape1Var2, AHSSNape2Var2, AHSSNape3Var2);
        }

        public static string GetRandomBladeNapeVar1()
        {
            return GetRandom(BladeNape1Var1, BladeNape1Var2, BladeNape1Var3);
        }

        public static string GetRandomBladeNapeVar2()
        {
            return GetRandom(BladeNape2Var1, BladeNape2Var2, BladeNape2Var3);
        }

        public static string GetRandomBladeNapeVar3()
        {
            return GetRandom(BladeNape3Var1, BladeNape3Var2, BladeNape3Var3);
        }

        public static string GetRandomBladeNapeVar4()
        {
            return GetRandom(BladeNape4Var1, BladeNape4Var2, BladeNape4Var3);
        }

        public static string GetRandomAHSSGunShot()
        {
            return GetRandom(AHSSGunShot1, AHSSGunShot2, AHSSGunShot3, AHSSGunShot4);
        }

        public static string GetRandomAHSSGunShotDouble()
        {
            return GetRandom(AHSSGunShotDouble1, AHSSGunShotDouble2);
        }
    }
}

Shifter
namespace Characters
{
    class ShifterSounds
    {
        public static string Thunder = "Thunder";
        public static string ErenRoar = "ErenRoar";
        public static string AnnieRoar = "AnnieRoar";
        public static string AnnieHurt = "AnnieHurt";
    }
}


Titan
namespace Characters
{
    class TitanSounds
    {
        public static string Footstep1 = "Footstep1";
        public static string Footstep2 = "Footstep2";
        public static string Footstep3 = "Footstep3";
        public static string Swing1 = "Swing1";
        public static string Swing2 = "Swing2";
        public static string Swing3 = "Swing3";
        public static string Hurt1 = "Hurt1";
        public static string Hurt2 = "Hurt2";
        public static string Hurt3 = "Hurt3";
        public static string Hurt4 = "Hurt4";
        public static string Hurt5 = "Hurt5";
        public static string Hurt6 = "Hurt6";
        public static string Hurt7 = "Hurt7";
        public static string Hurt8 = "Hurt8";
        public static string Grunt1 = "Grunt1";
        public static string Grunt2 = "Grunt2";
        public static string Grunt3 = "Grunt3";
        public static string Grunt4 = "Grunt4";
        public static string Grunt5 = "Grunt5";
        public static string Grunt6 = "Grunt6";
        public static string Grunt7 = "Grunt7";
        public static string Grunt8 = "Grunt8";
        public static string Grunt9 = "Grunt9";
        public static string Grunt10 = "Grunt10";
        public static string Hit = "Hit";
        public static string Roar = "Roar";
        public static string Fall = "Fall";
        public static string Bite1 = "Bite1";
        public static string Bite2 = "Bite2";
        public static string Laugh1 = "Laugh1";
        public static string Laugh2 = "Laugh2";

        private static string[] Footsteps = new string[] { Footstep1, Footstep2, Footstep3 };

        public static string GetRandom(params string[] sounds)
        {
            return sounds[UnityEngine.Random.Range(0, sounds.Length)];
        }

        public static string GetRandomFromList(string[] sounds)
        {
            return sounds[UnityEngine.Random.Range(0, sounds.Length)];
        }

        public static string GetRandomFootstep()
        {
            return GetRandomFromList(Footsteps);
        }

        public static string GetRandomHurt()
        {
            return GetRandom(Hurt1, Hurt2, Hurt3, Hurt4, Hurt5, Hurt6, Hurt7, Hurt8);
        }

        public static string GetRandomGrabGrunt()
        {
            return GetRandom(Grunt1, Grunt2, Grunt3, Grunt4, Grunt5, Grunt6, Grunt7, Grunt8, Grunt9, Grunt10);
        }

        public static string GetRandomLaugh()
        {
            return GetRandom(Laugh1, Laugh2);
        }

        public static string GetRandomBite()
        {
            return GetRandom(Bite1, Bite2);
        }
    }
}

END

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值