void Fire()
    {
        if (Physics.Raycast(ray, out hit))
        {
            haptics.Vibrate(VibrationForce.Medium);
            GameObject particles = Instantiate(hitParticles, hit.point, Quaternion.identity);
            Destroy(particles, 0.4f);
            if (hit.collider.tag == "Enemy")
            {
                hit.collider.gameObject.GetComponent <EnemyBehaviours>().State = EnemyState.Dead;
            }
            if (hit.collider.tag == "score")
            {
                hit.collider.gameObject.GetComponent <EnemyDie>().Die();
            }
            if (hit.collider.tag == "bullet")
            {
                Destroy(hit.collider.gameObject);
            }
        }
        GameObject trail = Instantiate(hitTrail);

        VolumetricLines.VolumetricLineBehavior vol = trail.GetComponent <VolumetricLines.VolumetricLineBehavior>();
        vol.StartPos = barrellStart.position;
        vol.EndPos   = barrelEnd.position;
        lazerShot.Play();
    }
Esempio n. 2
0
 public void Initialize(Vector3 laserOrigin, Vector3 laserEnd, Color laserColor)
 {
     lightStrip          = GetComponent <VolumetricLines.VolumetricLineBehavior>();
     lightStrip.StartPos = laserOrigin;
     lightStrip.EndPos   = transform.InverseTransformPoint(laserEnd);
     lightStrip.UpdateLineWidth(width);
     lightStrip.UpdateLineColor(laserColor);
 }
Esempio n. 3
0
 public void Initialize(Vector3 laserOrigin, Vector3 laserEnd, Color laserColor)
 {
     lightStrip = GetComponent<VolumetricLines.VolumetricLineBehavior>();
     lightStrip.StartPos = laserOrigin;
     lightStrip.EndPos = transform.InverseTransformPoint(laserEnd);
     lightStrip.UpdateLineWidth(width);
     lightStrip.UpdateLineColor(laserColor);
 }
Esempio n. 4
0
    private void CreateGammaRay()
    {
        //raggio gamma
        GameObject raggiogamma = Instantiate(RaggioGamma);

        raggiogamma.GetComponent <ShowLabel>().Simulate = Simulate;
        VolumetricLines.VolumetricLineBehavior behavior = raggiogamma.GetComponent <VolumetricLines.VolumetricLineBehavior>();
        behavior.StartPos = gameObject.transform.position;
        float x = -1, y = -1;

        if (UnityEngine.Random.Range(-20000, 20000) % 2 == 0)
        {
            x = 1;
        }
        if (UnityEngine.Random.Range(-20000, 20000) % 2 == 0)
        {
            y = 1;
        }
        behavior.EndPos = new Vector3(x, y, behavior.StartPos.z);
        raggiogamma.transform.position = behavior.StartPos - behavior.EndPos;
        raggiogamma.GetComponent <Rigidbody>().AddForce((behavior.EndPos - behavior.StartPos) * 15);
        Destroy(raggiogamma, 15);
    }
Esempio n. 5
0
 void Awake()
 {
     _lazer           = GetComponentInChildren <VolumetricLines.VolumetricLineBehavior> ();
     _lazer.LineWidth = 0.02f;
 }
 void Start()
 {
     vol = GetComponent <VolumetricLines.VolumetricLineBehavior>();
 }
	public void OnEnable()
	{
		m_Instance = target as VolumetricLineBehavior;
		m_fields = ExposeProperties.GetProperties(m_Instance);
	}
Esempio n. 8
0
 private void Start()
 {
     line = GetComponent <VolumetricLines.VolumetricLineBehavior>();
 }