[wpdreams_ajaxsearchlite]

更改输入控制器


通过创建一个继承自AtavismInputController类的新C#脚本,可以轻松更改Atavism的输入控制器系统。以下是所需核心基础知识的示例:

  public class ExampleInputController : AtavismInputController  {

// Use this for initialization
void Start () {
    // Need to tell the client that this is the new active input controller
    ClientAPI.InputControllerActivated(this);
}

public override Vector3 GetPlayerMovement() {
    Vector3 playerMovementVector = Vector3.zero;
    // Do your input handling here, and update the playerMovementVector to contain the
    // desired movement. The vector gets normalized in the MobController, then the players speed property will be
    // applied to it.
    return playerMovementVector;
}

public override void RunCameraUpdate() {
    // Work out where the camera should now be, and set Main Camera to that position/rotation
}
  }

所有类需求都是GetPlayerMovement()和RunCameraUpdate()函数。使用处理输入的逻辑填充这些函数,并更新playerMovementVector或更新摄像机的位置和旋转。

完成脚本后,将其添加到MainWorld中的MainCamera对象或等效的游戏场景中,然后关闭或删除Atavism3rdPersonInputController组件。