Applies forces to simulate buoyancy, fluid-flow and fluid drag.

Inheritance: Effector2D
 static public int get_density(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.BuoyancyEffector2D self = (UnityEngine.BuoyancyEffector2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.density);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 static public int get_linearDrag(IntPtr l)
 {
     try {
         UnityEngine.BuoyancyEffector2D self = (UnityEngine.BuoyancyEffector2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.linearDrag);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.BuoyancyEffector2D o;
         o = new UnityEngine.BuoyancyEffector2D();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_linearDrag(IntPtr l)
 {
     try {
         UnityEngine.BuoyancyEffector2D self = (UnityEngine.BuoyancyEffector2D)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.linearDrag = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static void BuoyancyEffector2D_angularDrag(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.BuoyancyEffector2D _this = (UnityEngine.BuoyancyEffector2D)vc.csObj;
         var result = _this.angularDrag;
         JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
     }
     else
     {
         System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
         UnityEngine.BuoyancyEffector2D _this = (UnityEngine.BuoyancyEffector2D)vc.csObj;
         _this.angularDrag = arg0;
     }
 }
Esempio n. 6
0
        void Awake()
        {
            _buoyancyEffector2D = GetComponent<BuoyancyEffector2D>();
            _surfaceLevel = _buoyancyEffector2D.surfaceLevel;

            _splashCache = new Water2DSplashFX[SplashFXPrecache];
            var container = new GameObject("Splash Container").transform;

            for (var i = 0; i < _splashCache.Length; i++)
            {
                var splash = Instantiate(SplashFXPrefab);
                splash.transform.parent = container;

                _splashCache[i] = splash;
            }
        }
 /// <summary>
 /// Write the specified value using the writer.
 /// </summary>
 /// <param name="value">Value.</param>
 /// <param name="writer">Writer.</param>
 public override void Write(object value, ISaveGameWriter writer)
 {
     UnityEngine.BuoyancyEffector2D buoyancyEffector2D = (UnityEngine.BuoyancyEffector2D)value;
     writer.WriteProperty("surfaceLevel", buoyancyEffector2D.surfaceLevel);
     writer.WriteProperty("density", buoyancyEffector2D.density);
     writer.WriteProperty("linearDrag", buoyancyEffector2D.linearDrag);
     writer.WriteProperty("angularDrag", buoyancyEffector2D.angularDrag);
     writer.WriteProperty("flowAngle", buoyancyEffector2D.flowAngle);
     writer.WriteProperty("flowMagnitude", buoyancyEffector2D.flowMagnitude);
     writer.WriteProperty("flowVariation", buoyancyEffector2D.flowVariation);
     writer.WriteProperty("useColliderMask", buoyancyEffector2D.useColliderMask);
     writer.WriteProperty("colliderMask", buoyancyEffector2D.colliderMask);
     writer.WriteProperty("enabled", buoyancyEffector2D.enabled);
     writer.WriteProperty("tag", buoyancyEffector2D.tag);
     writer.WriteProperty("name", buoyancyEffector2D.name);
     writer.WriteProperty("hideFlags", buoyancyEffector2D.hideFlags);
 }
        /// <summary>
        /// Read the data into the specified value.
        /// </summary>
        /// <param name="value">Value.</param>
        /// <param name="reader">Reader.</param>
        public override void ReadInto(object value, ISaveGameReader reader)
        {
            UnityEngine.BuoyancyEffector2D buoyancyEffector2D = (UnityEngine.BuoyancyEffector2D)value;
            foreach (string property in reader.Properties)
            {
                switch (property)
                {
                case "surfaceLevel":
                    buoyancyEffector2D.surfaceLevel = reader.ReadProperty <System.Single> ();
                    break;

                case "density":
                    buoyancyEffector2D.density = reader.ReadProperty <System.Single> ();
                    break;

                case "linearDrag":
                    buoyancyEffector2D.linearDrag = reader.ReadProperty <System.Single> ();
                    break;

                case "angularDrag":
                    buoyancyEffector2D.angularDrag = reader.ReadProperty <System.Single> ();
                    break;

                case "flowAngle":
                    buoyancyEffector2D.flowAngle = reader.ReadProperty <System.Single> ();
                    break;

                case "flowMagnitude":
                    buoyancyEffector2D.flowMagnitude = reader.ReadProperty <System.Single> ();
                    break;

                case "flowVariation":
                    buoyancyEffector2D.flowVariation = reader.ReadProperty <System.Single> ();
                    break;

                case "useColliderMask":
                    buoyancyEffector2D.useColliderMask = reader.ReadProperty <System.Boolean> ();
                    break;

                case "colliderMask":
                    buoyancyEffector2D.colliderMask = reader.ReadProperty <System.Int32> ();
                    break;

                case "enabled":
                    buoyancyEffector2D.enabled = reader.ReadProperty <System.Boolean> ();
                    break;

                case "tag":
                    buoyancyEffector2D.tag = reader.ReadProperty <System.String> ();
                    break;

                case "name":
                    buoyancyEffector2D.name = reader.ReadProperty <System.String> ();
                    break;

                case "hideFlags":
                    buoyancyEffector2D.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> ();
                    break;
                }
            }
        }
 /// <summary>
 /// Read the data using the reader.
 /// </summary>
 /// <param name="reader">Reader.</param>
 public override object Read(ISaveGameReader reader)
 {
     UnityEngine.BuoyancyEffector2D buoyancyEffector2D = SaveGameType.CreateComponent <UnityEngine.BuoyancyEffector2D> ();
     ReadInto(buoyancyEffector2D, reader);
     return(buoyancyEffector2D);
 }