private bool TimeInfluenceActivated(Collider other, float time) { bool ok = false; //if(other.tag != "Enemy") for (int i = 0; i < tags.Length; i++) { string auxTag = tags[i]; if (other.tag == auxTag) { TimeComponent timeComponent = other.GetComponent <TimeComponent>(); //bool foundID = searchID(timeComponent); //if (!foundID) //{ if (timeComponent != null) { timeComponent.TimeInfluence = time; } // listTimeComponents.Add(timeComponent); //other.transform.GetInstanceID()); //} ok = true; break; } } return(ok); }
// Create all the components that should be used by this game private void CreateComponents() { _menuComponent = new MenuComponent(this); Components.Add(_menuComponent); _backgroundComponent = new BackgroundComponent(this); Components.Add(_backgroundComponent); _actorComponent = new ActorComponent(this); Components.Add(_actorComponent); _collisionComponent = new CollisionComponent(this); Components.Add(_collisionComponent); _scoreComponent = new ScoreComponent(this); Components.Add(_scoreComponent); _timeComponent = new TimeComponent(this); Components.Add(_timeComponent); _speedComponent = new SpeedComponent(this); Components.Add(_speedComponent); _statusComponent = new StatusComponent(this); Components.Add(_statusComponent); }
bool isPressing(int button) { if (button == -1) { return(false); } if (Mathf.Abs(StartRail - EndRail) == 0) { if (TimeComponent.isKeyPressing(StartRail)) { return(true); } } else { for (int i = -1; i <= 1; i++) { if (TimeComponent.isKeyPressing(TimeComponent.GetKeyRail(Range(button + i, 0, 14)))) { return(true); } } } return(false); }
private void StopAttacking(TimeComponent time) { nextAttackTime = time.Time + 1f / AttackSpeed; nextStopTime = nextAttackTime + ContinuousDuration.GetRandom(); Entity.SendMessage(EntityMessages.OnStopAttacking); startedAttacking = false; }
void OnEndTimeFieldEdition(TimeComponent timeComponent, string str) { int number = Convert.ToInt32(str); timeValuesEntered[(int)timeComponent] = Mathf.Clamp(number, MinTimeValue, MaxTimeValue); timeFields[(int)timeComponent].text = timeValuesEntered[(int)timeComponent].ToString("00"); }
private void AssertInvalidTimeComponent(string input, DateTime baseDate) { var components = TimeComponent.GetComponentsFromText(input); var componentPeriod = components.Select(c => c.GetTimePeriod(baseDate)).FirstOrDefault(); Assert.IsNull(componentPeriod); }
private IEnumerable <TemporalComponent> GetComponentsFromText(string text) { var components = new List <TemporalComponent>(); var dateComponents = DateComponent.GetComponentsFromText(text); components.AddRange(dateComponents); var timeComponents = TimeComponent.GetComponentsFromText(text); components.AddRange(timeComponents); var sequenceComponents = SequenceComponent.GetComponentsFromText(text); components.AddRange(sequenceComponents); var fuzzyComponents = FuzzyComponent.GetComponentsFromText(text); components.AddRange(fuzzyComponents); var durationComponents = DurationComponent.GetComponentsFromText(text); components.AddRange(durationComponents); var relativeComponents = RelativeDateTimeComponent.GetComponentsFromText(text); components.AddRange(relativeComponents); return(components); }
private double GetRandomTime(TimeComponent thisTimeComponent) { double result = 0; switch (thisTimeComponent) { case TimeComponent.hours: result = ImSoRandom.Next(0, 24); break; case TimeComponent.minutes: result = ImSoRandom.Next(0, 60); break; case TimeComponent.seconds: result = ImSoRandom.Next(0, 60); break; case TimeComponent.milliseconds: result = ImSoRandom.Next(0, 1000); break; default: break; } return(result); }
// Update is called once per frame void Update() { if (CountdownFlag && !flag) { flag = true; Countdown = DOTween.Sequence() .Prepend( DOTween.To(() => CountStartNumber, (n) => CountStartNumber = n, 0, 18) .OnUpdate(() => ContinueCheckColor[1].text = CountStartNumber.ToString()) .OnComplete(() => { Continue(false); ButtonPressed = true; }) .SetEase(Ease.Linear) ); } if (!ButtonPressed && CountdownFlag) { if (TimeComponent.isKeyPressed(0) || TimeComponent.isKeyPressed(1)) { Continue(true); ButtonPressed = true; } else if (TimeComponent.isKeyPressed(3) || TimeComponent.isKeyPressed(4)) { Continue(false); ButtonPressed = true; } } }
public Sun(double Latitude, double Tilt) { this._Visual = new SunVisualComponent(this); this._Time = new TimeComponent(); this._Latitude = Latitude; this._Tilt = Tilt; }
public override void OnInspectorGUI() { serializedObject.Update(); TimeComponent t = (TimeComponent)target; if (!EditorApplication.isPlaying) { EditorGUILayout.HelpBox("Available during runtime only.", MessageType.Info); return; } EditorGUILayout.LabelField("GameTime", t.GameTime.ToString()); EditorGUILayout.LabelField("RealGameTime", t.RealGameTime.ToString()); if (EditorApplication.isPlaying && PrefabUtility.GetPrefabType(t.gameObject) != PrefabType.Prefab) { EditorGUILayout.LabelField("TimeActionCount", t.TimeActionCount.ToString()); TimeAction[] timeActions = t.GetAllTimeAction(); foreach (TimeAction timeAction in timeActions) { DrawTimeAction(timeAction); } } serializedObject.ApplyModifiedProperties(); Repaint(); }
void Start() { for (int i = 0; i < timeFields.Length; i++) { TimeComponent timeComponent = (TimeComponent)i; timeFields[i].onEndEdit.AddListener((str) => OnEndTimeFieldEdition(timeComponent, str)); } }
private void breatheIn(BreathingNode node, TimeComponent time) { var min = node.BreatheEmptyCircleScale; var max = node.BreatheFullCircleScale; var t = (node.counter - node.Activatingtime) / node.BreatheInTime; Vector3 scale = Vector3.Lerp(new Vector3(min, min, 1), new Vector3(max, max, 1), t); node.IndicatorTransform.transform.localScale = scale; }
public void Cache(WorldContext worldContext) { inputComponent = worldContext.Get <InputComponent>(0); superhonkComponent = worldContext.Get <SUPERHONKComponent>(0); timeComponent = worldContext.Get <TimeComponent>(0); }
public void Execute() { Entity e = _group.GetSingleEntity(); TimeComponent time = e.time; time.deltaTime = Time.deltaTime * time.modificator; time.time = Time.time; }
void IECSSystem.Execute(ECSEngine engine, ECSEntity[] entities) { for (int i = 0; i < entities.Length; i++) { ECSEntity entity = entities[i]; TimeComponent tc = engine.GetComponent <TimeComponent>(entity); tc.CurrentTime -= Time.DeltaTime; if (tc.CurrentTime <= 0f) { tc.CurrentTime += tc.Time; SpawnPointComponent pc = engine.GetComponent <SpawnPointComponent>(entity); var enemy = engine.CreateEntity(); engine.AddComponent <NameComponent>(enemy, new NameComponent() { Name = "ENEMY" }); engine.AddComponent <PositionComponent>(enemy, new PositionComponent() { Position = pc.SpawnPoint }); engine.AddComponent <VelocityComponent>(enemy, new VelocityComponent() { Velocity = new Vector2(0f, 5f) }); engine.AddComponent(enemy, new BoxColliderComponent() { Size = new Vector2(1f, 1f) }); engine.AddComponent <SpriteRendererComponent>(enemy, new SpriteRendererComponent() { RenderOffset = RenderOffset.Player, Texture = TextureManager.GetTexture("EnemyBlack2"), Sprite = new Sprite(1f, 1f) { pivot = Vector2.One * 0.5f } }); engine.AddComponent <AIComponent>(enemy, new AIComponent()); } engine.SetComponent <TimeComponent>(entity, tc); } }
private void PerformTimeSlide( ) { TimeComponent timeHandler = Player.GetComponent <TimeComponent>( ); double progress = this.TimeSlider.Value / this.TimeSlider.Maximum; timeHandler.SetPosition(progress); SliderTimer.Stop( ); timeHandler.StopChangingPosition( ); }
public void Cache(WorldContext worldContext) { doombaAIComponents = worldContext.GetComponentsContainer <DoombaAIComponent>(); tileFieldComponent = worldContext.Get <TileFieldComponent>(0); timeComponent = worldContext.Get <TimeComponent>(0); obstaclesLayer = LayerMask.GetMask("Obstacles"); }
public void Execute() { TimeComponent time = _time.GetSingleEntity().time; if (time.isPaused) { return; } foreach (Entity e in _group.GetEntities()) { fuckThemWithLaser(e); } }
private static string TimeComponentToString(TimeComponent timeComponent) { var timeComponentName = timeComponent.Type.ToString().ToLower(); timeComponentName = timeComponent.Value == 1 ? timeComponentName.Remove(timeComponentName.Length - 1) : timeComponentName; return($"{timeComponent.Value} {timeComponentName}"); }
private void AssertValidTimeComponent(ITimePeriod expected, string input, DateTime baseDate) { var components = TimeComponent.GetComponentsFromText(input); Assert.IsTrue(components.Any()); var componentPeriod = components.FirstOrDefault().GetTimePeriod(baseDate); Assert.IsNotNull(componentPeriod); Assert.AreEqual(expected.Start, componentPeriod.Start); Assert.AreEqual(expected.End, componentPeriod.End); }
/// <summary> /// Finds the Start Date for an Event which has no holiday or Weekend in it. /// </summary> /// <param name="startDate">Date when the action was initiated.</param> /// <param name="workStartTime">Time Work is to start on a daily basis.</param> /// <param name="workClosingTime">Time Work is to close on a daily basis.</param> /// <param name="holidayDates">List of holiday dates in a year for a specific locations as determined by the internal/external system.</param> /// <returns></returns> private static DateTime EventStartDate(DateTime startDate, TimeComponent workStartTime, TimeComponent workClosingTime, List <DateTime> holidayDates) { try { return(WorkDateTime(startDate, workStartTime, workClosingTime, holidayDates)); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
void Update() { if (this.gameObject.activeSelf) { transform.localPosition = new Vector3(transform.localPosition.x, GameManager.NoteY, transform.localPosition.z) - (new Vector3(0, 1f, 0) * speed * (float)(TimeComponent.GetCurrentTimePast() - StartTime)); } if (this.transform.position.y < -2.5f) { this.gameObject.SetActive(false); ScoreCalculation.SetNoteJudgement(ScoreCalculation.Judgement.Miss, 3); } if (this.gameObject.activeSelf) { double diff = System.Math.Abs(TimeComponent.GetPressedKeyTime(Rail) - ArrivalTime); if (diff <= ScoreCalculation.DetectionRange.Bad && diff > ScoreCalculation.DetectionRange.Good) //Bad { this.gameObject.SetActive(false); ScoreCalculation.SetNoteJudgement(ScoreCalculation.Judgement.Bad, 3); AddEffect(ScoreCalculation.Judgement.Bad); //GameManager.DebugLog(this.gameObject.name + "番のノーツ: Bad"); } else if (diff <= ScoreCalculation.DetectionRange.Good && diff > ScoreCalculation.DetectionRange.Great) //Good { audioSource[0].PlayOneShot(NoteGoodSE); this.gameObject.SetActive(false); ScoreCalculation.SetNoteJudgement(ScoreCalculation.Judgement.Good, 3); AddEffect(ScoreCalculation.Judgement.Good); //GameManager.DebugLog(this.gameObject.name + "番のノーツ: Good"); } else if (diff <= ScoreCalculation.DetectionRange.Great && diff > ScoreCalculation.DetectionRange.Perfect) //Great { audioSource[0].PlayOneShot(NoteGreatSE); audioSource[1].PlayOneShot(NoteSpecialSE); this.gameObject.SetActive(false); ScoreCalculation.SetNoteJudgement(ScoreCalculation.Judgement.Great, 3); AddEffect(ScoreCalculation.Judgement.Great); //GameManager.DebugLog(this.gameObject.name + "番のノーツ: Great"); } else if (diff <= ScoreCalculation.DetectionRange.Perfect && diff >= 0) //Perfect { audioSource[0].PlayOneShot(NotePerfectSE); audioSource[1].PlayOneShot(NoteSpecialSE); this.gameObject.SetActive(false); ScoreCalculation.SetNoteJudgement(ScoreCalculation.Judgement.Perfect, 3); AddEffect(ScoreCalculation.Judgement.Perfect); //GameManager.DebugLog(this.gameObject.name + "番のノーツ: Perfect"); } } }
public void Cache(WorldContext worldContext) { tossedComponents = worldContext.GetComponentsContainer <TossedComponent>(); vfxPoolComponent = worldContext.Get <VFXPoolComponent>(0); timeComponent = worldContext.Get <TimeComponent>(0); antagonistComponent = worldContext.Get <AntagonistComponent>(0); obstacleLayer = LayerMask.NameToLayer("Obstacles"); enemiesLayer = LayerMask.NameToLayer("Enemies"); }
private void handleFocus(FocusingThingComponent focus, BreathingNode breathing, TimeComponent time) { float scale = focus.Sprite.transform.localScale.x; float breathingScale = breathing.Sprite.transform.localScale.x; float diff = Mathf.Abs(breathingScale - scale); float growthSpeed = Mathf.Max(3.5f, diff * 2); float growth = growthSpeed * time.DeltaTime; if (Input.GetMouseButton(0)) focus.Sprite.transform.SetScale(new Vector3(scale + growth, scale + growth, 1)); else if (Input.GetMouseButton(1)) focus.Sprite.transform.SetScale(new Vector3(scale - growth, scale - growth, 1)); }
private long ParseTimeSpan(string field, int defaultValue) { long timeSpanValue = 0; char[] delimiterChars = { ':' }; string[] timeComponents = field.Split(delimiterChars); int start = 4 - timeComponents.Length; if (start >= 0) { int loop = 0; int index = start; for (; loop < timeComponents.Length; loop++, index++) { TimeComponent tc = (TimeComponent)index; switch (tc) { case TimeComponent.day: timeSpanValue += (long)decimalFormatter.ParseInt(timeComponents[loop]) * secondsPerDay; break; case TimeComponent.hour: timeSpanValue += (long)decimalFormatter.ParseInt(timeComponents[loop]) * secondsPerHour; break; case TimeComponent.minute: timeSpanValue += (long)decimalFormatter.ParseInt(timeComponents[loop]) * secondsPerMinute; break; case TimeComponent.second: timeSpanValue += (long)decimalFormatter.ParseInt(timeComponents[loop]); break; default: break; } } } if (0 == timeSpanValue) { timeSpanValue = defaultValue; } timeSpanValue *= oneHundredNanosecondsPerSecond; return(timeSpanValue); }
private static int IndexOf(string value, TimeComponent year) { var suffixes = TimeSuffixes[year]; foreach (var suffix in suffixes) { var index = value.IndexOf(suffix, StringComparison.OrdinalIgnoreCase); if (index >= 0) { return(index); } } return(-1); }
TimeSpan ParseTimeComponent(TimeComponent component) { var amount = Double.Parse(component.Amount); switch (component.Units.ToLowerInvariant()) { case "m": return(TimeSpan.FromMinutes(amount)); case "h": return(TimeSpan.FromHours(amount)); default: throw new InvalidOperationException("Unsupported units value in a time"); } }
public void Execute(List <Entity> entities) { Entity time = _time.GetSingleEntity(); TimeComponent component = time.time; if (!component.isPaused) { component.modificator = 0.0f; component.isPaused = true; } else { component.isPaused = false; component.modificator = 1.0f; } }
public void Execute(List <Entity> entities) { float value = 1.0f; if (entities[0].hasSlowGame) { value = entities[0].slowGame.value; } Entity time = _time.GetSingleEntity(); TimeComponent component = time.time; if (!component.isPaused) { component.modificator = value; } }
public void Cache(WorldContext worldContext) { terminatorAIComponents = worldContext.GetComponentsContainer <TerminatorAIComponent>(); h0ncker = worldContext.Get <InputComponent>(0).Entity; playersPositionComponent = h0ncker.GetComponent <PositionComponent>(); timeComponent = worldContext.Get <TimeComponent>(0); vfxPoolComponent = worldContext.Get <VFXPoolComponent>(0); obstaclesLayer = LayerMask.GetMask("Obstacles"); playerLayer = LayerMask.GetMask("Player"); navMeshPath = new NavMeshPath(); }
public void Cache(WorldContext worldContext) { projectileComponents = worldContext.GetComponentsContainer <ProjectileComponent>(); timeComponent = worldContext.Get <TimeComponent>(0); vfxPoolComponent = worldContext.Get <VFXPoolComponent>(0); antagonistComponent = worldContext.Get <AntagonistComponent>(0); obstacleLayer = LayerMask.NameToLayer("Obstacles"); itemsLayer = LayerMask.NameToLayer("Items"); enemiesLayer = LayerMask.NameToLayer("Enemies"); playerLayer = LayerMask.NameToLayer("Player"); }
/// <summary> /// Determines whether the day and time supplied is neither an holiday date nor a weekend date. /// If it is, it gives the nearest day and time that is a working time as described by the WorkStartTime & WorkClosingTime. /// </summary> /// <param name="startDate">Date when the action was initiated.</param> /// <param name="workStartTime">Time Work is to start on a daily basis.</param> /// <param name="workClosingTime">Time Work is to close on a daily basis.</param> /// <param name="holidayDates">List of holiday dates in a year for a specific locations as determined by the internal/external system.</param> /// <returns></returns> public static DateTime WorkDateTime(DateTime startDate, TimeComponent workStartTime, TimeComponent workClosingTime, List <DateTime> holidayDates) { try { DateTime unexaminedDateTime = startDate; while (NonHolidayDay(unexaminedDateTime, holidayDates) != NonWeekendDay(unexaminedDateTime, workStartTime, workClosingTime)) { unexaminedDateTime = NonHolidayDay(unexaminedDateTime, holidayDates); unexaminedDateTime = NonWeekendDay(unexaminedDateTime, workStartTime, workClosingTime); } return(unexaminedDateTime); } catch (Exception ex) { throw new Exception(ex.Message, ex.InnerException); } }
void Awake() { FinishedFlag = false; MaximumScoreForDisplay = 0; TimeComponent.music = audioSource; Debug.Log("ゲームが開始されました"); GameStatus = Status.Initializing; //ノーツ初期化 foreach (Transform childTransform in NotesParentObject.transform) { Destroy(childTransform.gameObject); } TimeComponent.ResetStartTime(); //到着時間 if (MusicID == "") { speed = DataHolder.NoteSpeed; } NoteSpeed = speed; ArrivalTime = (NoteY - DetectionLineY) / speed; //シーンチェンジ画面取得 SceneChange = GameObject.Find("Scene Change"); //Video用RawImage初期化 rawImage.SetActive(true); videoPlayer = rawImage.GetComponent <VideoPlayer>(); Color col = rawImage.GetComponent <RawImage>().color; col.a = 1f; rawImage.GetComponent <RawImage>().color = col; renderTexture.Release(); //初期映像再生 videoPlayer.url = DefaultVideoClip.originalPath; videoPlayer.source = VideoSource.Url; videoPlayer.Play(); StartCoroutine("StartSettings"); }
private void breatheHold(BreathingNode node, TimeComponent time) { }
bool isPaused(TimeComponent timeComponent) { return timeComponent.isPaused; }
public void Start() { Time = Entity.GetComponent<TimeComponent>(); Animator = Entity.GameObject.GetComponent<Animator>(); updateIdleTime(); likesToClap = ChanceToClap.GetRandom(ProbabilityDistributions.Uniform); likesToBanana = ChanceToBanana.GetRandom(ProbabilityDistributions.Uniform); likesToCough = ChanceToCough.GetRandom(ProbabilityDistributions.Uniform); likesToBoo = ChanceToBoo.GetRandom(ProbabilityDistributions.Uniform); likesToFirst1 = ChanceToFirst1.GetRandom(ProbabilityDistributions.Uniform); likesToFirst2 = ChanceToFirst2.GetRandom(ProbabilityDistributions.Uniform); likesToWave = ChanceToWave.GetRandom(ProbabilityDistributions.Uniform); }
private void StopAttacking(TimeComponent time) { nextAttackTime = time.Time + 1f / AttackSpeed; Animator.SetTrigger(StopAttackingTriggerName); currentState = State.Reloading; Entity.SendMessage(EntityMessages.OnStopAttacking); }