Created
August 28, 2025 20:20
-
-
Save gamesbyangelina/09b0d9a64cdaf6c39a11f165aefcd1c2 to your computer and use it in GitHub Desktop.
Run Specification: Dodgeball
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using GameFeelDescriptions.Examples; | |
| /* | |
| More complex run specification with multiple autoplayers | |
| */ | |
| public class DodgeballRunSpec : RunSpec | |
| { | |
| public DodgeballRunSpec(){ | |
| //6 runs per test | |
| this.runsPerSolution = 6; | |
| } | |
| public override void OnRunStart(int run){ | |
| UnityEngine.Random.InitState(0); | |
| //first three runs use a 'good' player | |
| if(run < 3){ | |
| GameObject.Find("Player").GetComponent<Player>().frameSkip = 1; | |
| GameObject.Find("Player").GetComponent<Player>().modFactor = 0.75f; | |
| GameObject.Find("Player").GetComponent<Player>().magFactor = 4f; | |
| } | |
| //lowered reaction time for the worse player | |
| else{ | |
| GameObject.Find("Player").GetComponent<Player>().frameSkip = 1; | |
| GameObject.Find("Player").GetComponent<Player>().frameDelay = 4; | |
| GameObject.Find("Player").GetComponent<Player>().modFactor = 0.75f; | |
| GameObject.Find("Player").GetComponent<Player>().magFactor = 4f; | |
| } | |
| } | |
| public override void OnRunComplete(int run){ | |
| } | |
| float p1Score = 0; | |
| float p2Score = 0; | |
| float firstPhase = 0; | |
| public override float ScoreRun(int run){ | |
| if(run == 0){ | |
| p1score = 0; | |
| p2score = 0 | |
| } | |
| if(run < 3){ | |
| p1score += BallController.instance.TimeInLevel/60f; //normalised | |
| } | |
| else{ | |
| p2score += BallController.instance.TimeInLevel/60f; //normalised | |
| } | |
| if(run < 5){ | |
| return 0; | |
| } | |
| else{ | |
| return (p2Score/3f) - (p1Score/3f); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment