Example #1
0
	void Start () 
	{
		beatManager = GetComponent<BeatManager>(); 

		BeatManager.OnBeat += OnBeat;
		BeatManager.OnAfterBeat += OnAfterBeat;
	}
Example #2
0
    public static void TurnOnOff(bool setActive, string gameState = "GAME OVER")
    {
        BeatManager.StopMusic();
        instance.gameObject.SetActive(setActive);
        instance.enabled = true;
        Debug.Log("We are scoreer");
        if (setActive)
        {
            //FindObjectOfType<PlayerEngine>().gameObject.SetActive(false);

            BeatManager.StopMusic();
            RoundController.PauseRound(true);
            instance.gameState.text     = gameState;
            instance.CurrentScore.text  = StreakCounterUI.scoreToPrint.ToString();
            instance.EnemyKills.text    = RoundController.EnemiesKilled.ToString();
            instance.SyncedHits.text    = StreakCounterUI.HitsOnBeat.ToString();
            instance.BestHitStreak.text = StreakCounterUI.TopHitsInArow.ToString();
            instance.Deaths.text        = StreakCounterUI.DeathCount.ToString();

            instance.scoreToPrintScore  = StreakCounterUI.scoreToPrint;
            instance.topHitsScore       = StreakCounterUI.TopHitsInArow; //
            instance.enemiesKileldScore = RoundController.EnemiesKilled; //
            instance.hitsOnBeatScore    = StreakCounterUI.HitsOnBeat;    //
            instance.deathcountScore    = StreakCounterUI.DeathCount;    //
            instance.Invoke("CalculateScore", 0.5f);
        }
    }
Example #3
0
    private void Awake()
    {
        beatManager  = GetComponent <BeatManager>();
        audioManager = GetComponent <AudioManager>();
        energyIcon   = transform.GetComponentInChildren <EnergyIcon>();

        EnergyIcon.OnEnergyStateChange += OnEnergyStateChange;
        EnergyIcon.OnFireClick         += onfireClick;

        BeatManager.OnCorrectClick   += OnCorrectClick;
        BeatManager.OnWrongClick     += OnWrongClick;
        BeatManager.OnMissClick      += OnMissClick;
        BeatManager.OnLevelCompleted += OnLevelCompleted;
        BeatManager.OnGroupCompleted += OnGroupCompleted;

        levelList[0] = level1;
        levelList[1] = level2;
        levelList[2] = level3;
        levelList[3] = level4;



        catAnimator      = GameObject.FindGameObjectWithTag("Cat").GetComponent <Animator>();
        fogueiraAnimator = GameObject.FindGameObjectWithTag("Fogueira").GetComponent <Animator>();
        girlAnimator     = GameObject.FindGameObjectWithTag("Girl").GetComponent <Animator>();
    }
Example #4
0
 private void Awake()
 {
     StartCoroutine(ReadyUI());
     gameStatus = state.Ready;
     system     = FindObjectOfType <BeatManager>();
     //savedMonsters = new List<Transform>();
 }
Example #5
0
    private void GameOver()
    {
        CoreHealth.Instance.coreDied -= GameOver;
        BeatManager.StopMusic();
        HUDManager hud = FindObjectOfType <HUDManager>();

        if (hud)
        {
            hud.gameObject.SetActive(false);
        }

        gameOver = true;
        PlayableDirector director = FindObjectOfType <PlayableDirector>();

        director.enabled       = true;
        director.playableAsset = gameOverCinematic;
        director.Play();
        director.stopped += ShowScoreScreen;
        Transform parent = FindObjectOfType <CameraController>().transform.GetChild(0).transform;

        if (parent)
        {
            for (int i = 0; i < parent.childCount; i++)
            {
                parent.GetChild(i).gameObject.SetActive(false);
            }
        }
    }
