void FixedUpdate()
 {
     RaycastHit hit;
     if (warningInstance == null && Physics.Raycast (transform.position, transform.forward, out hit, kWarningDistance, warningBase))
     // If we haven't detected impact yet and we now do, spawn an impact warning and store its reference
     {
         warningInstance = demoControl.SpawnWarning (hit.point, Quaternion.identity);
     }
 }
示例#2
0
    void FixedUpdate()
    {
        RaycastHit hit;

        if (warningInstance == null && Physics.Raycast(transform.position, transform.forward, out hit, kWarningDistance, warningBase))
        // If we haven't detected impact yet and we now do, spawn an impact warning and store its reference
        {
            warningInstance = demoControl.SpawnWarning(hit.point, Quaternion.identity);
        }
    }
示例#3
0
    // Disable the given impact warning and move it back into the object pool
    public void DespawnWarning(ImpactWarning warning)
    {
        if (warning == null)
        {
            return;
        }

        warning.gameObject.SetActiveRecursively (false);
        warningPool.Enqueue (warning);
    }
示例#4
0
    public void DespawnWarning(ImpactWarning warning)
    // Disable the given impact warning and move it back into the object pool
    {
        if (warning == null)
        {
            return;
        }

        warning.gameObject.SetActiveRecursively(false);
        warningPool.Enqueue(warning);
    }
示例#5
0
    public ImpactWarning SpawnWarning(Vector3 position, Quaternion rotation)
    // Grab an impact warning from the object pool and activate it with the given position and rotation
    {
        if (warningPool.Count < 1)
        {
            return(null);
        }

        ImpactWarning warning = warningPool.Dequeue();

        warning.transform.position = position;
        warning.transform.rotation = rotation;
        warning.gameObject.SetActiveRecursively(true);

        return(warning);
    }
示例#6
0
 void OnDisable()
 {
     warningInstance = null;
     emitter.ClearParticles();
 }
 void OnDisable()
 {
     warningInstance = null;
     emitter.ClearParticles ();
 }