This demo shows a character patrolling an area of a map.

Run in Unity Web Plaer

CONTROLS:
Free look with mouse.
Escape: quit the application

SOURCE CODE:

module Game

open "UnityEngine.dll"
open UnityEngine


worldEntity World = {
  inherit UnityBob

  rule Quit =
    wait Input.GetKey(KeyCode.Escape)
    yield true

  rule Velocity, CurrentAnimation = 
    for c in Checkpoints do
      let dir0 = c - Position
      yield dir0, BobAnimation.Walk
      wait Vector3.Dot(dir0, c - Position) < 0.0f
      yield Vector3.zero, BobAnimation.Idle
      wait 1.0f

  Create() =
    {
      UnityBob = UnityBob.Find()
    }
}

Last edited Jun 3, 2015 at 8:20 PM by mabbadi, version 2

Comments

No comments yet.