void SetController()
    {
        sprite = GetComponent<OTObject>();
        if (sprite!=null)
            sp = shape.IsPathFor(sprite, duration, looping, addRotation);
        else
            sp = shape.IsPathFor(gameObject, duration, looping, addRotation);

        if (speed > 0)
            sp.duration = shape.DurationWithSpeed(speed);
        sp.customControl = customControl;
        sp.customPosition = customPosition;
        sp.upVector = upVector;
        sp.targetObject = targetObject;
    }
Exemple #2
0
 /// <summary>
 /// Sets this shape as a path for a game object 
 /// </summary>
 /// <param name="g">Game object</param>
 /// <param name="duration">Movement Duration</param>
 /// <param name="looping">Object will be looping on shape</param>
 /// <param name="addRotation">Add aditional rotation</param>
 /// <returns>A path controller for this object.</returns>
 public OTPathController IsPathFor(GameObject g, float duration, bool looping, float addRotation)
 {
     OTObject o = g.GetComponent<OTObject>();
     if (o != null)
         return IsPathFor(o,duration,looping,addRotation);
     OTPathController moving = new OTPathController(o, "movingpath-" + g.name, this, duration);
     moving.looping = looping;
     moving.addRotation = addRotation;
     OTController c = OT.Controller(typeof(OTPathController), "movingpath-" + g.name);
     if (c != null)
         OT.RemoveController(c);
     OT.AddController(moving);
     return moving;
 }
 // Use this for initialization
 void Start()
 {
     // Create arrow sprite from prototype
     pc = NewArrow();
     // Set the up vector so that the arrow points clockwise
     pc.upVector = OTPathController.UpVector.OutWard;
     // set finish event handler
     pc.onFinish = finishedPath;
     // start in looping mode
     pc.looping = true;
     // start with a non-moving arrow
     pc.Stop();
 }
Exemple #4
0
 /// <summary>
 /// Sets this shape as a path for an OTObject
 /// </summary>
 /// <param name="o">Orthello object</param>
 /// <param name="duration">Movement Duration</param>
 /// <param name="looping">Object will be looping on shape</param>
 /// <param name="addRotation">Add aditional rotation</param>
 /// <returns>A path controller for this object.</returns>
 public OTPathController IsPathFor(OTObject o, float duration, bool looping, float addRotation)
 {
     OTPathController moving = new OTPathController(o, "movingpath", this, duration);
     moving.looping = looping;
     moving.addRotation = addRotation;
     OTController c = o.Controller(typeof(OTPathController));
     if (c != null)
         o.RemoveController(c);
     o.AddController(moving);
     return moving;
 }