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

Run in Unity Web Plaer

Free look with mouse.
Escape: quit the application


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, BobAnimation.Idle
      wait 1.0f

  Create() =
      UnityBob = UnityBob.Find()

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


No comments yet.