public override void OnLaserEnter(LaserDiffuser laserDiffuser, ArcReactorHitInfo hitInfo)
    {
        //slow down camera movement for easier aiming
        cam.turnSpeedModifier = slowTurnSpeedModifier;

        laserDiffuser.Diffuse(hitInfo);
        this.laserDiffuser = laserDiffuser;
    }
    public override void DoHitStart(ArcReactorHitInfo hit)
    {
        //Update the hit position of the particle effect
        Debug.Log("Laser Hit!");
        hitParticles.transform.position = hit.raycastHit.point;
        hitParticles.transform.LookAt(hit.raycastHit.point + hit.raycastHit.normal);

        hitParticles.gameObject.SetActive(true);
        hitParticles.enableEmission = true;
    }
 //Called when a new laser hit is detected
 public virtual void DoHitStart(ArcReactorHitInfo hitInfo)
 {
     StartCoroutine(TrackHit());
     foreach (LaserModule module in laserModules)
     {
         if (module.IsEnabled)
         {
             module.DoHitStart(hitInfo);
         }
     }
 }
Exemple #4
0
    public void DoHitStart(ArcReactorHitInfo hit)
    {
        //Update the hit position of the particle effect
        SingleLaserHit newHit = new SingleLaserHit();

        newHit.particles = GameObject.Instantiate <ParticleSystem> (hitParticles);
        newHit.particles.transform.position = hit.raycastHit.point;
        newHit.particles.transform.LookAt(hit.raycastHit.point + hit.raycastHit.normal);
        newHit.hitThisFrame = true;
        allLaserHits.Add(hit.launcher, newHit);
        StartCoroutine(TrackHit(newHit, hit.launcher));
    }
Exemple #5
0
    //Invoked from the ArcReactor system whenever a laser hits the collider this object is attached to
    public void ArcReactorHit(ArcReactorHitInfo hitInfo)
    {
        SingleLaserHit hit;

        if (allLaserHits.TryGetValue(hitInfo.launcher, out hit))
        {
            DoHitContinue(hit, hitInfo);
        }
        else
        {
            DoHitStart(hitInfo);
        }
    }
	public void ArcReactorReflection(ArcReactorHitInfo hit)
	{
		//Debug.Log(hit.raycastHit.transform.gameObject.name);
		mirrorHit = true;

		temperature = Mathf.Clamp01(temperature + heatRate * Time.deltaTime);

		if (!partSystem.activeSelf)
			partSystem.SetActive(true);

		if (!partSystem.GetComponent<ParticleSystem>().enableEmission)
			partSystem.GetComponent<ParticleSystem>().enableEmission = true;

		partSystem.transform.position = hit.raycastHit.point;
		partSystem.transform.LookAt(hit.raycastHit.point + hit.raycastHit.normal);
	}
 //Invoked from the ArcReactor system whenever a laser hits the collider this object is attached to
 public void ArcReactorHit(ArcReactorHitInfo hitInfo)
 {
     hitThisFrame = true;
     if (!hitLastFrame)
     {
         DoHitStart(hitInfo);
     }
     else
     {
         //send all modules updated hitInfo
         foreach (LaserModule module in laserModules)
         {
             if (module.IsEnabled)
             {
                 module.DoHitContinue(hitInfo);
             }
         }
     }
 }
    public void ArcReactorReflection(ArcReactorHitInfo hit)
    {
        //Debug.Log(hit.raycastHit.transform.gameObject.name);
        mirrorHit = true;

        temperature = Mathf.Clamp01(temperature + heatRate * Time.deltaTime);

        if (!partSystem.activeSelf)
        {
            partSystem.SetActive(true);
        }

        if (!particleSystem0.enableEmission)
        {
            particleSystem0.enableEmission = true;
        }

        partSystem.transform.position = hit.raycastHit.point;
        partSystem.transform.LookAt(hit.raycastHit.point + hit.raycastHit.normal);
    }
