万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

キャラクターの移動処理(バイオハザードタイプ) のBoo移植

強火で進め:http://d.hatena.ne.jp/nakamura001/20110612/1307893603
上記サイトのBoo移植してみた
・PlayerScript.boo

import UnityEngine

[RequireComponent(CharacterController)]
class PlayerScript (MonoBehaviour):
    private gravity as single = 20.0F
    private moveDirection as Vector3 = Vector3.zero

    def Start ():
        animation.Play("Idle")

    def Update ():
        pass

    def FixedUpdate ():
        inputH as  bool = false
        inputV as bool = false

        controller = GetComponent(CharacterController)
        moveDirection = Vector3.zero
        moveDirection.y -= gravity * Time.deltaTime

        if Mathf.Abs(Input.GetAxisRaw("Horizontal")) > 0.5:
            inputH = true
            transform.eulerAngles.y += Input.GetAxis("Horizontal") * Time.deltaTime*100

        if (Mathf.Abs(Input.GetAxisRaw("Vertical")) > 0.5):
            inputV = true
            moveDirection += transform.forward * Input.GetAxis("Vertical")*2;

        controller.Move(moveDirection * Time.deltaTime);

        if inputH or inputV:
            animation.CrossFade("walk")
        else:
            animation.CrossFade("idle")