예제 #1
0
    public void Particles()
    {
        ResponsiveParticles p = Instantiate(particles, transform.position, transform.rotation);

        p.SetColor(particleColor);
        Destroy(gameObject);
    }
예제 #2
0
    void FixedUpdate()
    {
        prevPos            = transform.position;
        transform.position = MousePos();
        RaycastHit[] hits = Physics.RaycastAll(new Ray(prevPos, (transform.position - prevPos).normalized), (transform.position - prevPos).magnitude);

        for (int i = 0; i < hits.Length; i++)
        {
            if (hits[i].collider.gameObject.GetComponent <Enemy>())
            {
                hits[i].collider.gameObject.GetComponent <Enemy>().Die();
                ResponsiveParticles p = Instantiate(particles, transform.position, transform.rotation);
                p.SetColor(particleColor);
            }
        }
    }