Example #1
0
 // Use this for initialization
 void Start()
 {
     CanManaHeal = true;
     CanSwing    = true;
     CanDodge    = true;
     CanTp       = true;
     DontDestroyOnLoad(gameObject);
     speed        = 12;
     defaultspeed = 12;
     StartCoroutine(WalkFrame());
     Switcher = GameObject.FindGameObjectWithTag("Loader");
     StartCoroutine(HealTick());
     StartCoroutine(ManaTick());
     StartCoroutine(CombatTick());
     StartCoroutine(SkillTick());
     ItemManager = GameObject.FindGameObjectWithTag("ItemManager").GetComponent <ItemManager>();
     Music       = GameObject.FindGameObjectWithTag("Audio").GetComponent <MusicScript>();
     SkillUi     = GameObject.FindGameObjectWithTag("SkillUi").GetComponent <SkillUIScript>();
     AddEquipped(ItemManager.registereditems[3]);
     codeindex = 0;
     if (ExpMaxes[Mathf.Clamp(Level - 1, 0, 250)] != 0)
     {
         ExpMax = ExpMaxes[Mathf.Clamp(Level - 1, 0, 250)];
     }
     else
     {
         ExpMax = 1000 + (500 * Level);
     }
     Health = MaxHealth;
     Mana   = MaxMana;
 }
Example #2
0
    void Awake()
    {
        overlay.GetComponent <Canvas>().renderMode = RenderMode.WorldSpace;
        characterIntroductionInterface.GetComponent <Canvas>().renderMode = RenderMode.WorldSpace;
        actionInterface.GetComponent <Canvas>().renderMode = RenderMode.WorldSpace;

        musicScript = musicManager.GetComponent <MusicScript>();
        musicScript.Init();
        musicScript.PlayMusicForLevel(riskAmount);

        story = new Story();

        string filePath   = Path.Combine(Application.streamingAssetsPath, "story.json");
        string dataAsJson = File.ReadAllText(filePath);

        story = JsonUtility.FromJson <Story>(dataAsJson);

        actionImageComponent = actionImage.GetComponent <Image>();
        actionImage.SetActive(false);

        audioSourceComponent = gameObject.GetComponent <AudioSource>();

        timerBar.maxValue = MAX_TIMER_VALUE;
        timerBar.value    = timerBar.maxValue;

        playerScript = player.GetComponent <PlayerScript>();
        playerScript.InitialPlayer();

        ChangeToIntroductionState();
    }
Example #3
0
 // Use this for initialization
 void Start()
 {
     dir    = -1;
     Player = GameObject.FindGameObjectWithTag("Hero");
     loader = GameObject.FindGameObjectWithTag("Loader").GetComponent <SceneLoader>();
     music  = GameObject.FindGameObjectWithTag("Audio").GetComponent <MusicScript>();
 }
Example #4
0
    // Start is called before the first frame update
    void Start()
    {
        music = GameObject.Find("Music").GetComponent <MusicScript>();
        music.checkSceneBGM();

        scene      = SceneManager.GetActiveScene();
        SceneIndex = scene.buildIndex;

        blackScreen  = GameObject.Find("BlackFade");
        blackfade    = blackScreen.GetComponent <Animator>();
        blackScreen2 = GameObject.Find("BlackFadeOut");
        blackfadeout = blackScreen2.GetComponent <Animator>();
        blackScreen.SetActive(true);
        blackScreen2.SetActive(false);

        FadeInOnSceneStart(fadeInTime);

        if (SceneIndex == 2)                             // GAME OVER
        {
            StartCoroutine(WaitToFadeOutScene(4.0f, 0)); // fade out, back to main menu
        }
        else if (SceneIndex == 3)                        // Beat game
        {
            StartCoroutine(WaitToFadeOutScene(5.0f, 0)); // fade out, back to mmenu
        }
    }
