コード例 #1
0
    public void Particles()
    {
        ResponsiveParticles p = Instantiate(particles, transform.position, transform.rotation);

        p.SetColor(particleColor);
        Destroy(gameObject);
    }
コード例 #2
0
ファイル: Sword.cs プロジェクト: mikeibrahim/space-ninja
    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);
            }
        }
    }