Example #1
0
    void OnTriggerEnter(Collider other)
    {
        if ((mIsActivated == Fisher.ActivatedState.NotActivated) && (other != null) && ((other.CompareTag(Fisher.ConnectedTag) == true) || (other.CompareTag(Fisher.UnconnectedTag) == true)))
        {
            // Activate this target
            mIsActivated = Fisher.ActivatedState.PermanentlyActivated;
            particles.Emit();
            targetMesh.enabled     = false;
            connectionLine.enabled = false;

            // Check if we need to enable the goal
            ++msNumTriggeredTargets;
            if (msNumTriggeredTargets >= msNumTargets)
            {
                Goal.IsEnabled = true;
                if ((goalEnabledSound != null) && (Fisher.Instance.soundEffectAudio != null))
                {
                    Fisher.Instance.soundEffectAudio.PlayOneShot(goalEnabledSound);
                }
            }
            else if ((triggerSound != null) && (Fisher.Instance.soundEffectAudio != null))
            {
                Fisher.Instance.soundEffectAudio.PlayOneShot(triggerSound);
            }
        }
    }
Example #2
0
 void FixedUpdate()
 {
     if (fanBlades != null)
     {
         // Check if this fan is permanently activated
         if (mIsActivated == Fisher.ActivatedState.PermanentlyActivated)
         {
             // If it is, keep spinning
             fanBlades.AddRelativeTorque(mSpinTorque);
         }
         else
         {
             // Check if the blade speed exceeds activation
             mIsActivated = Fisher.ActivatedState.NotActivated;
             if (FanBladeSpeed > activateSpeed)
             {
                 // Check if we should permanently activated
                 mIsActivated = Fisher.ActivatedState.TemporarilyActivated;
                 if (stayActivated == true)
                 {
                     // Setup the torque speed
                     mIsActivated = Fisher.ActivatedState.PermanentlyActivated;
                     mSpinTorque  = fanBlades.angularVelocity;
                     mSpinTorque.Normalize();
                     mSpinTorque *= permanentSpeed;
                 }
             }
         }
     }
 }