Exemple #9
0
 public virtual void DoHitStart(ArcReactorHitInfo hitInfo)
 {
 }
 public override void DoHitContinue(ArcReactorHitInfo hit)
 {
     //Update the hit position of the particle effect
     hitParticles.transform.position = hit.raycastHit.point;
     hitParticles.transform.LookAt(hit.raycastHit.point + hit.raycastHit.normal);
 }
 void ArcReactorTouch(ArcReactorHitInfo hitInfo)
 {
     Debug.Log(hitInfo.raycastHit.point);
 }
Exemple #12
0
 public override void DoHitStart(ArcReactorHitInfo hitInfo)
 {
     source = (LaserSnapFrom)hitInfo.launcher;
     source.StartSnap(this);
 }
Exemple #13
0
	// Update is called once per frame
	void LateUpdate () 
	{
		for (int x = 0; x < rays.Count; x++)
		{
			if (rays[x].arc == null)
			{
				destrArr.Add(rays[x]);			
			}
			else
			{
				rays[x].distance = Mathf.Clamp(rays[x].distance + PropagationSpeed * Time.deltaTime,0,Distance);
				Vector3 endPos = Vector3.zero;
				switch (reflectionSettings.reflections)
				{
				case ReflectSettings.no_reflections:
					if (startBehaviour == RayTransformBehaivour.follow_raycast)
					{
						if (Physics.Raycast(transform.position,-transform.forward,out hit,rays[x].distance,layers.value))
						{
							if (SendMessageToHitObjects)
							{
								ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
								arcHit.launcher = this;
								arcHit.rayInfo = rays[x];
								arcHit.raycastHit = hit;
								hit.transform.gameObject.SendMessage("ArcReactorHit",arcHit,SendMessageOptions.DontRequireReceiver);
							}
							if (SendMessageToTouchedObjects)
							{
								RaycastHit[] hits;
								hits = Physics.RaycastAll(transform.position,-transform.forward, Vector3.Distance(transform.position,hit.point), touchLayers);			
								foreach (RaycastHit touchHit in hits)
								{
									ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
									arcHit.launcher = this;
									arcHit.rayInfo = rays[x];
									arcHit.raycastHit = touchHit;
									touchHit.transform.gameObject.SendMessage("ArcReactorTouch",arcHit,SendMessageOptions.DontRequireReceiver);
								}
							}
							rays[x].startObject = hit.transform.gameObject;
							rays[x].shape[0].position = transform.position + (transform.position - hit.point).normalized * (float)((transform.position - hit.point).magnitude - 0.05);
						}
						else
						{
							if (SendMessageToTouchedObjects)
							{
								RaycastHit[] hits;
								hits = Physics.RaycastAll(transform.position,-transform.forward, rays[x].distance, touchLayers);			
								foreach (RaycastHit touchHit in hits)
								{
									ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
									arcHit.launcher = this;
									arcHit.rayInfo = rays[x];
									arcHit.raycastHit = touchHit;
									touchHit.transform.gameObject.SendMessage("ArcReactorTouch",arcHit,SendMessageOptions.DontRequireReceiver);
								}
							}
							rays[x].startObject = null;
							rays[x].shape[0].position = transform.position - transform.forward * rays[x].distance;
						}
					}
					if (endBehaviour == RayTransformBehaivour.follow_raycast)
					{
						if (Physics.Raycast(transform.position,transform.forward,out hit,rays[x].distance,layers.value))
						{
							if (SendMessageToHitObjects)
							{
								ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
								arcHit.launcher = this;
								arcHit.rayInfo = rays[x];
								arcHit.raycastHit = hit;
								hit.transform.gameObject.SendMessage("ArcReactorHit",arcHit,SendMessageOptions.DontRequireReceiver);
							}

							if (SendMessageToTouchedObjects)
							{
								RaycastHit[] hits;
								hits = Physics.RaycastAll(transform.position,transform.forward, Vector3.Distance(transform.position,hit.point), touchLayers);			
								foreach (RaycastHit touchHit in hits)
								{
									ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
									arcHit.launcher = this;
									arcHit.rayInfo = rays[x];
									arcHit.raycastHit = touchHit;
									touchHit.transform.gameObject.SendMessage("ArcReactorTouch",arcHit,SendMessageOptions.DontRequireReceiver);
								}
							}

							rays[x].endObject = hit.transform.gameObject;
							endPos = transform.position + (hit.point - transform.position).normalized * (float)((hit.point - transform.position).magnitude - 0.05);
							//endPos = hit.point;
						}
						else
						{
							if (SendMessageToTouchedObjects)
							{
								RaycastHit[] hits;
								hits = Physics.RaycastAll(transform.position,transform.forward, rays[x].distance, touchLayers);			
								foreach (RaycastHit touchHit in hits)
								{
									ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
									arcHit.launcher = this;
									arcHit.rayInfo = rays[x];
									arcHit.raycastHit = touchHit;
									touchHit.transform.gameObject.SendMessage("ArcReactorTouch",arcHit,SendMessageOptions.DontRequireReceiver);
								}
							}
							rays[x].endObject = null;
							endPos = transform.position + transform.forward * rays[x].distance;
						}
					}
					else
					{
						endPos = rays[x].shape[rays[x].shape.Length-1].position;
					}
					switch (rayInertiaSettings.type)
					{
					case InertiaMethod.none:
						rays[x].shape[rays[x].shape.Length-1].position = endPos;
						break;
					case InertiaMethod.linespeed:
						int transformCount = rays[x].shape.Length;
						Vector3 targetPos;
						for (int i = 1; i < transformCount; i++)
						{
							targetPos = Vector3.Lerp(rays[x].shape[0].position,endPos,(float)i/(transformCount-1));
							rays[x].shape[i].position = Vector3.MoveTowards(rays[x].shape[i].position,targetPos,
							                                              rayInertiaSettings.speed *  rayInertiaSettings.snapbackForceCurve.Evaluate(Vector3.Distance(rays[x].shape[i].position,targetPos) / rayInertiaSettings.maxSnapBackDistance) *  Time.deltaTime);
						}
						break;
					}
					break;
				case ReflectSettings.reflect_by_layer:
				case ReflectSettings.reflect_specified_objects:
					int posNum;
					GameObject obj;

					if (startBehaviour == RayTransformBehaivour.follow_raycast)
					{
						posArrayLen = 0;
						FillPosArray(transform.position,-transform.forward,rays[x].distance,rays[x]);
						for (int i = 0; i < posArrayLen; i++)
						{
							positions[i] = posArray[i];
						}
						posNum = posArrayLen;
					}
					else
					{
						posNum = 1;
						positions[0] = rays[x].shape[0].position;
					}

					if (endBehaviour == RayTransformBehaivour.follow_raycast)
					{
						posArrayLen = 0;
						FillPosArray(transform.position,transform.forward,rays[x].distance,rays[x]);
						for (int i = 0; i < posArrayLen; i++)
						{
							positions[posNum + i] = posArray[i];
						}
						posNum += posArrayLen;
					}
					else
					{
						positions[posNum] = rays[x].shape[rays[x].shape.Length-1].position;
						posNum++;
					}
					if (rays[x].shape.Length == posNum)
					{
					}
					if (rays[x].shape.Length > posNum)
					{
						for (int i = posNum-1; i < rays[x].shape.Length-1; i++)
							GameObject.Destroy(rays[x].shape[i].gameObject);
						rays[x].shape[posNum-1] = rays[x].shape[rays[x].shape.Length-1];
						Array.Resize(ref rays[x].shape,posNum);

					}
					if (rays[x].shape.Length < posNum)
					{
						int oldSize = rays[x].shape.Length;
						Array.Resize(ref rays[x].shape, posNum);
						rays[x].shape[rays[x].shape.Length-1] = rays[x].shape[oldSize-1];
						for (int i = oldSize-1; i < posNum-1; i++)						
						{
							obj = new GameObject("RayPoint" + (i+1).ToString());
							obj.transform.parent = globalSpaceTransform;
							rays[x].shape[i] = obj.transform;
						}
					}
					for (int i = 0; i < posNum; i++)
						rays[x].shape[i].position = positions[i];
					rays[x].arc.shapeTransforms = rays[x].shape;
					break;
				}
			}
		}
		for (int x = 0; x < destrArr.Count; x++)
		{
			foreach (Transform tr in destrArr[x].shape)
				GameObject.Destroy(tr.gameObject);
			rays.RemoveAt(x);
		}
		if (destrArr.Count > 0)
			destrArr.Clear();
	}
