Exemple #1
0
    private void DoScore()
    {
        for (int i = 0; i < birds.Length; i++)
        {
            if (!birds[i].IsInitialized())
            {
                continue;
            }

            PoseData currentPose = Pose.CalculateFromController(birds[i].GetInput());
            PoseData prevPose    = lastPose[i];

            //compare
            PoseDiff poseDiff = Pose.CalculatePoseDiffs(currentPose, prevPose);

            int randomScoreModifier = Random.Range(5, 10);
            int amount = Mathf.FloorToInt(poseDiff.totalDiff) * randomScoreModifier;
            ScoreHandler.GetInstance().AddScore(i, amount);

            lastPose[i] = currentPose;
        }
        ScoreChanged();
    }