Example #6
0
    private void DoAttack()
    {
        currentAttackGrade = BeatManager.GetGrade();
        SetupVFX();
        OnAttack?.Invoke(currentAttackGrade);
        if (currentAttackGrade != RhythmGrade.Miss)
        {
            SyncPowerManager.KeepTheBeatGoing();
        }
        else
        {
            SyncPowerManager.Miss();
        }

        player.OnAttackedPressed?.Invoke();
        PlayerAnimator.SetTrigger(CurrentAttack.AttackTag);
        RuntimeManager.PlayOneShotAttached(CurrentAttack.AttackSFX, player.gameObject);
        timer = 0;
        hitObjects.Clear();
        timeOfLastAttack = Time.time + CurrentAttack.Clip.length;

        if (DirectionInput.magnitude > 0)
        {
            PlayerAnimator.transform.LookAt(PlayerAnimator.transform.position + Vector3.ProjectOnPlane(GetInputRelativeToCamera(), Vector3.up));
        }
        AutoTargeting();
    }
Example #7
0
 private void Awake()
 {
     StartCoroutine(ReadyUI());
     gameStatus = state.Ready;
     counter.Counting(currentCount, goalCount);
     system        = FindObjectOfType <BeatManager>();
     savedMonsters = new List <Transform>();
 }
Example #8
0
 void pingManagers()
 {
     GameManager.ping();
     BeatManager.ping();
     GraphicsManager.ping();
     StageManager.ping();
     GDMethods.init();
 }
Example #9
0
 private void Awake()
 {
     if (Instance != null)
     {
         Destroy(this);
     }
     Instance = this;
 }
Example #10
0
 // Start is called before the first frame update
 void Start()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     BeatLength    = 60f / BMP;
     LevelLoadTime = Time.time;
 }
Example #11
0
    public void Init(GameController gameController)
    {
        _gameController = gameController;

        _beatManager         = _gameController.GetBeatManager();
        _beatManager.OnBeat += NewBeat;

        player = _gameController.GetPlayer();
        player.Health.OnDead += PlayerDead;
    }
Example #12
0
    private void Start()
    {
        cam = Camera.main.GetComponent <Camera>();
        bm  = GameObject.FindGameObjectWithTag("Managers").GetComponent <BeatManager>();

        if (!GameObject.FindWithTag("Heart"))
        {
            Debug.Log("No Heart found! Did you forget to tag it?");
        }
    }
Example #13
0
        public static void Test3()
        {
            BeatManager.Beat();
            for (int i = 1; ; i++)
            {
                Console.WriteLine(i);

                Thread.Sleep(1800);
            }
        }
Example #14
0
    // Start is called before the first frame update
    void Start()
    {
        instance = this;
        subscribed_objs_to_beat = new List <BeatData>();

        for (int i = 0; i < manually_subscribed.Count; ++i)
        {
            AddObjToBeat(manually_subscribed[i]);
        }
    }
Example #15
0
        public override void Initialize()
        {
            base.Initialize();

            AddEntity(new SeedCountHud());
            AddEntity(new MainHUD());

            Player player = new Player(NamedPositions.ChickenCoopDoor);

            AddEntity(player);

            GameState.Instance.SetVar <bool>("immediately_finish", false);

            GameState.Instance.SetVar <int>("background_height", 0);       // SET IN BACKGROUND CLASS
            GameState.Instance.SetVar <int>("background_y", 0);            // SET IN BACKGROUND CLASS
            AddEntity(new Background(new Vector2(0, 0)));
            AddEntity(new Foreground(new Vector2(0, 0)));
            GameState.Instance.SetVar <int>("BEAT_Y", GetWindowHeight() - 150);

            BeatHUD beatHUD = new BeatHUD();

            AddEntity(beatHUD);

            SuspicionBar suspicionBar = new SuspicionBar(new Vector2(GetWindowWidth() - 100, 200));

            AddEntity(suspicionBar);

            Camera.FollowEntity(player);

            GameState.Instance.SetVar <Player>("player", player);
            GameState.Instance.SetVar <int>("seeds", 0);

            GameState.Instance.SetVar <bool>("is_beat", false);
            GameState.Instance.SetVar <Beat>("current_beat", null);
            GameState.Instance.SetVar <List <Beat> >("beat_list", new List <Beat>());

            GameState.Instance.SetVar <int>("max_distance_to_chicken", 600);
            GameState.Instance.SetVar <float>("distance_to_chicken_percent", 1f);

            GameState.Instance.SetVar <string>("current_level_name", "Level 2");
            GameState.Instance.SetVar <Scene>("current_level", this);


            // BANNER HARDCODED STUFF
            float bannerScaleFactor = (float)GameState.Instance.GetCurrentScene().GetWindowWidth() / 4850;

            GameState.Instance.SetVar <int>("banner_height", (int)(bannerScaleFactor * 590));


            BeatManager beatManager = new BeatManager(GetSoundManager(), "main_theme");

            beatManager.PlaySong();
            AddSpawnController(beatManager);
        }