Exemple #14
0
	protected void FillPosArray(Vector3 position, Vector3 direction, float maxDistance,RayInfo rayInfo)
	{
		RaycastHit hit = new RaycastHit();
		if (Physics.Raycast(position,direction,out hit,maxDistance,layers.value | reflectionSettings.reflectLayers.value))
		{
			if (SendMessageToHitObjects)
			{
				ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
				arcHit.launcher = this;
				arcHit.rayInfo = rayInfo;
				arcHit.raycastHit = hit;
				hit.transform.gameObject.SendMessage("ArcReactorHit",arcHit,SendMessageOptions.DontRequireReceiver);
			}

			posArray[posArrayLen] = hit.point;
			posArrayLen++;

			if (SendMessageToTouchedObjects)
			{
				RaycastHit[] hits;
				hits = Physics.RaycastAll(position, direction, Vector3.Distance(position,hit.point), touchLayers);			
				foreach (RaycastHit touchHit in hits)
				{
					ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
					arcHit.launcher = this;
					arcHit.rayInfo = rayInfo;
					arcHit.raycastHit = touchHit;
					touchHit.transform.gameObject.SendMessage("ArcReactorTouch",arcHit,SendMessageOptions.DontRequireReceiver);
				}
			}

			if ((reflectionSettings.reflections == ReflectSettings.reflect_by_layer || CheckReflectObject(hit.transform))
			    && (reflectionSettings.reflectLayers.value & 1 << hit.transform.gameObject.layer) > 0)
			{
				if (reflectionSettings.sendMessageToReflectors)
				{
					ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
					arcHit.launcher = this;
					arcHit.rayInfo = rayInfo;
					arcHit.raycastHit = hit;
					hit.transform.gameObject.SendMessage("ArcReactorReflection",arcHit,SendMessageOptions.DontRequireReceiver);
				}
				FillPosArray(hit.point + hit.normal * reflectionSettings.thickness,Vector3.Reflect(direction, hit.normal), maxDistance - Vector3.Distance(position,hit.point),rayInfo );
			}
		}
		else
		{
			if (SendMessageToTouchedObjects)
			{
				RaycastHit[] hits;
				hits = Physics.RaycastAll(position, direction, maxDistance, touchLayers);
				foreach (RaycastHit touchHit in hits)
				{
					ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
					arcHit.launcher = this;
					arcHit.rayInfo = rayInfo;
					arcHit.raycastHit = touchHit;
					touchHit.transform.gameObject.SendMessage("ArcReactorTouch",arcHit,SendMessageOptions.DontRequireReceiver);
				}
			}

			posArray[posArrayLen] = position + direction.normalized * maxDistance;
			posArrayLen++;
		}
	}
