usingGodot;usingliu102401.Utils;usingNewtonsoft.Json;usingNewtonsoft.Json.Linq;usingNUnit.Framework;usingNUnit.Framework.Interfaces;usingNUnit.Framework.Internal;usingPeaky.Coroutines;usingSystem;usingSystem.Collections;usingSystem.Collections.Generic;usingSystem.IO;usingSystem.Linq;usingSystem.Reflection;usingSy...
state_machine_manager._process(delta) func _physics_process(delta: float) -> void: state_machine_manager._physics_process(delta) func _input(event: InputEvent) -> void: state_machine_manager._input(event) func on_option(o:StringName): match o: &"title": state_machine_manager.switch_to(...
remotesync func _addItem(id : int, data : String) -> void: var power : Node = load(data).instance() power.set_network_master(id) self.add_child(power) 比较修改前后的代码,后面的代码是能正常运行的。而修改前的代码中,远程传递的是ItemData复杂数据类型,改成String后解决了这个问题。至于是不是...
iftypeof("HAHA") == TYPE_STRING :pass 类型转换 基本类型的转换同,使用目标类型(原始数据)的方式进行转换: int("666") float("123.123") String 不是基本类型,需要使用str(原始数据)进行转换: str(111) Godot 中的非 String 数据在字符串拼接的时候不能自动转换成 String。 错误:"你有钱:" + 0 正确...
PackedByteArray、PackedInt32Array、PackedInt64Array、PackedFloatArray、PackedDoubleArray:标量压缩数组。 PackedVector2Array、PackedVector3Array、PackedColorarray:向量压缩数组。 PackedStringArray:字符串压缩数组。 这是否意味着你在 Godot 中所做的任何事情都必须使用这些数据类型?绝对不是。
void _process(delta: float) virtual 在主循环的处理步骤中被调用。处理发生在每一帧,并且尽可能快,所以从上一帧开始的 delta 时间不是恒定的。delta 的单位是秒。 只有在启用处理的情况下才会被调用,如果这个方法被重写,会自动进行处理,可以用 set_process() 来切换。
%f:用于浮点数(Float),可以表示小数点的数字。 %.2f:这是一种特殊形式的浮点数占位符,.2表示小数点后保留两位数字。 %x或%X:用于十六进制数,%x输出小写字母,%X输出大写字母。 %o:用于八进制数。 %%:用于输出百分号本身,因为%是一个特殊字符,所以需要用两个%来表示。
StringName(Unique Names):&"name" NodePath(路径):^"Node/Label" 两个看起来像字面量,但其实只是一种语法糖: $NodePath: 等同于get_node("NodePath") %UniqueNode:等同于get_node("%UniqueNode") 整数浮点数可以用下划线_进行一种修饰: 12_345_678# Equal to 12345678.3.141_592_7# Equal to 3.141592...
// 在 Godot 中同等效果的射线检测boolGetRaycastDistanceAndNormal(Vector2origin,Vector2direction,outfloatdistance,outVector2normal){World2Dworld=GetWorld2D();PhysicsDirectSpaceState2DspaceState=world.DirectSpaceState;PhysicsRayQueryParameters2DqueryParams=PhysicsRayQueryParameters2D.Create(origin,origin+direction)...
// 在 Godot 中同等效果的射线检测boolGetRaycastDistanceAndNormal(Vector2origin,Vector2direction,outfloatdistance,outVector2normal){World2Dworld=GetWorld2D();PhysicsDirectSpaceState2DspaceState=world.DirectSpaceState;PhysicsRayQueryParameters2DqueryParams=PhysicsRayQueryParameters2D.Create(origin,origin+direction)...