Example #5
0
    //arcade mode
    public void Arcade()
    {
        au.pitch  = 1f;
        canSelect = false;
        Color c = button[0].GetComponent <Text>().color;

        c.a = 0;
        au.PlayOneShot(click, PauseMenus.SFXvolume);
        MusicScript music = GameObject.Find("AudioManager/Music").GetComponent <MusicScript>();

        music.StopAllCoroutines();
        music.StartCoroutine(music.MusicOff());
        GameObject.Find("Canvas/Menus/Basic/Campaign").GetComponent <Animator>().enabled = false;
        foreach (Transform child in gameObject.transform)
        {
            child.gameObject.GetComponent <Text>().color         = c;
            child.gameObject.GetComponent <Text>().raycastTarget = false;
            child.gameObject.transform.localScale = new Vector3(1, 1, 1);
        }
        c.a = .05f;
        GameObject.Find("Canvas/Menus/Basic/Campaign").GetComponent <Text>().color     = c;
        GameObject.Find("Canvas/Menus/Basic/Leaderboards").GetComponent <Text>().color = c;
        GameObject.Find("Canvas/Menus/Basic/Arcade").GetComponent <Text>().color       = c;
        StartCoroutine(StartArcade());
    }
Example #6
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);

        if (tracks != null)
        {
            foreach (Sound s in tracks)
            {
                s.source      = gameObject.AddComponent <AudioSource> ();
                s.source.clip = s.clip;

                s.source.volume = s.volume;
                s.source.pitch  = s.pitch;
                s.source.loop   = true;
            }
        }
    }
Example #7
0
 void Awake()
 {
     current = this;
     bgMusic = GetComponent<AudioSource>();
     PlayMusic();
     DontDestroyOnLoad(gameObject);
 }
Example #8
0
 public void Update()
 {
     if (this != _instance)
     {
         _instance = null;
     }
 }
Example #9
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }


        DontDestroyOnLoad(transform.gameObject);
        float voll = PlayerPrefs.GetFloat("volume");

        audioSource = GetComponent <AudioSource>();
        if (voll != null)
        {
            audioSource.volume = voll;
        }
        if (!audioSource.isPlaying)
        {
            PlayMusic();
        }
    }
Example #10
0
	// Use this for initialization
	void Start () {
		music = GameObject.FindWithTag ("Music").GetComponent<MusicScript>();
		musicSize = music.length;

		this.transform.position = new Vector3((((hitTime - (music.actualTime + (music.length * music.loop))) * speed) + position) , 0, this.transform.position.z);
		//appearTime = music.time;
		//this.rigidbody2D.velocity = new Vector3 (-10, 0, 0);
	}
Example #11
0
 void Awake()
 {
     if (instance != null)
     {
         Debug.LogWarning("Two instance of MusicScript:"
                          + instance.gameObject.name + "/" + this.gameObject.name);
     }
     instance = this;
 }
Example #12
0
 void Awake()
 {
     if (music == null) {
         DontDestroyOnLoad(gameObject);
         music = this;
     } else if (music != this) {
         Destroy(gameObject);
     }
 }
Example #13
0
    // Use this for initialization
    void Start()
    {
        //setup the static instance
        instance = this;

        //get the enemy audio source
        enemyStem        = GetComponents <AudioSource>()[1];
        enemyStem.volume = 0.0f;
        enemyStem.Stop();
    }
