示例#1
0
    void Awake()
    {
        NotificationCentre.AddObserver(this, "OnBGMFadeIn");
        NotificationCentre.AddObserver(this, "OnBGMFadeOut");
        NotificationCentre.AddObserver(this, "DisplayHowToPlay");
        NotificationCentre.AddObserver(this, "OnHoldingGunHigh");
        NotificationCentre.AddObserver(this, "OnBattleBGM");
        NotificationCentre.AddObserver(this, "OnSFXSwift");
        NotificationCentre.AddObserver(this, "OnSFXVFX1");
        NotificationCentre.AddObserver(this, "OnSFXVFX2");
        NotificationCentre.AddObserver(this, "OnMonsterCry");
        NotificationCentre.AddObserver(this, "OnExclamation");
        NotificationCentre.AddObserver(this, "OnQuestion");
        NotificationCentre.AddObserver(this, "OnPauseEnter");
        NotificationCentre.AddObserver(this, "OnPauseExit");
        NotificationCentre.AddObserver(this, "OnCrosshairAppear");
        NotificationCentre.AddObserver(this, "OnCannonFire");
        NotificationCentre.AddObserver(this, "OnGooey1");
        NotificationCentre.AddObserver(this, "OnGooey2");
        NotificationCentre.AddObserver(this, "OnZombunnyLaugh");
        NotificationCentre.AddObserver(this, "OnMissionClear");
        NotificationCentre.AddObserver(this, "OnIgniteCannon");
        NotificationCentre.AddObserver(this, "OnPlayerDeath");

        src   = GetComponent <AudioSource> ();
        one   = gameObject.AddComponent <AudioSource> () as AudioSource;
        pause = gameObject.AddComponent <AudioSource> () as AudioSource;

        InitializeAudioSource(one);
        InitializeAudioSource(pause);
        pause.ignoreListenerVolume = true;
    }
示例#2
0
    void Awake()
    {
        /**
         *  Won't throw error even if it doesn't exist.
         */
        player = GameObject.FindWithTag("Player").transform;

        /**
         *  Will throw error if they don't exist.
         */
        nav       = GetComponent <NavMeshAgent> ();
        animator  = GetComponent <Animator> ();
        rigidBody = GetComponent <Rigidbody> ();
        hitBox    = GetComponentInChildren <EnemyHitBox> ();
        myHealth  = GetComponent <EnemyHealth> ();

        timer      = 0f;
        attackEnd  = false;
        isDead     = false;
        isGameOver = false;

        audioSrc             = gameObject.AddComponent <AudioSource> ();
        audioSrc.playOnAwake = false;
        audioSrc.loop        = false;

        // Stay idle when player die.
        NotificationCentre.AddObserver(this, "OnPlayerDeath");

        // Reassign player object when new one is created.
        NotificationCentre.AddObserver(this, "OnUpdatePlayer");
    }
示例#3
0
    void Awake()
    {
        NotificationCentre.AddObserver(this, "OnNewGame");
        NotificationCentre.AddObserver(this, "OnQuit");

        cg = GetComponent <CanvasGroup> ();
    }
示例#4
0
    void Awake()
    {
        NotificationCentre.AddObserver(this, "OnEnemyAppear");
        NotificationCentre.AddObserver(this, "OnZombunnyAppear");

        if (vfxcam)
        {
            vfxcam.SetActive(false);
        }
        if (splashEffect)
        {
            splashEffect.SetActive(false);
        }
        if (splashEffect2)
        {
            splashEffect2.SetActive(false);
        }
        if (splashEffect3)
        {
            splashEffect3.SetActive(false);
        }
        if (textZombunny)
        {
            textZombunny.SetActive(false);
        }
        if (textZombear)
        {
            textZombear.SetActive(false);
        }
    }
示例#5
0
    void Awake()
    {
        icon = GetComponent <Image> ();

        NotificationCentre.AddObserver(this, "OnLoading");
        NotificationCentre.AddObserver(this, "OnFinishLoading");
    }
