void Start() { if (gm == null) { gm = gameObject.GetComponent <GameManager>(); } if (player == null) { player = GameObject.FindWithTag("Player"); } if (canBeatLevel == true) { Time.timeScale = 0.5f; FunctionTimer.Create(() => TargetScoreDisplay.enabled = false, 2f); FunctionTimer.Create(() => Time.timeScale = 1, 2f); } playerHealth = player.GetComponent <Health>(); // setup score display Collect(0); // make other UI inactive gameOverCanvas.SetActive(false); if (canBeatLevel) { beatLevelCanvas.SetActive(false); } }
public void Should_be_fast() { Fiber fiber = new ThreadPoolFiber(); const int limit = 5000000; var complete = new Future<int>(); Channel<MsgStruct> channel = new ConsumerChannel<MsgStruct>(fiber, message => { if (message.Count == limit) complete.Complete(limit); }); using (var timer = new FunctionTimer("Throughput", x => { Trace.WriteLine("Time to execute: " + (int) x.ElapsedMilliseconds + "ms"); Trace.WriteLine("Per second throughput: " + (int) (limit/(x.ElapsedMilliseconds/1000))); })) { for (int i = 1; i <= limit; i++) { channel.Send(new MsgStruct { Count = i, Other = i*8, }); } timer.Mark(); complete.WaitUntilCompleted(30.Seconds()).ShouldBeTrue(); } }
private void Move() { var x = DMath.Random(_minRotation.x, _maxRotation.x); var y = DMath.Random(_minRotation.y, _maxRotation.y); var z = DMath.Random(_minRotation.z, _maxRotation.z); var desiredRotation = new Vector3(x, y, z); float duration = DMath.Random(_duration); if (IsPanic) { duration /= _panicSpeedUpFactor; } transform.DORotate(desiredRotation, duration).SetEase(Ease.InOutSine); float delay = DMath.Random(_delay); if (IsPanic) { delay /= _panicSpeedUpFactor; } FunctionTimer.Create(Move, delay); }
protected void submitButton_Click(object sender, EventArgs e) { using (var timer = new FunctionTimer("_Default submiteButton_Click", x => timerLabel.Text = x)) { User user; using (IRepository <User> repository = DomainContext.ServiceLocator.GetInstance <IRepositoryFactory>().GetRepository <User>()) { user = repository.Where(u => u.Username == username.Text).FirstOrDefault(); } if (user != null) { if (user.CheckPassword(password.Text)) { if ((user.HasEmailBeenConfirmed ?? false)) { ((TulsaTechFest)this.Master).SetNotice("user access granted"); } else { ((TulsaTechFest)this.Master).SetError("e-mail not yet confirmed"); } } else { ((TulsaTechFest)this.Master).SetError(string.Format("Invalid password specified for user '{0}'", username.Text)); } } else { ((TulsaTechFest)this.Master).SetError(string.Format("User not found: '{0}'", username.Text)); } } }
void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("HurtBox")) { FunctionTimer.Create(() => Destroy(this.gameObject), 1f); } }
private void SixthPhaseStart() { //going to 0 wind speed FunctionTimer.Create(() => WindController.Instance.ChangeState(1), 0.5f, currentTutorialPhase.ToString());; FunctionTimer.Create(ShowTutorialTextBox, 3f, currentTutorialPhase.ToString()); FunctionTimer.Create(AdvanceTutorialPhase, 8f, currentTutorialPhase.ToString()); }
private void ThirdPhaseStart() { FunctionTimer.Create(ShowTutorialTextBox, 1f, currentTutorialPhase.ToString()); //FunctionTimer.Create(() => tutorialFuelTankMarker.GetComponent<FadeInOut>().FadeIn(), 1f, currentTutorialPhase.ToString()); //FunctionTimer.Create(() => tutorialFuelTankMarker.GetComponent<FadeInOut>().FadeOut(), 7f, currentTutorialPhase.ToString()); FunctionTimer.Create(AdvanceTutorialPhase, 8f, currentTutorialPhase.ToString()); }
public void ExecuteAction() { ChatBubble.Create(gameObject.transform, new Vector3(1f, 1.7f), ChatBubble.IconType.Happy, text); FunctionTimer.Create(() => { onChatBubbleComplete.ExecuteAction(); }, 2f); }
// check answer private IEnumerator _checkwait(float timeshow, float timeguess) { yield return(new WaitForSeconds(timeshow)); //Debug.Log("ah"); FunctionTimer.Create(CheckNumbers, timeguess); }
private void SecondPhaseStart() { FunctionTimer.Create(ShowTutorialTextBox, 1f, currentTutorialPhase.ToString()); FunctionTimer.Create(() => ShowTutorialMarker(TutorialMarker.MarkerAnimation.SwipeDown), 1f, currentTutorialPhase.ToString()); FunctionTimer.Create(() => EnableCooling = true, 1f, currentTutorialPhase.ToString()); secondPhaseTimer = 3f; //TODO: test }
public void SpawnSmoke(Vector3 position, float timer, Vector3 localScale) { FunctionTimer.Create(() => { Transform smokeTransform = UnityEngine.Object.Instantiate(GameAssets.i.pfSmokePuff, position, Quaternion.identity); smokeTransform.localScale = localScale; }, timer); }
void Blst() { //if (Input.GetKey(KeyCode.Space) && !activated && refill) if (CrossPlatformInputManager.GetButton("Jump") && !activated && refill) { activated = true; ball.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePosition; ball.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation; Blast.transform.rotation = Quaternion.Euler(blastpos); Blast.Play(); Refill(); enemies = Physics.OverlapSphere(ball.transform.position, explosionradius); foreach (Collider i in enemies) { if (i.tag == "Enemies") { Vector3 oppdir = (i.transform.position - ball.transform.position); float dist = Vector3.Distance(ball.transform.position, i.transform.position); dist = 10 - dist; i.attachedRigidbody.AddForce(oppdir * 30 * dist); } } FunctionTimer.Create(() => ball.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None, 1f); FunctionTimer.Create(() => Blast.Stop(), timer); FunctionTimer.Create(() => Blast.Clear(), timer); FunctionTimer.Create(() => activated = false, timer); } }
public override void Update() { if (CanBeseen()) { nextState = new NpcHide(npc, agent, anim); stage = EVENT.EXIT; } agent.SetDestination(safe.transform.position); if (agent.remainingDistance <= agent.stoppingDistance) { anim.SetTrigger("isIdle"); agent.isStopped = true; if (look) { npc.transform.LookAt(target.transform.position); } if (activated) { FunctionTimer.Create(() => nextState = new NpcScout(npc, agent, anim), 5f); FunctionTimer.Create(() => stage = EVENT.EXIT, 5f); activated = false; } else { base.Update(); } } }
private void HandleGridMovement() { gridMoveTimer += Time.deltaTime; if (gridMoveTimer >= gridMoveTimerMax) { gridMoveTimer -= gridMoveTimerMax; snakeMovePositionList.Insert(0, gridPosition); gridPosition += gridMoveDirection; // bool snakeAteFood = levelGrid.TrySnakeEatFood (gridPosition); // if (snakeAteFood) { // snakeBodySize++; // CreateSnakeBody(); // } if (snakeMovePositionList.Count >= snakeBodySize + 1) { snakeMovePositionList.RemoveAt(snakeMovePositionList.Count - 1); } for (int i = 0; i < snakeMovePositionList.Count; i++) { Vector2Int snakeMovePosition = snakeMovePositionList[i]; World_Sprite worldSprite = World_Sprite.Create(new Vector3(snakeMovePosition.x, snakeMovePosition.y), Vector3.one * .5f, Color.white); FunctionTimer.Create(worldSprite.DestroySelf, gridMoveTimerMax); } transform.position = new Vector3(gridPosition.x, gridPosition.y); transform.eulerAngles = new Vector3(0, 0, GetAngleFromVector(gridMoveDirection) - 90); } }
public void BoostHandlePulled() { if (!ShipSpeedController.Instance.IsBoosting && IsBoostAvailable()) { if (boostPercentage >= GlobalGameplayVariables.Instance.BoostThreshold) { //TODO: make this an additive thing like tweening FunctionTimer.Create(() => StartCoroutine(CameraShake.Instance.Shake(1f, 0.02f)), 0f); FunctionTimer.Create(() => StartCoroutine(CameraShake.Instance.Shake(1.6f, 0.4f)), 1f); FunctionTimer.Create(() => StartCoroutine(CameraShake.Instance.Shake(3.4f, 0.08f)), 2.6f); FunctionTimer.Create(() => StartCoroutine(CameraShake.Instance.Shake(5f, 0.04f)), 6f); //Handheld.Vibrate(); //DashboardManager.Instance.TurnOffDashboard(); DashboardManager.Instance.TurnOffBoostPullie(); SoundManager.Instance.PlaySoundEffect(SoundManager.SoundEffect.Dashboard_Boost); ShipSpeedController.Instance.StartBoosting(); } //TODO: animate emptying... //TODO: sound of negative feedback if the handle was used when tank not critical: boostPercentage = 0; } }
private void FirstPhaseUpdate() { if (!PhaseEndConditionMet && EngineController.Instance.HeatLevel > 90) { PhaseEndConditionMet = true; FunctionTimer.Create(AdvanceTutorialPhase, 3f, currentTutorialPhase.ToString()); } }
public void startDeath() { anim.SetBool("playerDead", true); pc.playerCanMove = false; FunctionTimer.Create(endDeathAction, 3f); }
public void The_output_should_include_property_values() { using (var tracker = new FunctionTimer <MyData>("TEST", VerifyCalled)) { tracker.Values.QueryCount = 5; tracker.Values.QueryAmount = 123.45m; } }
private void Start() { FunctionTimer.Create(() => { entranceDoorAnims.SetColor(DoorAnims.ColorName.Green); }, 3.0f); FunctionTimer.Create(() => { entranceDoorAnims.OpenDoor(); }, 3.5f); CinematicBars.Show_Static(150f, .01f); FunctionTimer.Create(() => { CinematicBars.Show_Static(0f, .5f); }, 3f); }
public void ScreenShake() { CinemachineBasicMultiChannelPerlin cinemachineBasicMultiChannelPerlin = cinemachineVirtualCamera.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>(); cinemachineBasicMultiChannelPerlin.m_AmplitudeGain = 1f; FunctionTimer.Create(() => { cinemachineBasicMultiChannelPerlin.m_AmplitudeGain = 0f; }, .1f); }
public void ResetWithDelay() { isReseting = true; speed = minSpeed; transform.position = original_pos; rb.velocity = Vector2.zero; FunctionTimer.Create(ResetBall, 2f); }
public void Restart() { //fade out faderAnimator.SetBool("Fade", true); //restart FunctionTimer.Create(() => FlowardSceneManager.Instance.LoadFloawardScene(FlowardScene.Gameplay), 1f); }
public void The_output_should_include_property_values() { using (var tracker = new FunctionTimer<MyData>("TEST", VerifyCalled)) { tracker.Values.QueryCount = 5; tracker.Values.QueryAmount = 123.45m; } }
private void FifthPhaseUpdate() { if (!PhaseEndConditionMet && SailsController.Instance.State == SailsState.SailsDown) { PhaseEndConditionMet = true; FunctionTimer.Create(AdvanceTutorialPhase, 3f, currentTutorialPhase.ToString()); } }
private void FifthPhaseStart() { //going to -1 wind FunctionTimer.Create(() => WindController.Instance.ChangeState(-3), 0.5f, currentTutorialPhase.ToString());; FunctionTimer.Create(() => EnableSailsDown = true, 3f, currentTutorialPhase.ToString()); FunctionTimer.Create(ShowTutorialTextBox, 3f, currentTutorialPhase.ToString()); FunctionTimer.Create(() => ShowTutorialMarker(TutorialMarker.MarkerAnimation.SwipeRight), 3f, currentTutorialPhase.ToString()); }
private void FourthPhaseStart() { //going to 2 wind speed FunctionTimer.Create(() => WindController.Instance.ChangeState(2), 0.5f, currentTutorialPhase.ToString());; FunctionTimer.Create(() => EnableSailsUp = true, 3f, currentTutorialPhase.ToString()); FunctionTimer.Create(ShowTutorialTextBox, 3f, currentTutorialPhase.ToString()); FunctionTimer.Create(() => ShowTutorialMarker(TutorialMarker.MarkerAnimation.SwipeLeft), 3f, currentTutorialPhase.ToString()); }
private void EnemySpawner_OnPlayerTriggerEnter2D(object sender, System.EventArgs e) { FunctionTimer.Create(SpawnEnemy, .1f); FunctionTimer.Create(SpawnEnemy, .3f); FunctionTimer.Create(SpawnEnemy, .6f); FunctionTimer.Create(SpawnEnemy, .8f); FunctionTimer.Create(SpawnEnemy, 1.1f); FunctionTimer.Create(SpawnEnemy, 1.5f); }
private void FocusGameView(bool state) { var profileHub = gameObject.FindOrCreate <PostProcessingProfileHub>(); profileHub.Current = state ? _focusedPP : _defaultPP; FunctionTimer.Create(() => SwitchCanvases(state), .5f); _playerRenderer.gameObject.SetActive(!state); }
// create timer public static FunctionTimer Create(Action action, float timer) { GameObject gameObject = new GameObject("FunctionTimer", typeof(MonoBehaviourHook)); FunctionTimer functiontimer = new FunctionTimer(action, timer, gameObject); gameObject.GetComponent <MonoBehaviourHook>().onUpdate = functiontimer.Update; return(functiontimer); }
public static FunctionTimer Create(Action action, float time) { GameObject g = new GameObject("Function Timer", typeof(MonoHook)); FunctionTimer funcTimer = new FunctionTimer(action, time, g); g.GetComponent <MonoHook>().timerupdate = funcTimer.update; return(funcTimer); }
private void Start() { if (GameData.state == GameData.State.Start) { FunctionTimer.Create(() => { Show(); }, 1f); } Hide(); }
private void EndBattle() { if (doorAnims != null) { doorAnims.SetColor(DoorAnims.ColorName.Green); FunctionTimer.Create(doorAnims.OpenDoor, 1.5f); } OnBattleEnded?.Invoke(this, EventArgs.Empty); }
public void The_tracker_should_do_its_job() { string header; using (var tracker = new FunctionTimer("TEST", VerifyCalled)) { using (var mark = tracker.Mark()) { } header = tracker.Header; } Assert.AreEqual("Date Time TimeTaken Mark1 Description", header); }