Example #14
0
 void Awake()
 {
     if (instance != null && instance != this) {
         Destroy(this.gameObject);
         return;
     } else {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
Example #15
0
 private void GetInfo() //Gets field info in place of a start event
 {
     player            = GameObject.FindGameObjectWithTag("Player");
     ropelessHole      = GameObject.Find("EmptyDungeonHole");
     dungeon           = gameObject.GetComponent <Dungeon>();
     collectableHolder = GameObject.Find("Collectables");
     spawnerHolder     = GameObject.Find("Spawners");
     boss         = GameObject.Find("Boss");
     playerCamera = GameObject.Find("Main Camera");
     music        = playerCamera.GetComponent <MusicScript>();
 }
 private void Awake()
 {
     if (musicScriptInst != null)
     {
         Destroy(gameObject);
     }
     else
     {
         musicScriptInst = this;
     }
 }
Example #17
0
    private void Awake()
    {
        if (BgInstance != null & BgInstance != this)
        {
            Destroy(this.gameObject);
            return;
        }

        BgInstance = this;
        DontDestroyOnLoad(this);
    }
Example #18
0
 public void ChoiceThree()
 {
     MusicScript.SetMusic(music3);
     Cash.addMoney(-10);
     if (Cash.getMoney() < 0)
     {
         Cash.addMoney(10);
         insufficient.text = "Insufficient Funds";
     }
     cashText.text = "" + Cash.getMoney();
 }
Example #19
0
 // Use this for initialization
 void Start()
 {
     if (!_instance)
     {
         _instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(musik);
 }
Example #20
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
 private void Awake()
 {
     if (backgroundMusic == null)
     {
         backgroundMusic = this;
         DontDestroyOnLoad(backgroundMusic);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #22
0
    void Awake()
    {
        if (Instance) {
            DestroyImmediate (gameObject);
        }
        else

        {
            DontDestroyOnLoad(gameObject);
            Instance = this;
        }
    }
Example #23
0
 void MakeSingleton()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
Example #24
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(gameObject);
 }
Example #25
0
 void Awake()
 {
     if (music == null)
     {
         DontDestroyOnLoad(gameObject);
         music = this;
     }
     else if (music != this)
     {
         Destroy(gameObject);
     }
 }
Example #26
0
    public void Start()
    {
        if (!Load())
        {
            Debug.Log("Couldn't load settings.");
        }

        if (!MusicOn)
        {
            MusicScript.SettingsTurnMusicOff();
        }
    }
 void Awake()
 {
     if (instance != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
         GameObject.DontDestroyOnLoad(this.gameObject);
     }
 }
Example #28
0
 void Start()
 {
     if (theMusic == null)
     {
         DontDestroyOnLoad(transform.gameObject);
         theMusic = this;
     }
     else
     {
         Destroy(transform.gameObject);
     }
 }
Example #29
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
    private void Awake()
    {
        DontDestroyOnLoad(this.gameObject);

        if (!_instance)
        {
            _instance = this;
        }
        else
        {
            Destroy(this.gameObject);
        }
    }
Example #31
0
 public void ToggleMusic()
 {
     MusicOn = !MusicOn;
     archingSettingUI.GetComponent <ToggleUpdater>().ResetToggles();
     if (MusicOn)
     {
         MusicScript.SettingsTurnMusicOn();
     }
     else
     {
         MusicScript.SettingsTurnMusicOff();
     }
 }
 void Start()
 {
     if (current != null && current != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         current = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
Example #33
0
 void Awake()
 {
     if ((instance != null && instance != this) || SceneManager.GetActiveScene().buildIndex == (SceneManager.sceneCountInBuildSettings - 1))
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
Example #34
0
 // Start is called before the first frame update
 void Awake()
 {
     // mantém o objeto de música entre as cenas e previne ele de ser reinstanciado
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(transform.gameObject);
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     DontDestroyOnLoad(this.gameObject);
     if (musicScript == null || musicScript == this)
     {
         musicScript = this;
         myAudio     = this.GetComponent <AudioSource>();
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #36
0
 // Use this for initialization
 void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else {
         instance = this;
         GameObject.DontDestroyOnLoad(gameObject);
         songid = 0;
         lastsong = -1;
     }
 }
Example #37
0
    public void PlayBGM(GameObject audioParent, float fadeTime)
    {
        if (music != null && audioParent.GetComponent<AudioSource>().clip == music.GetComponent<AudioSource>().clip) return;

        GameObject aus = Instantiate<GameObject> (audioParent);
        aus.transform.SetParent(GameObject.Find ("MainCamera").transform);

        MusicScript m = aus.AddComponent<MusicScript> ();

        if (music != null)
            music.Fade(true, fadeTime);

        m.Fade(false, fadeTime);
        music = m;
    }
Example #38
0
 // Use this for initialization
 void Start()
 {
     _confirmScript = GameObject.FindObjectOfType<ConfirmScript>();
     _finishP1 = GameObject.Find("FinishP1");
     _dnfP1 = GameObject.Find("dnfP1");
     _finishP2 = GameObject.Find("FinishP2");
     _dnfp2 = GameObject.Find("dnfP2");
     _winnaarP2 = GameObject.Find("WinnaarP2");
     _winnaarP1 = GameObject.Find("WinnaarP1");
     _scoreScript = GameObject.FindObjectOfType<ScoreScript>();
     _musicScript = GameObject.FindObjectOfType<MusicScript>();
     _player1LevelScript = GameObject.FindObjectOfType<Player1LevelScript>();
     _player2LevelScript = GameObject.FindObjectOfType<Player2LevelScript>();
     _player1MoveScript = GameObject.FindObjectOfType<Player1MoveScript>();
     _player2MoveScript = GameObject.FindObjectOfType<Player2MoveScript>();
     _raceEnd = GameObject.FindGameObjectWithTag("RaceEnd");
 }
Example #39
0
 private void Awake()
 {
     instance = this;
     DontDestroyOnLoad(gameObject);
 }