示例#6
0
    void Awake()
    {
        NotificationCentre.AddObserver(this, "OnIntroEvent");
        NotificationCentre.AddObserver(this, "OnIntroEventExit");
        NotificationCentre.AddObserver(this, "OnPickUpGun");
        NotificationCentre.AddObserver(this, "OnHoldingGunHigh");
        NotificationCentre.AddObserver(this, "OnPlayerActivate");
        NotificationCentre.AddObserver(this, "OnEnemyAppear");
        NotificationCentre.AddObserver(this, "OnBattleBegin");
        NotificationCentre.AddObserver(this, "OnZoomInCannon");
        NotificationCentre.AddObserver(this, "OnCameraNormalize");
        NotificationCentre.AddObserver(this, "OnUpdatePlayer");

        player = GameObject.FindWithTag("Player");
        pe     = GameObject.FindWithTag("PlayerEvent");

        cam = GameObject.FindWithTag("MainCamera").GetComponent <CameraMovement> ();
        if (cam)
        {
            cam.gameObject.SetActive(true);
            cam.SetCameraOffset(new Vector3(0, 5, -7));
            cam.SetCameraTarget(player);
            cam.SetCameraFollow(true);
            SetCamPosRot(new Vector3(0, 6, -7), new Vector3(40, 0, 0));
        }
    }
示例#7
0
    void Awake()
    {
        // Set max number of enemies allowed.
        SSGlobals.MAX_NUM_ENEMY = 30;

        spawnPoints = GetComponentsInChildren <EnemySpawn> ();

        NotificationCentre.AddObserver(this, "OnEnemyAppear");
        NotificationCentre.AddObserver(this, "OnZombearAppear");
        NotificationCentre.AddObserver(this, "OnPanOut");
        NotificationCentre.AddObserver(this, "OnBattleBegin");
        NotificationCentre.AddObserver(this, "ReportEnemyDeath");
        NotificationCentre.AddObserver(this, "OnPlayerDeath");
        NotificationCentre.AddObserver(this, "OnNaturalSpawn");
        NotificationCentre.AddObserver(this, "OnResumeFromCheckpoint");

        if (zombunny)
        {
            zombunny.gameObject.SetActive(false);
        }
        if (zombear)
        {
            zombear.gameObject.SetActive(false);
        }
    }
示例#8
0
    void Awake()
    {
        Initialize();

        NotificationCentre.AddObserver(this, "OnBlockInitialize");
        NotificationCentre.AddObserver(this, "OnBlockDestructible");
        NotificationCentre.AddObserver(this, "OnBlockIndestructible");
    }
示例#9
0
    void Awake()
    {
        NotificationCentre.AddObserver(this, "ActivateCannon");
        NotificationCentre.AddObserver(this, "DeactivateCannon");
        NotificationCentre.AddObserver(this, "OnEventEnter");
        NotificationCentre.AddObserver(this, "OnIgniteCannon");

        OnPutOutCannon();
    }
示例#10
0
    void Awake()
    {
        //
        // Force developers to fix bugs.
        //
        ExceptionHandler.SetupExceptionHandling();

        NotificationCentre.AddObserver(this, "OnGameOver");
    }
示例#11
0
    void Awake()
    {
        floorMask = LayerMask.GetMask("Floor");
        animator  = GetComponent <Animator>();
        rigidBody = GetComponent <Rigidbody>();

        NotificationCentre.AddObserver(this, "OnEventEnter");
        NotificationCentre.AddObserver(this, "OnEventExit");
        NotificationCentre.AddObserver(this, "OnPlayerDeath");
    }
示例#12
0
    void Awake()
    {
        cg       = GetComponent <CanvasGroup> ();
        cg.alpha = 0;

        coroutine = null;

        NotificationCentre.AddObserver(this, "DisplayHowToPlay");
        NotificationCentre.AddObserver(this, "HideHowToPlay");
        NotificationCentre.AddObserver(this, "Continue");
    }
示例#13
0
    void Awake()
    {
        img           = GetComponent <Image> ();
        lastCoroutine = null;

        // Register on Awake so you won't miss any early notification.
        NotificationCentre.AddObserver(this, "OnNewGame");
        NotificationCentre.AddObserver(this, "OnIntroEvent");
        NotificationCentre.AddObserver(this, "OnFadeIn");
        NotificationCentre.AddObserver(this, "OnFadeOut");
    }
示例#14
0
    void Awake()
    {
        NotificationCentre.AddObserver(this, "PauseAllow");
        NotificationCentre.AddObserver(this, "PauseDisallow");
        NotificationCentre.AddObserver(this, "Pause");
        NotificationCentre.AddObserver(this, "PressEnterToContinue");

        pauseAllowed         = false;
        paused               = false;
        pressEnterToContinue = false;
    }
示例#15
0
    void Awake()
    {
        NotificationCentre.AddObserver(this, "OnIntroEvent");
        NotificationCentre.AddObserver(this, "OnEnemyRushOver");
        NotificationCentre.AddObserver(this, "OnActivateFlammableBlock");
        NotificationCentre.AddObserver(this, "OnResumeFromCheckpoint");

        if (flammableBlock)
        {
            flammableBlock.SetActive(false);
        }
    }
