Example #1
0
    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);
                    }
                }
            }
        }
    }
 static int _CreateParticleSystemCollisionEvent(IntPtr L)
 {
     LuaScriptMgr.CheckArgsCount(L, 0);
     ParticleSystem.CollisionEvent obj = new ParticleSystem.CollisionEvent();
     LuaScriptMgr.PushValue(L, obj);
     return(1);
 }
Example #3
0
    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 int get_velocity(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        if (o == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name velocity");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index velocity on a nil value");
            }
        }

        ParticleSystem.CollisionEvent obj = (ParticleSystem.CollisionEvent)o;
        LuaScriptMgr.PushValue(L, obj.velocity);
        return(1);
    }
Example #5
0
    public void OnCollision(ParticleSystem.CollisionEvent h, CarControl cc)
    {
        if (cc == pl.cc)
        {
            return;
        }
        Debug.DrawRay(h.intersection, h.normal, Color.red, 10);

        _Game.Hole(h.intersection, h.normal);

        if (_AutoQuality.particles || cc)
        {
            _Game.Emit(h.intersection, h.normal, cc ? _Game.sparks : _Game.concrete);
        }

        if (cc)
        {
            cc.pl.PlayOneShot(res.damageSound.Random(), 1, true, Random.Range(.5f, 1));
        }
        else if (Random.Range(1, 20) == 1)
        {
            PlayClipAtPoint(res.ric.Random(), h.intersection);
        }
        if (Time.time - lastTimeHit > .3f && cc)
        {
            lastTimeHit = Time.time;

            if (cc.pl.IsMine && cc.pl.IsEnemy(pl))
            {
                cc.pl.AddLife(-(pl.pcVsAndroid ? 5 : 7), pl.viewId);
            }

            if (_AutoQuality.destrQuality >= 2 || (pl.IsMine || cc.pl.IsMine) && _AutoQuality.destrQuality >= 1 && Random.Range(1, 3) == 1)
            {
                cc.pl.OnCollision(h.intersection, 3, 10, true);
            }
        }
    }
Example #6
0
    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);
                }
            }
        }
    }