Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        slider = transform.Find("Slider").GetComponent <Slider>();
        boss   = GameObject.FindGameObjectWithTag("Boss").GetComponent <DestructibleByPlayer>();

        slider.maxValue = boss.lifePoints;
        slider.value    = boss.lifePoints;
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        fightStarted           = false;
        audioSource            = GetComponent <AudioSource>();
        boss                   = GameObject.FindGameObjectWithTag("Boss");
        bossFinalPosition      = boss.transform.position;
        bossShooting           = boss.GetComponent <EnemyShooting>();
        player                 = GameObject.FindGameObjectWithTag("Player");
        playerOriginalPosition = player.transform.position;
        ui               = GameObject.FindGameObjectWithTag("UI");
        mainLight        = GameObject.FindGameObjectWithTag("MainLight").GetComponent <Light>();
        bossLife         = boss.GetComponent <DestructibleByPlayer>();
        originalBossLife = bossLife.lifePoints;
        foxUI            = transform.Find("FoxUI").gameObject;

        foreach (GameObject shot in bossShooting.shots)
        {
            shot.transform.localScale = new Vector3(1f, 1f, 1f);
        }

        foxUI.SetActive(false);

        boss.transform.position = bossOriginalPosition;
        bossShooting.enabled    = false;
        player.GetComponent <PlayerShooting>().enabled = false;
        ui.SetActive(false);
        mainLightIntensity  = mainLight.intensity;
        mainLight.intensity = 0f;

        try
        {
            fox = GameManager.IsFoxMode();
        }
        catch (NullReferenceException e)
        {
            fox = false;
        }

        audioSource.clip = fox ? introFox : intro;
        audioSource.Play();

        if (fox)
        {
            player.transform.Find("Player").transform.localScale = Vector3.zero;
            player.GetComponent <PlayerLife>().life = 50;
            player.GetComponent <PlayerLife>().invulnerableDuration = 2f;
            player.GetComponent <PlayerShooting>().fireDelta        = 0.05f;
            player.GetComponent <PlayerShooting>().shotSpeed        = 40f;
        }
        else
        {
            player.transform.Find("Fox").transform.localScale = Vector3.zero;
        }
    }