玩家初始化 Player Initialization

  • Class :StarterPlayers

服务对象 Service Object
此对象为服务对象,可以使用GetService()函数获取此服务。Use GetService() to utilize this service.

不可创建 Cannot create
无法使用RWObject:New(Classname)创建此对象,也不在编辑器对象列表中显示。Cannot use RWObject:New(Classname) to create this object. It will not display in editor object list either.

不可删除 Cannot destroy
不能用Destroy()函数删除此对象。Cannot use Destroy() to destroy this object.

不可复制。Cannot duplicate
不能用Clone()函数复制此对象。Cannot use Clone() to duplicate this object.

Introduction

玩家进入游戏时初始化玩家初始属性、生成的角色摄像机数据、玩家或角色相关脚本都在此服务下配置。
Initialize player properties, create Avatar, Camera and any player or role related scripts when players enter the game are configured under this service.

Child Object:

  • 平台自定义角色
    玩家加入游戏时,玩家控制的角色属性复制自平台自定义角色,外观来自平台。

  • Platform Avatar
    When players enter the game, player’s avatar properties come fromPlatform Avatar, appearance comes from platform.

  • 摄像机初始化
    玩家加入游戏时,玩家控制的摄像机属性复制自摄像机初始化

  • Camera Initialization
    When players enter the game, the camera properties controlled by the player comes from Camera Initialization

  • 玩家初始化脚本
    玩家加入游戏时,将玩家初始化脚本下的客户端脚本复制到玩家列表下对应玩家的玩家脚本文件夹下,运行一次。

  • Player Initialization Scripts
    When players join the game, the client script under the player initialization script is copied to the player script folder of the corresponding player under the player list and runs once.

  • 角色初始化脚本
    玩家加入游戏时,将角色初始化脚本下的客户端脚本复制到工作区下对应玩家的角色下,每次角色对象生成时运行一次。

  • Character Initialization Scripts
    When players join the game, the client script under character initialization script is copied to the corresponding player’s character in the workspace, and runs every time the character object is generated.

属性 Properties

    ControlType        Enum.HandleMode   
    第一人称视角摄像机方向与角色面向保持同步,角色移动时不会改变面向;第三人称视角摄像机方向不随角色面向改变,角色移动时会向移动方向转向
    First person camera angle and character direction stays in sync, the angles will not change when moving the character. Third person camera angle will not change with character angle, the angles will change when the character changes.

    MouseLockSwitch        bool    [只读]
    玩家是否可以通过shift键,主动切换鼠标锁定模式
    Whether players can use the Shift key to lock or unlock mouse.

Inherited from RWObject

    Name        string   
    该对象的自定义名称
    The object’s customized name.

    ClassName        string   
    该对象对应的对象类型名称
    The object’s corresponding object class name.

    Parent        RWObject   
    该对象的父级对象
    The object’s parent object.

函数 Functions

Inherited from RWObject

    DelAllChild()
    删除所有子对象
    Delete all child objects.

    Available()
    检查对象是否可用
    Check if object is available to use.

    GetAncestorByName(Name)
    通过对象名字寻找父级对象
    Find ancestor by object’s name.

    GetAncestorByClassName(className)
    通过对象类型寻找父级对象
    Find ancestor by object’s class.

    GetChildByName(Name,recursive)
    通过对象名字寻找子级对象
    Find child by object’s name.

    GetChildByClassName(className,recursive)
    通过对象类型寻找子级对象
    Find child by object’s class.

    GetAllChild()
    寻找自身所有子级对象,并作为一个列表返回
    Find all child objects and return as a list.

    GetAllDescendant()
    递归寻找自身所有后代,并作为一个列表返回
    Recursively find all descendants of itself and return as a list.

    IsAncestor(TarObj)
    判断自身是否为目标对象的祖先
    Determine whether object itself is the ancestor of the target object.

    IsDescendant(TarObj)
    判断自身是否为目标对象的后代
    Determine whether object itself is the descendant of the target object.

    WaitForChild(childName,timeout)
    寻找自身的子对象。如果没有子对象,在没有填写timeout参数时,会暂停进程直到找到子对象;如果填写了timeout参数,会根据参数时间暂停进程,超出参数时间后,进程照常进行
    Find child of object. If child does not exist when there are no timeout parameters, the process will be paused until child is found. If there are timeout parameters, the process will pause based on the parameter, once process exceeds timeout parameters, the process will continue.

    Child(childName)
    根据给定的名字寻找自身的子对象
    Find object’s child based on name.

    Equals(TarObj)
    判断自身是否为目标对象,结果为真返回True,结果为假返回False;注意克隆、新建同类型、同名对象,equal结果均为假
    Determine whther object itself is target object, if true then will return as True, vice versa for false. Notice that duplicate, new same type, same name objects, and equals will return as false.

    IsClass(className)
    判断自身是否为给定的对象类型
    Determine whether object itself is the given object class.

Events

Inherited from RWObject

    Destroyed()
    删除自身时触发
    Triggered when object destroyed itself.

    ChildAdded(childobject)
    添加子对象时触发
    Triggered when child object is added.

    ChildRemoved(childobject)
    移除子对象时触发
    Triggered when child object is removed

    DescendantAdded(descendantobject)
    添加后代时触发
    Triggered when descendant is added.

    DescendantRemoved(descendantobject)
    移除后代时触发
    Triggered when descendant is removed.

    AncestryChanged(AncestryChanged)
    祖先变更时触发
    Triggered when ancestry is changed.

文档更新时间: 2020-10-09 02:40   作者:刘征