Example #1
0
        void Update()
        {
            var dt = Time.deltaTime;

            foreach (var source in m_Sources)
            {
                source.time       += dt * source.speed;
                source.spawnCount += dt * source.rate;
                if (source.spawnCount >= 1.0f)
                {
                    float spawnCount = Mathf.Floor(source.spawnCount);
                    source.spawnCount = Mathf.Repeat(source.spawnCount, 1.0f);

                    var position  = new Vector3(Mathf.Sin(source.time), Mathf.Cos(source.time), 0.0f) * source.radius;
                    var direction = new Vector3(Mathf.Cos(source.time), -Mathf.Sin(source.time), 0.0f) * 0.1f;

                    m_CacheEventAttribute.SetVector3(s_ColorID, source.color);
                    m_CacheEventAttribute.SetVector3(s_PositionID, position);
                    m_CacheEventAttribute.SetVector3(s_VelocityID, direction);
                    m_CacheEventAttribute.SetFloat(s_SpawnCountID, spawnCount);

                    m_VisualEffect.SendEvent(s_ManualId, m_CacheEventAttribute);
                }
            }
        }
Example #2
0
    private void CreateScanVFX(Vector3 targetPosition)
    {
        /* The event payload is a little weird. You can only set the value of
         * a couple built-in attributes (position and targetPosition are defaults). */
        VFXEventAttribute payload = scanLineVFX.CreateVFXEventAttribute();

        payload.SetVector3("position", transform.position);
        payload.SetVector3("targetPosition", targetPosition);
        scanLineVFX.SendEvent("SpawnScanLine", payload);
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            Ray        screenRay = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit       = new RaycastHit();


            if (Physics.Raycast(screenRay, out hit))
            {
                waterIsOn = true;
                //  target.position = hit.point;

                VFXEventAttribute eventAttributes = vf.CreateVFXEventAttribute();
                eventAttributes.SetVector3("targetPosition", hit.point);

                vf.SendEvent("Start", eventAttributes);

                Vector3 difference = hit.point - transform.position;
                float   rotationY  = Mathf.Atan2(difference.x, difference.z) * Mathf.Rad2Deg;
                transform.rotation = Quaternion.Euler(0.0f, rotationY, 0.0f);
            }
        }

        else if (Input.GetMouseButtonUp(0) && !debug)
        {
            vf.SendEvent("Stop");
            //waterIsOn = false;
        }
    }
Example #4
0
        public void Spawn(PlayerEnt player)
        {
            player.transform.position = spawnPosition.position;
            player.rb.velocity        = Vector2.zero;

            VFXEventAttribute attribute = vfx.CreateVFXEventAttribute();

            attribute.SetVector3("position", transform.InverseTransformPoint(spawnPosition.position));
            vfx.SendEvent("PlayerSpawn", attribute);
        }
Example #5
0
 private void CreateHitParticle(Scoring scoring)
 {
     if (scoring.Ranking != null && scoring.Ranking != Scoring.Rank.Miss && scoring.Source is SimpleNote)
     {
         var simpleNote = (SimpleNote)scoring.Source;
         if (simpleNote.Golden)
         {
             return;        //golden FX handled in GoldenHitFXController
         }
         _eventAttribute.SetVector3(PositionAttribute, new Vector3(simpleNote.Position.Center, .1f, 0f));
         _basicHitFx.SendEvent(OnHitEvent, _eventAttribute);
     }
 }
Example #6
0
        void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                var pos = Input.mousePosition;
                pos.z = _vfx.transform.position.z - _camera.transform.position.z;
                pos   = _camera.ScreenToWorldPoint(pos);

                if (_attrib == null)
                {
                    _attrib = _vfx.CreateVFXEventAttribute();
                }
                _attrib.SetVector3("position", pos);

                _vfx.SendEvent("OnManualSpawn", _attrib);
            }
        }
Example #7
0
    // Update is called once per frame
    void OnGUI()
    {
        if (GUI.Button(new Rect(50, 50, 100, 50), "play1"))
        {
            if (vfx1 == null)
            {
                var vfxGo1 = new UnityEngine.GameObject("VfxGo1");
                vfx1 = vfxGo1.AddComponent <UnityEngine.Experimental.VFX.VisualEffect>();

                var grenadeClient = GetComponent <GrenadeClient>();

                vfx1.visualEffectAsset = grenadeClient.explodeEffect.effect;
                vfxEventAttribute1     = vfx1.CreateVFXEventAttribute();
                vfxEventAttribute1.SetVector3(positionID, new Vector3(20.0f, 0.0f, 0.0f));
            }

            vfx1.Play(vfxEventAttribute1);
        }

#if false
        if (vfx1 != null && Time.frameCount % 30 == 0)
        {
            vfx1.Play(vfxEventAttribute1);
        }
#endif

        if (GUI.Button(new Rect(50, 150, 100, 50), "play2"))
        {
            if (vfx2 == null)
            {
                var vfxGo2 = new UnityEngine.GameObject("VfxGo2");
                vfx2 = vfxGo2.AddComponent <UnityEngine.Experimental.VFX.VisualEffect>();

                var grenadePrefab = ReplicatedPrefabMgr.GetPrefab("assets__newnetwork_prefab_robot_grenade");
                var grenadeClient = grenadePrefab.GetComponent <GrenadeClient>();

                vfx2.visualEffectAsset = grenadeClient.explodeEffect.effect;
                vfxEventAttribute2     = vfx2.CreateVFXEventAttribute();
                vfxEventAttribute2.SetVector3(positionID, new Vector3(20.0f, 0.0f, 0.0f));
            }

            vfx2.Play(vfxEventAttribute2);
        }
    }