Exemple #15
0
 public override void OnLaserEnter(LaserDiffuser laserDiffuser, ArcReactorHitInfo hitInfo)
 {
     TunnelRunnerCompleteScreen.controller.PopDisplayAndReload();
 }
Exemple #16
0
 //Called when a new laser hit is detected
 public override void DoHitStart(ArcReactorHitInfo hit)
 {
     heating = true;
     StartCoroutine(HeatUpObject());
 }
 //Called when a laser hits the ball - the reaction is processed in the transform
 public override void DoHitStart(ArcReactorHitInfo hitInfo)
 {
     base.DoHitStart(hitInfo);
     transformController.currentTransform.OnLaserEnter(laserDiffuser, hitInfo);
 }
Exemple #18
0
    protected void FillPosArray(Vector3 position, Vector3 direction, float maxDistance, RayInfo rayInfo)
    {
        RaycastHit hit = new RaycastHit();

        if (Physics.Raycast(position, direction, out hit, maxDistance, layers.value | reflectionSettings.reflectLayers.value))
        {
            if (SendMessageToHitObjects)
            {
                ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
                arcHit.launcher   = this;
                arcHit.rayInfo    = rayInfo;
                arcHit.raycastHit = hit;
                hit.transform.gameObject.SendMessage("ArcReactorHit", arcHit, SendMessageOptions.DontRequireReceiver);
            }

            posArray[posArrayLen] = hit.point;
            posArrayLen++;

            if (SendMessageToTouchedObjects)
            {
                RaycastHit[] hits;
                hits = Physics.RaycastAll(position, direction, Vector3.Distance(position, hit.point), touchLayers);
                foreach (RaycastHit touchHit in hits)
                {
                    ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
                    arcHit.launcher   = this;
                    arcHit.rayInfo    = rayInfo;
                    arcHit.raycastHit = touchHit;
                    touchHit.transform.gameObject.SendMessage("ArcReactorTouch", arcHit, SendMessageOptions.DontRequireReceiver);
                }
            }

            if ((reflectionSettings.reflections == ReflectSettings.reflect_by_layer || CheckReflectObject(hit.transform)) &&
                (reflectionSettings.reflectLayers.value & 1 << hit.transform.gameObject.layer) > 0)
            {
                if (reflectionSettings.sendMessageToReflectors)
                {
                    ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
                    arcHit.launcher   = this;
                    arcHit.rayInfo    = rayInfo;
                    arcHit.raycastHit = hit;
                    hit.transform.gameObject.SendMessage("ArcReactorReflection", arcHit, SendMessageOptions.DontRequireReceiver);
                }
                FillPosArray(hit.point + hit.normal * reflectionSettings.thickness, Vector3.Reflect(direction, hit.normal), maxDistance - Vector3.Distance(position, hit.point), rayInfo);
            }
        }
        else
        {
            if (SendMessageToTouchedObjects)
            {
                RaycastHit[] hits;
                hits = Physics.RaycastAll(position, direction, maxDistance, touchLayers);
                foreach (RaycastHit touchHit in hits)
                {
                    ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
                    arcHit.launcher   = this;
                    arcHit.rayInfo    = rayInfo;
                    arcHit.raycastHit = touchHit;
                    touchHit.transform.gameObject.SendMessage("ArcReactorTouch", arcHit, SendMessageOptions.DontRequireReceiver);
                }
            }

            posArray[posArrayLen] = position + direction.normalized * maxDistance;
            posArrayLen++;
        }
    }
