private void FixedUpdate() { if (attacking) { AttackAnimation(); attackingTime += Time.fixedDeltaTime; if (attackingTime > maxAttackingTime) { attacking = false; attackingTime = 0f; outOfControl = true; pm.ChangeClip(settings.levelMusicId); } } else if (outOfControl) { EndAttackAnimation(); outOfControlTime += Time.fixedDeltaTime; if (outOfControlTime > maxOutOfControlTime) { outOfControl = false; outOfControlTime = 0f; GiveControl(); } } else { if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1)) { StartAttack(attackID1); } else if (Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Keypad2)) { StartAttack(attackID2); } else if (Input.GetKeyDown(KeyCode.Alpha3) || Input.GetKeyDown(KeyCode.Keypad3)) { StartAttack(attackID3); } } }
private void Start() { pm = player.GetComponentInChildren <PlayMusic>(); pm.ChangeClip(levelMusicId); hasSong1 = PlayerPrefs.GetInt("Song1") != (int)music.none; hasSong2 = PlayerPrefs.GetInt("Song2") != (int)music.none; hasSong3 = PlayerPrefs.GetInt("Song3") != (int)music.none; if (hasSong1) { currentSongIn1 = PlayerPrefs.GetInt("Song1") == (int)levelMusicId; } if (hasSong2) { currentSongIn2 = PlayerPrefs.GetInt("Song2") == (int)levelMusicId; } if (hasSong3) { currentSongIn3 = PlayerPrefs.GetInt("Song2") == (int)levelMusicId; } }