Exemple #1
0
    static void CollisionEvent_collider(JSVCall vc)
    {
        UnityEngine.ParticleSystem.CollisionEvent _this = (UnityEngine.ParticleSystem.CollisionEvent)vc.csObj;
        var result = _this.collider;

        JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
    }
    void OnParticleCollision(GameObject other)
    {
        if(other.tag == "FireBarrel" || other.tag == "Barrel")
        {
            for(int i = 0; i < collisionEvents.Length; i++)
            {
                collisionEvents[i] = new ParticleSystem.CollisionEvent[sprinklers[i].safeCollisionEventSize];
            }

            for(int i = 0; i < collisionEvents.Length; i++)
            {
                sprinklers[i].GetCollisionEvents(gameObject, collisionEvents[i]);
            }

            for(int i = 0; i < collisionEvents.Length; i++)
            {
                for(int j = 0; j < collisionEvents[i].Length; j++)
                {
                    int chance = Random.Range(1, playOneIn);
                    if(chance == playOneIn-1)
                    {
                        int clipIndex = Random.Range(0, waterHits.Length);
                        AudioSource.PlayClipAtPoint(waterHits[clipIndex], transform.position);
                    }
                }
            }
        }
    }
Exemple #3
0
    static void CollisionEvent_velocity(JSVCall vc)
    {
        UnityEngine.ParticleSystem.CollisionEvent _this = (UnityEngine.ParticleSystem.CollisionEvent)vc.csObj;
        var result = _this.velocity;

        JSApi.setVector3S((int)JSApi.SetType.Rval, result);
    }
    void OnParticleCollision(GameObject other)
    {
        if(other.tag == "FireBarrel")
        {
            for(int i = 0; i < collisionEvents.Length; i++)
            {
                collisionEvents[i] = new ParticleSystem.CollisionEvent[sprinklers[i].safeCollisionEventSize];
            }

            for(int i = 0; i < collisionEvents.Length; i++)
            {
                sprinklers[i].GetCollisionEvents(gameObject, collisionEvents[i]);
            }

            for(int i = 0; i < collisionEvents.Length; i++)
            {
                for(int j = 0; j < collisionEvents[i].Length; j++)
                {
                    foreach(ParticleHelper ph in fire.particles)
                    {
                        if(ph.varyAlpha)
                            ph.DecreaseAlpha();
                        if(ph.varyEmission)
                            ph.DecreaseEmission();
                        if(ph.varyIntensity)
                            ph.DecreaseIntensity();
                        if(ph.varyRange)
                            ph.DecreaseRange();
                    }
                }
            }
        }
    }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem.CollisionEvent o;
         o = new UnityEngine.ParticleSystem.CollisionEvent();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem.CollisionEvent o;
         o=new UnityEngine.ParticleSystem.CollisionEvent();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
Exemple #7
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem.CollisionEvent o;
         o = new UnityEngine.ParticleSystem.CollisionEvent();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
    void OnParticleCollision(GameObject other)
    {
        if(other.tag == "Barrel")
        {

            for(int i = 0; i < collisionEvents.Length; i++)
            {
                collisionEvents[i] = new ParticleSystem.CollisionEvent[sprinklers[i].safeCollisionEventSize];
            }

            for(int i = 0; i < collisionEvents.Length; i++)
            {
                sprinklers[i].GetCollisionEvents(gameObject, collisionEvents[i]);
            }

            for(int i = 0; i < collisionEvents.Length; i++)
            {
                for(int j = 0; j < collisionEvents[i].Length; j++)
                {
                    lid.AddForceAtPosition(Vector3.down * dropletForce, collisionEvents[i][j].intersection);
                }
            }
        }
    }
Exemple #9
0
    static bool ParticleSystem_GetCollisionEvents__GameObject__CollisionEvent_Array(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 2)
        {
            UnityEngine.GameObject arg0 = (UnityEngine.GameObject)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            UnityEngine.ParticleSystem.CollisionEvent[] arg1 = JSDataExchangeMgr.GetJSArg <UnityEngine.ParticleSystem.CollisionEvent[]>(() =>
            {
                int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg);
                int length  = JSApi.getArrayLength(jsObjID);
                var ret     = new UnityEngine.ParticleSystem.CollisionEvent[length];
                for (var i = 0; i < length; i++)
                {
                    JSApi.getElement(jsObjID, i);
                    ret[i] = (UnityEngine.ParticleSystem.CollisionEvent)JSMgr.datax.getObject((int)JSApi.GetType.SaveAndRemove);
                }
                return(ret);
            });
            JSApi.setInt32((int)JSApi.SetType.Rval, (System.Int32)(((UnityEngine.ParticleSystem)vc.csObj).GetCollisionEvents(arg0, arg1)));
        }

        return(true);
    }
Exemple #10
0
 static public int get_collider(IntPtr l)
 {
     UnityEngine.ParticleSystem.CollisionEvent o = (UnityEngine.ParticleSystem.CollisionEvent)checkSelf(l);
     pushValue(l, o.collider);
     return(1);
 }
Exemple #11
0
 static public int get_intersection(IntPtr l)
 {
     UnityEngine.ParticleSystem.CollisionEvent o = (UnityEngine.ParticleSystem.CollisionEvent)checkSelf(l);
     pushValue(l, o.intersection);
     return(1);
 }