Exemple #19
0
 private void DoHitContinue(SingleLaserHit existingHit, ArcReactorHitInfo hit)
 {
     existingHit.particles.transform.position = hit.raycastHit.point;
     existingHit.particles.transform.LookAt(hit.raycastHit.point + hit.raycastHit.normal);
     existingHit.hitThisFrame = true;
 }
Exemple #20
0
 public override void DoHitStart(ArcReactorHitInfo hitInfo)
 {
     laserSwitch.OnLaserEnter();
 }
	void ArcReactorTouch (ArcReactorHitInfo hitInfo)
	{
		Debug.Log(hitInfo.raycastHit.point);
	}
Exemple #22
0
 public virtual void OnLaserEnter(LaserDiffuser laserDiffuser, ArcReactorHitInfo hitInfo)
 {
     laserDiffuser.GetComponentInParent <BallDestroyer>().Pop();
 }
Exemple #23
0
 public virtual void DoHitContinue(ArcReactorHitInfo hitInfo)
 {
 }
Exemple #24
0
    // Update is called once per frame
    void LateUpdate()
    {
        RaycastHit     hit      = new RaycastHit();
        List <RayInfo> destrArr = new List <RayInfo>();

        foreach (RayInfo rinfo in rays)
        {
            if (rinfo.arc == null)
            {
                destrArr.Add(rinfo);
            }
            else
            {
                rinfo.distance = Mathf.Clamp(rinfo.distance + PropagationSpeed * Time.deltaTime, 0, Distance);
                Vector3 endPos = Vector3.zero;
                switch (reflectionSettings.reflections)
                {
                case ReflectSettings.no_reflections:
                    if (startBehaviour == RayTransformBehaivour.follow_raycast)
                    {
                        if (Physics.Raycast(transform.position, -transform.forward, out hit, rinfo.distance, layers.value))
                        {
                            if (SendMessageToHitObjects)
                            {
                                ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
                                arcHit.launcher   = this;
                                arcHit.rayInfo    = rinfo;
                                arcHit.raycastHit = hit;
                                hit.transform.gameObject.SendMessage("ArcReactorHit", arcHit, SendMessageOptions.DontRequireReceiver);
                            }
                            if (SendMessageToTouchedObjects)
                            {
                                RaycastHit[] hits;
                                hits = Physics.RaycastAll(transform.position, -transform.forward, Vector3.Distance(transform.position, hit.point), touchLayers);
                                foreach (RaycastHit touchHit in hits)
                                {
                                    ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
                                    arcHit.launcher   = this;
                                    arcHit.rayInfo    = rinfo;
                                    arcHit.raycastHit = touchHit;
                                    touchHit.transform.gameObject.SendMessage("ArcReactorTouch", arcHit, SendMessageOptions.DontRequireReceiver);
                                }
                            }
                            rinfo.startObject       = hit.transform.gameObject;
                            rinfo.shape[0].position = transform.position + (transform.position - hit.point).normalized * (float)((transform.position - hit.point).magnitude - 0.05);
                        }
                        else
                        {
                            if (SendMessageToTouchedObjects)
                            {
                                RaycastHit[] hits;
                                hits = Physics.RaycastAll(transform.position, -transform.forward, rinfo.distance, touchLayers);
                                foreach (RaycastHit touchHit in hits)
                                {
                                    ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
                                    arcHit.launcher   = this;
                                    arcHit.rayInfo    = rinfo;
                                    arcHit.raycastHit = touchHit;
                                    touchHit.transform.gameObject.SendMessage("ArcReactorTouch", arcHit, SendMessageOptions.DontRequireReceiver);
                                }
                            }
                            rinfo.startObject       = null;
                            rinfo.shape[0].position = transform.position - transform.forward * rinfo.distance;
                        }
                    }
                    if (endBehaviour == RayTransformBehaivour.follow_raycast)
                    {
                        if (Physics.Raycast(transform.position, transform.forward, out hit, rinfo.distance, layers.value))
                        {
                            if (SendMessageToHitObjects)
                            {
                                ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
                                arcHit.launcher   = this;
                                arcHit.rayInfo    = rinfo;
                                arcHit.raycastHit = hit;
                                hit.transform.gameObject.SendMessage("ArcReactorHit", arcHit, SendMessageOptions.DontRequireReceiver);
                            }

                            if (SendMessageToTouchedObjects)
                            {
                                RaycastHit[] hits;
                                hits = Physics.RaycastAll(transform.position, transform.forward, Vector3.Distance(transform.position, hit.point), touchLayers);
                                foreach (RaycastHit touchHit in hits)
                                {
                                    ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
                                    arcHit.launcher   = this;
                                    arcHit.rayInfo    = rinfo;
                                    arcHit.raycastHit = touchHit;
                                    touchHit.transform.gameObject.SendMessage("ArcReactorTouch", arcHit, SendMessageOptions.DontRequireReceiver);
                                }
                            }

                            rinfo.endObject = hit.transform.gameObject;
                            endPos          = transform.position + (hit.point - transform.position).normalized * (float)((hit.point - transform.position).magnitude - 0.05);
                            //endPos = hit.point;
                        }
                        else
                        {
                            if (SendMessageToTouchedObjects)
                            {
                                RaycastHit[] hits;
                                hits = Physics.RaycastAll(transform.position, transform.forward, rinfo.distance, touchLayers);
                                foreach (RaycastHit touchHit in hits)
                                {
                                    ArcReactorHitInfo arcHit = new ArcReactorHitInfo();
                                    arcHit.launcher   = this;
                                    arcHit.rayInfo    = rinfo;
                                    arcHit.raycastHit = touchHit;
                                    touchHit.transform.gameObject.SendMessage("ArcReactorTouch", arcHit, SendMessageOptions.DontRequireReceiver);
                                }
                            }
                            rinfo.endObject = null;
                            endPos          = transform.position + transform.forward * rinfo.distance;
                        }
                    }
                    else
                    {
                        endPos = rinfo.shape[rinfo.shape.Length - 1].position;
                    }
                    switch (rayInertiaSettings.type)
                    {
                    case InertiaMethod.none:
                        rinfo.shape[rinfo.shape.Length - 1].position = endPos;
                        break;

                    case InertiaMethod.linespeed:
                        int     transformCount = rinfo.shape.Length;
                        Vector3 targetPos;
                        for (int i = 1; i < transformCount; i++)
                        {
                            targetPos = Vector3.Lerp(rinfo.shape[0].position, endPos, (float)i / (transformCount - 1));
                            rinfo.shape[i].position = Vector3.MoveTowards(rinfo.shape[i].position, targetPos,
                                                                          rayInertiaSettings.speed * rayInertiaSettings.snapbackForceCurve.Evaluate(Vector3.Distance(rinfo.shape[i].position, targetPos) / rayInertiaSettings.maxSnapBackDistance) * Time.deltaTime);
                        }
                        break;
                    }
                    break;

                case ReflectSettings.reflect_by_layer:
                case ReflectSettings.reflect_specified_objects:
                    int        posNum;
                    GameObject obj;

                    if (startBehaviour == RayTransformBehaivour.follow_raycast)
                    {
                        posArrayLen = 0;
                        FillPosArray(transform.position, -transform.forward, rinfo.distance, rinfo);
                        for (int i = 0; i < posArrayLen; i++)
                        {
                            positions[i] = posArray[i];
                        }
                        posNum = posArrayLen;
                    }
                    else
                    {
                        posNum       = 1;
                        positions[0] = rinfo.shape[0].position;
                    }

                    if (endBehaviour == RayTransformBehaivour.follow_raycast)
                    {
                        posArrayLen = 0;
                        FillPosArray(transform.position, transform.forward, rinfo.distance, rinfo);
                        for (int i = 0; i < posArrayLen; i++)
                        {
                            positions[posNum + i] = posArray[i];
                        }
                        posNum += posArrayLen;
                    }
                    else
                    {
                        positions[posNum] = rinfo.shape[rinfo.shape.Length - 1].position;
                        posNum++;
                    }
                    if (rinfo.shape.Length == posNum)
                    {
                    }
                    if (rinfo.shape.Length > posNum)
                    {
                        for (int i = posNum - 1; i < rinfo.shape.Length - 1; i++)
                        {
                            GameObject.Destroy(rinfo.shape[i].gameObject);
                        }
                        rinfo.shape[posNum - 1] = rinfo.shape[rinfo.shape.Length - 1];
                        Array.Resize(ref rinfo.shape, posNum);
                    }
                    if (rinfo.shape.Length < posNum)
                    {
                        int oldSize = rinfo.shape.Length;
                        Array.Resize(ref rinfo.shape, posNum);
                        rinfo.shape[rinfo.shape.Length - 1] = rinfo.shape[oldSize - 1];
                        for (int i = oldSize - 1; i < posNum - 1; i++)
                        {
                            obj = new GameObject("RayPoint" + (i + 1).ToString());
                            obj.transform.parent = globalSpaceTransform;
                            rinfo.shape[i]       = obj.transform;
                        }
                    }
                    for (int i = 0; i < posNum; i++)
                    {
                        rinfo.shape[i].position = positions[i];
                    }
                    rinfo.arc.shapeTransforms = rinfo.shape;
                    break;
                }
            }
        }
        foreach (RayInfo rinfo in destrArr)
        {
            foreach (Transform tr in rinfo.shape)
            {
                GameObject.Destroy(tr.gameObject);
            }
            rays.Remove(rinfo);
        }
    }
 public void Diffuse(ArcReactorHitInfo hit)
 {
     //Launch a new ray and set it to the same lifecycle stage as the source ray so that they will appear as one continuous ray
     this.LaunchRay();
     this.rays [0].arc.elapsedTime = hit.rayInfo.arc.elapsedTime;
 }