void Start()
    {
        // Get the event from your particle system
        playgroundEvent = PlaygroundC.GetEvent(0, particles);

        // Subscribe to the event
        AddEventListener();

        // Cache components of this GameObject (helps performance on low-end devices)
        thisTransform = transform;
        thisCollider  = collider;
        thisRenderer  = renderer;

        // Create materials to show if the event listener is active or not
        if (activeMaterial == null)
        {
            activeMaterial       = new Material(Shader.Find("Diffuse"));
            activeMaterial.color = Color.white;
        }
        if (inactiveMaterial == null)
        {
            inactiveMaterial       = new Material(Shader.Find("Diffuse"));
            inactiveMaterial.color = Color.black;
        }

        thisRenderer.sharedMaterial = activeMaterial;
    }
예제 #2
0
    void Start()
    {
        // Get the first event
        playgroundEvent = PlaygroundC.GetEvent(0, particles);

        // Add listener
        AddListener();
    }
    // Use this for initialization
    void Start()
    {
        // Events run on a second thread, only use thread-safe methods within the Event Delegate (no GetTransform)
        thisTransform = transform;

        // Get the event from your particle system
        playgroundEvent = PlaygroundC.GetEvent(0, particles);

        // Subscribe to the event
        AddEventListener();
    }
    void Start()
    {
        if (particles == null)
        {
            return;
        }

        // Get the first event
        playgroundEvent = PlaygroundC.GetEvent(0, particles);

        // Add listener
        AddListener();
    }
    List <Vector3> queuedSystems = new List <Vector3>();                                // The queued list of particle system positions to enable on main-thread

    void Start()
    {
        // Get the event
        PlaygroundEventC mainParticleEvent = PlaygroundC.GetEvent(0, mainParticles);

        // Make sure the event delegate is set to target event listeners
        mainParticleEvent.broadcastType = EVENTBROADCASTC.EventListeners;

        // Hook up to the event delegate
        mainParticleEvent.particleEvent += OnParticleEvent;

        // Cache the particle systems in the pool
        cachedParticles = new List <PlaygroundParticlesC>();
        for (int i = 0; i < quantity; i++)
        {
            GameObject go = (GameObject)Instantiate((Object)particleSystemPoolPrefab);
            cachedParticles.Add(go.GetComponent <PlaygroundParticlesC>());
            cachedParticles[i].particleSystemGameObject.SetActive(false);
        }
    }
예제 #6
0
 private void ShowParticleEffect(int ownerid, int boardId)
 {
     if (pawn.PawnEffectParticle != null)
     {
         enemyPawnToAttack.PrepareToReceiveDamage(0);
         Vector3    ParticlePos = pawn.gamePlayComp.Board [ownerid].BoardPiece.transform.localPosition;
         Quaternion ParticleRot = Quaternion.identity;
         ParticlePos.z           = -0.5f;
         ParticleRot.eulerAngles = new Vector3(0, 0, 0);
         GameObject ParticleOb = Instantiate(pawn.PawnEffectParticle, pawn.gamePlayComp.transform);
         GameObject Target     = ParticleOb.transform.GetChild(0).gameObject;
         Target.transform.SetParent(enemyPawnToAttack.transform);
         Target.transform.localPosition     = new Vector3(0, 0, 0);
         ParticleOb.transform.localRotation = ParticleRot;
         ParticleOb.transform.localPosition = ParticlePos;
         PlaygroundParticlesC Particle = ParticleOb.GetComponent <PlaygroundParticlesC> ();
         PlaygroundC.GetEvent(0, Particle).particleEvent += ShotEvent;
         Particle.emit = true;
     }
     else
     {
         Debug.LogError("no effect particle found");
     }
 }
예제 #7
0
    public Color32 color             = Color.white;                     // The color of particles

    void Start()
    {
        // Specify which event you would like to listen to
        PlaygroundC.GetEvent(0, particlesEvent).particleEvent += EmitOnEvent;
    }