Exemple #1
0
    /**
     * Handler for whenever the custom inspector is enabled
     */
    protected void OnEnable()
    {
        controller  = (WaterGridController)target;
        vectorField = controller.vectorField;

        vectorField.LoadFromFile(controller.tilemap);
    }
Exemple #2
0
 static void DrawWaterGridControllerGizmos(WaterGridController controller, GizmoType gizmoType)
 {
     // make sure the controller exists
     if (controller)
     {
         // loop through all vectors in the field
         for (int x = 0; x < controller.VFWidth; x++)
         {
             for (int y = 0; y < controller.VFHeight; y++)
             {
                 // check to see if there's actually a water tile at this cell
                 if (controller.WaterTileAt(x, y))
                 {
                     // draw an arrow gizmo originating from the center of the cell
                     Vector3 center = controller.GetCellCenterWorld(x, y);
                     if (controller.GetVector(x, y) != Vector2.zero)
                     {
                         DrawArrow.ForGizmo(center, controller.GetVector(x, y), 0.25f * controller.grid.transform.localScale.x);
                     }
                 }
             }
         }
     }
 }