Example #16
0
    void BeginChase()
    {
        this.totalChaseTime    = BeatManager.TimeForBeat(this.tracker.peekNextEventDelta());
        this.currentTravelTime = 0f;

        float frames = totalChaseTime / Time.fixedDeltaTime;

        velocity   = playerposlookup.lookupPlayerPositionWithDelay() - this.transform.position;
        velocity.y = 0;
        velocity   = velocity / frames;
    }
Example #17
0
 void Awake()
 {
     if (Instance != null)
     {
         Debug.LogWarning("BeatManager is a singleton, make sure you don't have onether BeatManager in scene");
     }
     else
     {
         Instance = this;
     }
 }
Example #18
0
    private void Awake()
    {
        instance = this;

        //LoadLevel(LevelToLoad);
        EnterLevel(LevelToLoad, 0);

        BeatManager.Initialise();
        BeatManager.bpm          = bpm;
        BeatManager.ticksPerBeat = ticksPerBeat;
        BeatManager.LoadSong();
    }
Example #19
0
    void Update()
    {
        for (int i = 0; i < lights.Length; i++)
        {
            lights[i].GetComponent <HDAdditionalLightData>().lightDimmer = lightCurve.Evaluate((one - (float)BeatManager.OffBeatPercent()));
            //   lights[i].spotAngle = lightAngle[i] * lightAngleCurve.Evaluate((one - (float)BeatManager.OffBeatPercent()));
        }

        foreach (Material mat in mats)
        {
            mat.SetFloat(materailref, materialCurve.Evaluate((one - (float)BeatManager.OffBeatPercent())));
        }
    }
Example #20
0
 public void Test3()
 {
     BeatManager.Beat();
     for (int i = 1; ; i++)
     {
         Console.WriteLine(i);
         if (!IsRun)
         {
             break;
         }
         Thread.Sleep(1000);
     }
 }
Example #21
0
 // Use this for initialization
 void Start()
 {
     anchorPoint           = Camera.main.gameObject.transform.position;
     anchorScale           = Camera.main.orthographicSize;
     GameManager.gameTimer = this;
     GameManager.score     = 0;
     BeatManager.loadFile("Assets/Art/Music/" + levelName + ".mid");
     GameManager.scoretable.displayScores();
     GameManager.scoretable.enable(false);
     //Camera.main.GetComponent<AudioSource>().clip = AssetDatabase.FindAsset("Assets/Art/Music" + levelName + ".mp3");
     BeatManager.checkBeats(gameTime);
     Destroy(GameManager.menuMusic);
 }
 public override void Enter()
 {
     if (manager.SkipTutorial)
     {
         TransitionTo <InRoundState>();
         return;
     }
     Debug.Log("eNTER");
     OnNewTutorialStep?.Invoke(TutorialSteps[currentTutorialIndex]);
     BeatManager.Play();
     toTheBeatcounter            = 0;
     PlayerAttackState.OnAttack += Attacking;
 }
Example #23
0
    private void Start()
    {
        _bm = GameObject.FindGameObjectWithTag("Managers").GetComponent <BeatManager>();

        if (!GetComponent <Button>())
        {
            Debug.Log("Make sure this script is attached to a Button!");
        }
        else
        {
            _upgradeButton = GetComponent <Button>();
        }
    }
