コード例 #1
0
    // Use this for initialization
    void Start()
    {
        currentHealth = maxHealth;

        stateMachine     = GetComponent <StateMachine>();
        animator         = GetComponent <Animator>();
        noiseEmitter     = GetComponent <NoiseEmitter>();
        effectIndicators = GetComponentInChildren <EffectIndicatorController>();

        IsSelected = new ReactiveProperty <bool>();
        IsSelected.Subscribe(x => animator.SetBool("selected", x));

        legsAnimator = legsObject.GetComponent <Animator>();
        bodyAnimator = bodyObject.GetComponent <Animator>();
    }
コード例 #2
0
    private void OnParticleCollision(GameObject soundPulse)
    {
        if (soundPulse.tag == "SuspiciousSound")
        {
            NoiseEmitter suspectedNoise = soundPulse.GetComponent <NoiseEmitter>();
            Noise        detectedNoise  = suspectedNoise.noise;

            bool idRecognized = false;
            if (SoundIDs.Count > 0)
            {
                foreach (int soundID in SoundIDs)
                {
                    //  Debug.Log(soundID);
                    if (detectedNoise.noiseID == soundID)
                    {
                        idRecognized = true;
                    }
                }
            }
            if (idRecognized)
            {
                // Debug.Log("Noticed Same ID, Ignoring");
                return;
            }
            else
            {
                float detectedVolume = detectedNoise.volume;
                if (detectedVolume > threshold)
                {
                    patrolling = false;
                    SoundIDs.Enqueue(detectedNoise.noiseID);
                    timeSinceLastIDQueueRefresh = Time.time;
                    noisesDetected.Add(detectedNoise);
                    Debug.Log("Heard Something: Move to investigate");
                    Prioritize();
                }
            }
        }
    }
コード例 #3
0
ファイル: Rock.cs プロジェクト: zmiennoimienny/NinjaProject
 private void Awake()
 {
     noiseEmitter = gameObject.GetComponentInChildren <NoiseEmitter>();
 }