void Update() { if (m_LucrativeZaps == null) { ZapGrid zapGrid = GameMaster.Instance.m_ZapManager.GetZapGrid(); m_LucrativeZaps = zapGrid.GetLucrativeZaps(); } else { for (int i = 0; i < m_LucrativeZaps.Count; i++) { Zap currZap = m_LucrativeZaps[i]; if (currZap != null) { if (currZap.transform.position.y < this.transform.position.y && !m_ZapsAlreadyBeingLerped.Contains(currZap)) { // lerp to magnet currZap.DisableCollision(); m_ZapsAlreadyBeingLerped.Add(currZap); StartCoroutine(lerpZapToThisMagnet(currZap)); } } } } }
public static void ZapReport() { if (VhServices?.VideoWebApiUrl != null) { Zap.ReportAndShutDown("VideoWeb-Acceptance", VhServices.VideoWebApiUrl); } }
public List <Zap> get() { var lstZap = new List <Zap>(); var request = WebRequest.CreateHttp("https://www.donneesquebec.ca/recherche/dataset/5cc3989e-442b-4f25-8049-d39d44421d6f/resource/0106c060-9559-4ce7-9987-41ec051a1df8/download/nodes.csv"); var response = request.GetResponse(); var reader = new StreamReader(response.GetResponseStream()); var responseText = reader.ReadToEnd(); var tousTexte = responseText.Split('\n'); for (int i = 0; i < tousTexte.Length; i++) { tousTexte[i] = tousTexte[i].Replace("\"", ""); } bool ignoreFisrt = false; foreach (var v in tousTexte) { if (ignoreFisrt) { Zap zap = new Zap(v); lstZap.Add(zap); } else { ignoreFisrt = true; } } return(lstZap); }
private static void stopSecurityScanAndGenerateReport(Configuration config, bool scanWasAlreadyRunning) { Console.WriteLine("Generating security report and shutting scanner down"); if (!string.IsNullOrEmpty(config.SecurityScanReport)) { try { // If we want a security scan report, generate it Zap.GenerateReport(config.ProxyOverride, config.SecurityScanReport); } catch (Exception e) { WriteErrorToConsole(e); WriteErrorToFile(config, e); } } // Stop security scanner if it wasn't already running if (config.SecurityScan && !scanWasAlreadyRunning) { try { Zap.StopSecurityScanning(config.ProxyOverride, true); } catch (Exception e) { WriteErrorToConsole(e); WriteErrorToFile(config, e); } } }
public void MoveRocketJump(int numRows) { ZapGrid currGrid = GameMaster.Instance.m_ZapManager.GetZapGrid(); if (currGrid) { m_CurrRow += numRows; m_CurrRow = Mathf.Clamp(m_CurrRow, 0, currGrid.GetNumRows() - 1); bool underneathCurrZap = underneathCurrentZap(); Zap next = m_NextZap; Zap curr = m_CurrZap; if (underneathCurrZap) { m_NextZap = currGrid.GetZap(m_CurrRow, m_CurrCol); } else { m_NextZap = currGrid.GetZap(m_CurrRow, m_NextCol); } m_CurrZap = m_NextZap; m_TargetPosition = m_NextZap.GetOffsetPosition(); m_StartPosition = this.transform.position; m_LerpAmount = 0.0f; // don't let player move while rocket jumpin m_CanMove = false; } }
private void startShootTimer() { Zap targetZap = null; // find target to shoot and shoot ZapGrid zapGrid = GameMaster.Instance.m_ZapManager.GetZapGrid(); if (zapGrid != null) { List <Zap> dangerousZaps = zapGrid.GetDangerousZaps(); Vector3 worldSpaceTopScreen = Utility.ScreenUtilities.GetWSofSSPosition(0.0f, 1.0f); for (int i = 0; i < dangerousZaps.Count; i++) { Zap currZap = dangerousZaps[i]; if (currZap.transform.position.y <= worldSpaceTopScreen.y && currZap.transform.position.y > this.transform.position.y && !zapsAlreadyShotAt.Contains(currZap)) { targetZap = currZap; break; } } } if (targetZap != null) { StartCoroutine(rotateToTargetThenFire(targetZap)); } else { Invoke("startShootTimer", m_ShootInterval); } }
public void MoveToZapGrid() { m_NextRowIndicator.gameObject.SetActive(true); m_CurrZap = null; m_NextZap = null; m_PrevMovementState = MovementState.MovingToZapGrid; m_MovementState = MovementState.MovingToZapGrid; m_StartPosition = this.transform.position; m_SpeedMultiplier = 1.0f; m_IsMovingRight = true; m_CurrRow = 0; m_CurrCol = 0; m_CanMove = true; m_PlayerDecorations.ShowMainPS(); GameMaster.Instance.m_DadEventManager.StartEvents(); // Increase level UI displayed to user GameMaster.Instance.m_UIManager.m_LevelPanel.Show(); // start cooldown of player boost if it exists GameMaster.Instance.m_PlayerBoost.Reset(); // allow player to active the equipped ability GameMaster.Instance.m_PlayerBoost.canActivate = true; GameMaster.Instance.m_SolarSystemSpawner. BeginSpawningSolarObjects(); }
public override int GetHashCode() { int hash = 1; if (total_ != null) { hash ^= Total.GetHashCode(); } if (zap_ != null) { hash ^= Zap.GetHashCode(); } if (nds_ != null) { hash ^= Nds.GetHashCode(); } if (deb_ != null) { hash ^= Deb.GetHashCode(); } if (fin_ != null) { hash ^= Fin.GetHashCode(); } if (mon_ != null) { hash ^= Mon.GetHashCode(); } if (oth_ != null) { hash ^= Oth.GetHashCode(); } return(hash); }
// returns the zap we move through initially when moving up. public Zap MoveVertically() { ZapGrid currZapGrid = GameMaster.Instance.m_ZapManager.GetZapGrid(); if (currZapGrid) { m_CurrRow++; // don't allow player to jump higher than number of rows in zap grid. Else argumentoutofrange exception m_CurrRow = Mathf.Clamp(m_CurrRow, 0, currZapGrid.GetNumRows()); /* get correct zap on new line to go to * this will compare the distance between the curr and next zap * if next zap is closer then go to it and vice versa. */ Zap zapOnNewLine = null; Zap zapMovedThrough = null; bool underneathCurrZap = underneathCurrentZap(); if (underneathCurrZap) { // handles to make sure that we can't repeatedly make up for increment issues when moving vertically. if (m_PrevMovementState != MovementState.MovingVertical) { if (m_IsMovingRight) { m_NextCol--; } else { m_NextCol++; } } zapOnNewLine = currZapGrid.GetZap(m_CurrRow, m_NextCol); zapMovedThrough = m_CurrZap; } else { zapOnNewLine = currZapGrid.GetZap(m_CurrRow, m_NextCol); zapMovedThrough = m_NextZap; } if (zapOnNewLine != null) { //m_P2 = m_CurrZap.GetOffsetPosition(); //m_P1 = m_StartPosition //m_TargetPosition = GetPoint(m_LerpPercentage); // figure out which zap we are closer too m_CurrZap = zapOnNewLine; m_NextZap = zapOnNewLine; //m_CurrRow += numRows; m_LerpAmount = 0.0f; m_StartPosition = this.transform.position; m_TargetPosition = zapOnNewLine.GetOffsetPosition(); } return(zapMovedThrough); } return(null); }
public void MoveToWarpZone() { // Move to next zap grid m_NextRowIndicator.gameObject.SetActive(false); WarpZone newDeadZone = GameMaster.Instance.m_WarpZoneManager.SpawnDeadZone(); m_CurrZap = null; m_NextZap = null; m_NextCol = 0; m_CurrRow = 0; m_StartPosition = this.transform.position; m_TargetPosition = newDeadZone.transform.position; SetMovementState(MovementState.MovingToWarpZone); SetSpeedMultiplier(2.0f, false); m_LerpAmount = 0.0f; GameMaster.Instance.m_BackDropManager.ShowWarpStoreColors(); GameMaster.Instance.m_DadEventManager.StopEvents(); GameMaster.Instance.m_SolarSystemSpawner.StopSpawningSolarObjects(); // show flawless completion notification if grid completion flawless. StatsManager statsManager = GameMaster.Instance.m_StatsManager; if (statsManager && statsManager.GetFlawlessGridRun()) { UIManager uiManager = GameMaster.Instance.m_UIManager; if (uiManager) { uiManager.SpawnUINotification("+500 FLAWLESS RUN", true); statsManager.AddToScore(500); } } }
// Start is called before the first frame update void Start() { FlockMask = gameObject.layer; Sequence TreeRoot = new Sequence(); Detect DetectNode = new Detect(); Zap ZapNode = new Zap(); DamageBoid DamageNode = new DamageBoid(); TreeRoot.children.Add(DetectNode); TreeRoot.children.Add(ZapNode); TreeRoot.children.Add(DamageNode); Blackboard.Add("BoidTarget", null); Blackboard.Add("SpeedIncrement", SpeedIncrementOnHit); Blackboard.Add("TurnRateDecrement", TurnRateDecrementOnHit); Blackboard.Add("LayerMask", FlockMask); DetectNode.BoidKey = "BoidTarget"; DetectNode.LayerKey = "LayerMask"; ZapNode.BoidKey = "BoidTarget"; DamageNode.BoidKey = "BoidTarget"; DamageNode.SpeedKey = "SpeedIncrement"; DamageNode.TurnRateKey = "TurnRateDecrement"; TreeRoot.tree = this; DetectNode.tree = this; ZapNode.tree = this; DamageNode.tree = this; root = TreeRoot; }
/* * --dll="../../../iSIMSAddStudent/bin/debug/iSIMSSearchStudent.dll" --hub=http://bedcsscmssl01:4444/wd/hub --reporter="C:\WIP\SIMS 8 UK\Src\iSIMSSeleniumTestFrameWork\HtmlReport\bin\Debug\HtmlReport.dll" --maxThreads=15 --output="c:/report" */ static int Main(string[] args) { Environment.Initialise(new WebDriverRunner.webdriver.WebContext(), new TestRunner.SeSugar.SeSettings(), new TestRunner.SeSugar.SeLogger()); Configuration config = null; Runner runner = null; try { config = Configuration.Create(args); Environment.Settings.AutomatedRunId = config.AutomatedRunId; Environment.Settings.SeleneApiUrl = config.SeleneApiUrl; bool scanWasAlreadyRunning = config.SecurityScan && Zap.IsRunning(config.ProxyOverride); if (!scanWasAlreadyRunning) { startSecurityScan(config); } // Now run the tests runner = new Runner(config); runner.LoadTests(); runner.RunTests(); runner.GenerateReports(); stopSecurityScanAndGenerateReport(config, scanWasAlreadyRunning); // Return the exit code return(runner.GetExitCode()); } catch (System.Exception e) { lock (ConsoleLock.WriterLock) { if (config != null) { WriteErrorToConsole(e); WriteErrorToFile(config, e); } else { WriteErrorToConsole(e); WriteErrorToConsole( new System.Exception("There was an issue with the configuration parameters. Please check them.")); } } return((int)WebDriverRunner.Runner.ExitCode.UnknownError); } finally { if (config != null && config.PauseOnExit) { Console.WriteLine("Press any key to continue..."); Console.ReadLine(); } } }
public void GetReport_WhenCalled_CallsReportingComponentGetReport() { var reporting = A.Fake <IReporting>(); var zap = new Zap(A.Fake <ISettings>(), A.Fake <ILogger>(), A.Fake <IScanner>(), reporting, A.Fake <ISpider>()); zap.GetReport("http://www.somefakeurl.com"); A.CallTo(() => reporting.GetReport("http://www.somefakeurl.com")).MustHaveHappened(); }
public void Can_serialize_underscored_json_properties_to_pascal_cased() { const string expected = "{\"foo_bar\":15}"; var zap = new Zap {FooBar = 15}; var actual = JsonConvert.SerializeObject(zap, _settingsWithPascalContractResolver); Assert.AreEqual(expected, actual); }
public void Scan_WhenCalled_CallsSpiderStart() { var spider = A.Fake <ISpider>(); var zap = new Zap(A.Fake <ISettings>(), A.Fake <ILogger>(), A.Fake <IScanner>(), A.Fake <IReporting>(), spider); zap.Scan("http://www.somefakeurl.com"); A.CallTo(() => spider.Start("http://www.somefakeurl.com")).MustHaveHappened(); }
private static void GenerateBearerTokens(TestContext context, IOptions <AzureAdConfiguration> azureOptions) { context.Tokens.VideoApiBearerToken = new AzureTokenProvider(azureOptions).GetClientAccessToken( azureOptions.Value.ClientId, azureOptions.Value.ClientSecret, context.Config.Services.VideoApiResourceId); context.Tokens.VideoApiBearerToken.Should().NotBeNullOrEmpty(); Zap.SetAuthToken(context.Tokens.VideoApiBearerToken); }
public void GetReport_WhenCalled_CallsReportingComponentGetReport() { var reporting = A.Fake<IReporting>(); var zap = new Zap(A.Fake<ISettings>(), A.Fake<ILogger>(), A.Fake<IScanner>(), reporting, A.Fake<ISpider>()); zap.GetReport("http://www.somefakeurl.com"); A.CallTo(() => reporting.GetReport("http://www.somefakeurl.com")).MustHaveHappened(); }
public void SetTarget(Zap zap, float bulletLerpTime) { if (zap != null) { m_BulletLerpTime = bulletLerpTime; m_TargetZap = zap; StopCoroutine(lerpToTarget()); StartCoroutine(lerpToTarget()); } }
// Use this for initialization public override void OnInspectorGUI() { Zap zapScript = target as Zap; zapScript.m_HasPoints = EditorGUILayout.Toggle("Has Points", zapScript.m_HasPoints); if (zapScript.m_HasPoints) { zapScript.m_Points = EditorGUILayout.IntField(zapScript.m_Points); } }
public void MoveTo(Zap targetZap, MovementState movementState) { m_CurrZap = targetZap; m_NextZap = targetZap; m_NextCol = targetZap.Col; m_CurrRow = targetZap.Row; m_StartPosition = this.transform.position; m_TargetPosition = targetZap.GetOffsetPosition(); SetMovementState(movementState); SetSpeedMultiplier(1.0f, false); m_LerpAmount = 0.0f; }
private static void GenerateBearerTokens(IntTestContext context, IOptions <AzureAdConfiguration> azureOptions, NotifyConfiguration notifyConfiguration) { context.Tokens.NotificationApiBearerToken = new AzureTokenProvider(azureOptions).GetClientAccessToken( azureOptions.Value.ClientId, azureOptions.Value.ClientSecret, context.Config.ServicesConfig.VhNotificationApiResourceId); context.Tokens.NotificationApiBearerToken.Should().NotBeNullOrEmpty(); context.Tokens.NotificationCallbackBearerToken = new CustomJwtTokenProvider().GenerateTokenForCallbackEndpoint(notifyConfiguration.CallbackSecret, 60); context.Tokens.NotificationCallbackBearerToken.Should().NotBeNullOrWhiteSpace(); Zap.SetAuthToken(context.Tokens.NotificationApiBearerToken); }
public void Scan_WhenCalledAndSpiderDidNotStart_DoesNotCallScannerScan() { var spider = A.Fake <ISpider>(); var scanner = A.Fake <IScanner>(); var zap = new Zap(A.Fake <ISettings>(), A.Fake <ILogger>(), scanner, A.Fake <IReporting>(), spider) { sleepTimeBetweenRequests = 0 }; A.CallTo(() => spider.HasCompleted()).Returns(false); zap.Scan("http://www.somefakeurl.com"); A.CallTo(() => scanner.Scan(A <string> .Ignored)).MustNotHaveHappened(); }
public void Scan_WhenCalledAndSpiderDidNotStart_DoesNotCallSpiderHasCompleted() { var spider = A.Fake<ISpider>(); var scanner = A.Fake<IScanner>(); var zap = new Zap(A.Fake<ISettings>(), A.Fake<ILogger>(), scanner, A.Fake<IReporting>(), spider) { sleepTimeBetweenRequests = 0 }; A.CallTo(() => spider.HasCompleted()).Returns(false); zap.Scan("http://www.somefakeurl.com"); A.CallTo(() => spider.HasCompleted()).MustNotHaveHappened(); }
public void Scan_WhenCalledAndSpiderStarted_CallsSpiderHasCompleted() { var spider = A.Fake<ISpider>(); var scanner = A.Fake<IScanner>(); var zap = new Zap(A.Fake<ISettings>(), A.Fake<ILogger>(), scanner, A.Fake<IReporting>(), spider) { sleepTimeBetweenRequests = 0 }; A.CallTo(() => spider.Start(A<string>.Ignored)).Returns(true); A.CallTo(() => spider.HasCompleted()).Returns(true); zap.Scan("http://www.somefakeurl.com"); A.CallTo(() => spider.HasCompleted()).MustHaveHappened(); }
private static async Task GenerateBearerTokens(TestContext context) { var azureConfig = new AzureAdConfig() { Authority = context.Config.AzureAdConfiguration.Authority, ClientId = context.Config.AzureAdConfiguration.ClientId, ClientSecret = context.Config.AzureAdConfiguration.ClientSecret, TenantId = context.Config.AzureAdConfiguration.TenantId }; context.Tokens.VideoApiBearerToken = await ConfigurationManager.GetBearerToken( azureConfig, context.Config.VhServices.VhVideoApiResourceId); context.Tokens.VideoApiBearerToken.Should().NotBeNullOrEmpty(); Zap.SetAuthToken(context.Tokens.VideoApiBearerToken); }
private IEnumerator lerpZapToThisMagnet(Zap zap) { float currTime = 0; zap.AddAndShowPoints(); while (currTime < m_LerpTime) { currTime += Time.deltaTime; zap.transform.position = Vector3.Lerp(zap.transform.position, this.transform.position, currTime / m_LerpTime); zap.transform.localScale = Vector3.Lerp(zap.transform.localScale, Vector3.zero, currTime / m_LerpTime); yield return(null); } m_LucrativeZaps.Remove(zap); m_ZapsAlreadyBeingLerped.Remove(zap); Destroy(zap.gameObject); }
public void MoveHorizontally() { // switch next and curr zap if we have a next zap if (m_NextZap != null) { m_StartPosition = m_NextZap.GetOffsetPosition(); m_CurrZap = m_NextZap; m_CurrCol = m_NextCol; } // check to make sure we don't go out of bounds ZapGrid currZapGrid = GameMaster.Instance.m_ZapManager.GetZapGrid(); if (currZapGrid != null) { if (m_IsMovingRight) { if (m_NextCol + 1 < currZapGrid.GetNumCols(m_CurrRow)) { m_NextCol++; } else { m_IsMovingRight = false; m_NextCol--; } } else { if (m_NextCol - 1 >= 0) { m_NextCol--; } else { m_IsMovingRight = true; m_NextCol++; } } m_NextZap = currZapGrid.GetZap(m_CurrRow, m_NextCol); m_TargetPosition = m_NextZap.GetOffsetPosition(); m_StartPosition = this.transform.position; } }
private IEnumerator rotateToTargetThenFire(Zap targetZap) { float currTime = 0; Quaternion startRotation = this.transform.rotation; while (currTime < m_ShootInterval) { currTime += Time.deltaTime; Vector3 vectorToTarget = targetZap.GetCenter() - transform.position; float angle = Mathf.Atan2(vectorToTarget.y, vectorToTarget.x) * Mathf.Rad2Deg; Quaternion q = Quaternion.AngleAxis(angle, Vector3.forward); transform.rotation = Quaternion.Slerp(transform.rotation, q, currTime / m_ShootInterval); yield return(null); } zapsAlreadyShotAt.Add(targetZap); Fire(targetZap); startShootTimer(); }
private IEnumerator spawnLaser() { ZapManager zapManager = GameMaster.Instance.m_ZapManager; if (zapManager) { ZapGrid zapGrid = zapManager.GetZapGrid(); int numRows = zapGrid.GetNumRows(); int numCols = zapGrid.GetNumCols(0); // get random row to spawn lasers on int randomRow = Random.Range(0, numRows); Zap zapInRow = zapGrid.GetZap(randomRow, 0); // spawn on left or right side of the screen int randomSide = Random.Range(0, 2); bool isOnRightSide = (randomSide == 1) ? true : false; Vector3 spawnPos = Vector3.zero; // spawn the laser Laser laserInstance = Instantiate(m_LaserPrefab, this.transform); // make changes to lasers position based on if it is on left or right side of the screen. if (randomSide == 0) // spawn on left side of screen { spawnPos = Utility.ScreenUtilities.GetWSofSSPosition(0.0f, 0.0f); } else // spawn on right side of screen { spawnPos = Utility.ScreenUtilities.GetWSofSSPosition(1.0f, 0.0f); } // make sure the laser is spawned at the same y position as the zap row. spawnPos.y = zapInRow.GetOffsetPosition().y; spawnPos.z = 80.0f; laserInstance.SetPositionLaserPost(spawnPos, isOnRightSide); } yield return(new WaitForSeconds(m_SpawnTime)); StartCoroutine(spawnLaser()); }
// gets called when we reach a zap (one time per zap) private void fillMovementData() { if (m_MovementState == MovementState.MovingHorizontal) { MoveHorizontally(); } else if (m_MovementState == MovementState.MovingVertical) { Zap zapMovedThrough = getZapCurrentlyUnderneath(); bool isRocketZap = zapMovedThrough is RocketZap; if (!isRocketZap) { MoveVertically(); } zapMovedThrough.ApplyImmediateEffect(); } else if (m_MovementState == MovementState.MovingToZapGrid) { ZapGrid currZapGrid = GameMaster.Instance.m_ZapManager.GetZapGrid(); m_TargetPosition = currZapGrid.GetZap(0, 0).GetOffsetPosition(); } }
private static void startSecurityScan(Configuration config) { if (config.SecurityScan) { try { Console.WriteLine("Attempting to start security scanning..."); // Start the scanner Zap.StartSecurityScanning(config.ProxyOverride, true); Console.WriteLine("Started security scanning..."); } catch (Exception e) { WriteErrorToConsole(e); WriteErrorToFile(config, e); } finally { // Set back the proxy value in case we changed it and it didn't work if (!Zap.IsRunning(config.ProxyOverride)) { Console.WriteLine("Unable to verify if ZAP proxy was started. Test proxy is reset."); // Reset the test proxy config.ProxyOverride = ""; } } } else if (!string.IsNullOrEmpty(config.SecurityScanReport)) { // We're generating a report, so assume ZAP is already running // Set back the proxy value in case we changed it and it didn't work if (!Zap.IsRunning(config.ProxyOverride)) { Console.WriteLine("ZAP not detected, but scan report requested. Test proxy has been reset."); // Reset the test proxy config.ProxyOverride = ""; } } }
public void ZapReport() { Zap.ReportAndShutDown("VideoApi - Acceptance", ServicesConfiguration.VideoApiUrl); }
public void ZapStart() { Zap.Start(); }
public void ZapReport() { Zap.ReportAndShutDown("BookingsApi-Integration", ServicesConfiguration.BookingsApiUrl); }
public void Scan_WhenCalled_CallsSpiderStart() { var spider = A.Fake<ISpider>(); var zap = new Zap(A.Fake<ISettings>(), A.Fake<ILogger>(), A.Fake<IScanner>(), A.Fake<IReporting>(), spider); zap.Scan("http://www.somefakeurl.com"); A.CallTo(() => spider.Start("http://www.somefakeurl.com")).MustHaveHappened(); }