Example #24
0
    public RhythmGrade GetGrade()
    {
        if (timeOfLastHit == Time.time)
        {
            return(thisFrameGrade);
        }


        bool mashing = Time.time - timeOfLastHit < MashSafeTime;

        timeOfLastHit = Time.time;

        if (mashing)
        {
            thisFrameGrade = RhythmGrade.Miss;
            return(thisFrameGrade);
        }

        double beatPercentage = BeatManager.OffBeatPercent();

        if (beatPercentage > 0.5d)
        {
            beatPercentage = 1 - beatPercentage;
        }

        beatPercentage *= 2d;

        if (beatPercentage > GoodPercentage)
        {
            thisFrameGrade = RhythmGrade.Miss;
        }
        else if (beatPercentage > GreatPercentage)
        {
            thisFrameGrade = RhythmGrade.Good;
        }
        else if (beatPercentage > ExcellentPercentage)
        {
            thisFrameGrade = RhythmGrade.Great;
        }
        else if (beatPercentage > SuperPercentage)
        {
            thisFrameGrade = RhythmGrade.Excellent;
        }
        else
        {
            thisFrameGrade = RhythmGrade.Super;
        }

        return(thisFrameGrade);
    }
Example #25
0
    // Update is called once per frame
    public void FixedUpdate()
    {
        float lastTime = timer;

        timer += Time.fixedDeltaTime;

        float nextBeat = lastBeat + BeatManager.TickTime;

        if (BeatManager.eventHappened(lastTime, timer, nextBeat))
        {
            lastBeat = nextBeat;
            measureUpdate();
        }
    }
Example #26
0
        public void Test2()
        {
            for (int i = 1; ; i++)
            {
                if (!IsRun)
                {
                    break;
                }
                BeatManager.Beat();
                Console.WriteLine(i);

                Thread.Sleep(1000);
            }
        }
Example #27
0
    private void Awake()
    {
        AnimationEvents.OnPlayerFall        += PlayerFall;
        AnimationEvents.OnEnemyFall         += EnemyFall;
        AnimationEvents.OnPlayerWin         += PlayerWin;
        AnimationEvents.OnPlayPuke          += EnemyPuke;
        AnimationEvents.OnStopMainMusic     += StopMainMusic;
        AnimationEvents.OnPlaySpinningSound += PlayPlayerSpinning;
        GameController.OnGameTimeComplete   += FightTimeout;

        beatManager = GetComponent <BeatManager>();

        beatManager.SetMainSong(_clipMainMusic);
    }
Example #28
0
    void Update()
    {
        AudioEvent.getPlaybackState(out PLAYBACK_STATE state);
        if (state != PLAYBACK_STATE.PLAYING)
        {
            GamePad.SetVibration(PlayerIndex.One, 0f, 0f);
            return;
        }


        beatTimer += Time.unscaledDeltaTime;
        trackTime += Time.unscaledDeltaTime;
        if (settingUp)
        {
            AudioEvent.getTimelinePosition(out int pos);
            if (pos < 2000)
            {
                return;
            }
            beatTimer = (pos - 2000) * 0.001f;
            trackTime = (float)beatTimer;
            settingUp = false;
        }

        AudioEvent.getPlaybackState(out playbackState);
        if (playbackState != PLAYBACK_STATE.PLAYING)
        {
            return;
        }


        if (beatTimer >= 0.5f)
        {
            Debug.Log("Beat!");
            OnBeat?.Invoke();
            beatTimer -= 0.5f;
        }



        if (Input.GetKeyDown(KeyCode.F))
        {
            SetIntensity(CombatIntensity + 0.1f);
        }

        rumbleForce = rumbleCurve.Evaluate((one - (float)BeatManager.OffBeatPercent()));
        GamePad.SetVibration(PlayerIndex.One, rumbleForce, rumbleForce);
    }
Example #29
0
 // Use this for initialization
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     calcTimeBetweenBeats();
     beatEvaluatorObj   = GameObject.Find("Centre");
     NextBeat           = GameObject.Find("BeatQueue").transform.GetChild(0).gameObject;
     beatTimingText     = GameObject.Find("BeatTiming").GetComponent <Text>();
     beatQueueTransform = GameObject.Find("BeatQueue").transform;
 }
Example #30
0
    public void AddInputMarker(LevelManager.ActionResult markerType, float time)
    {
        float metronomeValue = Mathf.PingPong((float)BeatManager.GetBeatTime(time), 1f);

        RectTransform marker = Instantiate(InputMarkerPrefabs[(int)markerType], InputsDisplay).GetComponent <RectTransform>();
        Vector2       anchoredPos = marker.anchoredPosition;
        Vector2       anchorMin = marker.anchorMin; Vector2 anchorMax = marker.anchorMax;

        anchoredPos.x = 0f;
        anchorMin.x   = anchorMax.x = metronomeValue;

        marker.anchorMin        = anchorMin; marker.anchorMax = anchorMax;
        marker.anchoredPosition = anchoredPos;

        marker.gameObject.AddComponent <Autodestroy>().destroyTimer = 1 / (BeatManager.bpm / 60f);
        marker.GetComponent <EffectGUIColourOverLifetime>().Initiate();
    }
Example #31
0
	void Start ()
    {
		movePattern = GetComponent<MovePattern>();
		beatManager = GetComponent<BeatManager>();

		MovePattern.OnPatternFrameChange += OnPatternFrameChange;
		MovePattern.OnPatternPlayerTurnStart += OnPatternPlayerTurnStart;
		MovePattern.OnPatternComplete += OnPatternComplete;
		MovePattern.OnPatternFailed += OnPatternFailed;
		MovePattern.OnCorrectMove += OnCorrectMove;
		BeatManager.OnBeat += OnBeat;

		ChangeSpeed(1.0f);
		UpdateScore(0);
		round = 0;
        StageStart();
    }
Example #32
0
    public override void Back()
    {
        BeatManager.StopMusic();
        MenuManager.Instance.CloseAllMenus();
        GameObject go = MenuManager.Instance.gameObject;

        Destroy(go);
        int sceneToMoveTo = SceneManager.GetActiveScene().buildIndex - 1;

        if (sceneToMoveTo >= 0)
        {
            SceneManager.LoadScene(sceneToMoveTo);
        }
        else
        {
            UnityEngine.Debug.Log("There is no scene assigned in build settings!");
        }
    }
Example #33
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // 位置セット
            this.Left = Config.Instance.WindowLocation.X;
            this.Top = Config.Instance.WindowLocation.Y;

            this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);

            Logger.Instance.Log(LogType.Info, "キャプチャ開始");
            /// キャプチャ
            _cap = new Capture();
            if (_cap.Devices.Length == 0)
            {
                return;
            }
            _cap.CapDevice = _cap.Devices[0];
            _cap.CreateGraph();
            _cap.StartCapture();
            _beatManager = _cap.Sampler.DetectManagers[_cap.Sampler.DetectManagers.Count - 1]; /// 最後のDetectManagerには各チャンネルの平均が入っている
            _beatManager.DancerManager = _dancerManager;
            DataContext = _beatManager;

            /// メニュー
            captureBpmMenuItem.IsChecked = Config.Instance.UseCapturedBpm;
            constBpmMenuItem.IsChecked = !Config.Instance.UseCapturedBpm;
            constBpmValueBox.Text = Config.Instance.ConstBpmValue.ToString();
            viewTopMostMenuItem.IsChecked = Config.Instance.TopMost;

            /// 表示設定反映
            AdjustWindowPosition();
            this.Topmost = Config.Instance.TopMost;

            /// frame rate 初期化
            _currentTick = Environment.TickCount;
            _nextTick = _currentTick;
            _lastCountTick = _currentTick;
            _lastFpsTick = _currentTick;
            _constBpmBaseTick = _currentTick;
        }
Example #34
0
	void Awake(){
		Instance = this;
		isPlaying = false;
		audio = this.GetComponent<AudioSource> ();
		OnBeat += PlayBeatClip;
	}
Example #35
0
 public DSAudioSampler(CaptureOption opt)
 {
     _captureOpt = opt;
     double samplePerSec = opt.SamplePerSec / (double)_sampleStep;
     opt.SamplePerSec = samplePerSec;
     for (int i = 0; i < opt.ChannelNum + 1; i++)
     {
         BeatManager dm = new BeatManager(opt);
         _detectManagers.Add(dm);
     }
 }