示例#16
0
    void Awake()
    {
        c = GetComponent <SphereCollider> ();
        eventTriggered = false;

        NotificationCentre.AddObserver(this, "OnIntroEvent");
        NotificationCentre.AddObserver(this, "OnHoldingGunHigh");
        NotificationCentre.AddObserver(this, "Continue");

        // Activate only in new game.
        SetActiveGun(false);
    }
示例#17
0
    void Awake()
    {
        canShoot             = true;
        shootableMask        = LayerMask.GetMask("Shootable", "Enemy");
        gunParticles         = GetComponent <ParticleSystem> ();
        gunLine              = GetComponent <LineRenderer> ();
        gunAudio             = gameObject.AddComponent <AudioSource> ();
        gunAudio.clip        = gunClip;
        gunAudio.playOnAwake = false;
        gunLight             = GetComponent <Light> ();

        NotificationCentre.AddObserver(this, "OnPlayerDeath");
    }
示例#18
0
    void Awake()
    {
        //NotificationCentre.AddObserver (this, "OnEventEnter");
        //NotificationCentre.AddObserver (this, "OnEventExit");
        NotificationCentre.AddObserver(this, "OnIntroEvent");
        NotificationCentre.AddObserver(this, "OnPlayerActivate");
        NotificationCentre.AddObserver(this, "OnBattleBegin");
        NotificationCentre.AddObserver(this, "OnEnemyRushOver");
        NotificationCentre.AddObserver(this, "OnEnemyRushOverExit");
        NotificationCentre.AddObserver(this, "OnResumeFromCheckpoint");

        GetPlayer();
    }
示例#19
0
    //private MeshRenderer [] meshes;
    //private SkinnedMeshRenderer [] skins;


    void Awake()
    {
        //NotificationCentre.AddObserver (this, "OnEventEnter");
        //NotificationCentre.AddObserver (this, "OnEventExit");
        NotificationCentre.AddObserver(this, "OnIntroEvent");
        NotificationCentre.AddObserver(this, "OnIntroEventCameraDone");
        NotificationCentre.AddObserver(this, "OnPickUpGun");
        NotificationCentre.AddObserver(this, "OnPlayerActivate");

        GetPlayer();
        if (pe)
        {
            pe.SetActive(false);
        }
    }
示例#20
0
    void Awake()
    {
        anim            = GetComponent <Animator> ();
        hitParticles    = GetComponentInChildren <ParticleSystem> ();
        capsuleCollider = GetComponent <CapsuleCollider> ();
        meshRenderer    = GetComponentInChildren <SkinnedMeshRenderer> ();

        currentHealth = startingHealth;

        enemyAudio             = gameObject.AddComponent <AudioSource> ();
        enemyAudio.loop        = false;
        enemyAudio.playOnAwake = false;

        // Listen to annihilation command, which instantly destroys all enemies.
        NotificationCentre.AddObserver(this, "OnDestroyAllEnemies");

        // Initialize AudioQueue
        AudioQueue.AddData(hurtClip, 0.1f);
        AudioQueue.AddData(deathClip, 0.1f);
    }
示例#21
0
    void Awake()
    {
        healthBar = GetComponent <Slider> ();

        healthBar.minValue = 0;
        healthBar.maxValue = maxHP;

        cGroup = GetComponent <CanvasGroup> ();

        playerSFX = GameObject.FindWithTag("Player").GetComponent <PlayerSFXManager> ();
        VFX       = GameObject.FindWithTag("VisualEffect").GetComponent <VFXManager> ();

        // Add invincibility. Player is invincible during event.
        NotificationCentre.AddObserver(this, "OnEventEnter");
        NotificationCentre.AddObserver(this, "OnEventExit");
        NotificationCentre.AddObserver(this, "OnResumeFromCheckpoint");
        invincible = false;

        Initialize();
    }
示例#22
0
 private void Awake()
 {
     NotificationCentre.AddObserver(this, "DisplayText");
     NotificationCentre.AddObserver(this, "HideText");
 }
示例#23
0
 void Awake()
 {
     NotificationCentre.AddObserver(this, "OnEventEnter");
 }
示例#24
0
 void Awake()
 {
     NotificationCentre.AddObserver(this, "OnPauseEnter");
     NotificationCentre.AddObserver(this, "OnPauseExit");
 }
示例#25
0
 void Awake()
 {
     NotificationCentre.AddObserver(this, "OnNewGame");
 }