当前位置: 首页>>代码示例>>C#>>正文


C# IEntity.GetComponent方法代码示例

本文整理汇总了C#中IEntity.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# IEntity.GetComponent方法的具体用法?C# IEntity.GetComponent怎么用?C# IEntity.GetComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEntity的用法示例。


在下文中一共展示了IEntity.GetComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

	void Update(IEntity entity)
	{
		var focus = entity.GetComponent<FocusingThingComponent>();
		var breathing = entity.GetComponent<BreathingNode>();
		var time = entity.GetComponent<TimeComponent>();

		var player = EntityManager.Entities.Filter(typeof(PlayerConsentrationComponent))[0].GetComponent<PlayerConsentrationComponent>();
		var focusCircle = focus.zone.WorldCircle;

		if (focusCircle.Contains(Camera.main.GetMouseWorldPosition()) && breathing.actif)
		{
			focus.Sprite.color = focus.FocusedColor;
			handleFocus(focus, breathing, time);
		}
		else
		{
			focus.Sprite.color = focus.UnfocusedColor;
			focus.Sprite.transform.SetScale(new Vector3(1, 1, 1));
		}

		if (breathing.actif && breathing.counter > breathing.Activatingtime)
		{
			var scaleFocus = focus.Sprite.transform.localScale.x;
			var scaleBreathing = breathing.IndicatorTransform.localScale.x;

			if (Mathf.Abs(scaleFocus - scaleBreathing) >= focus.precisionNeeded)
				player.Consentration -= focus.damage * time.DeltaTime;
			else
				player.Consentration += focus.regen * time.DeltaTime;

		}
	}
开发者ID:Magicolo,项目名称:MarmeladeDesImpulsions,代码行数:32,代码来源:FocusingThingSysteme.cs

示例2: Init

 public override void Init(IEntity entity)
 {
     base.Init(entity);
     _transform = entity.GetComponent<ITranslateComponent>();
     _uiEvents = entity.GetComponent<IUIEvents>();
     _uiEvents.MouseDown.Subscribe(onMouseDown);
 }
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:7,代码来源:AGSDraggableComponent.cs

示例3: Update

	void Update(IEntity entity)
	{
		var oscillator = entity.GetComponent<SpeedOscillator>();
		var mouvementSpeed = entity.GetComponent<MouvementSpeedComponent>();
		var time = entity.GetComponent<TimeComponent>();
		mouvementSpeed.Speed = oscillator.Center + oscillator.Amplitude * Mathf.Sin(oscillator.Frequency * time.Time);
	}
开发者ID:Magicolo,项目名称:MarmeladeDesImpulsions,代码行数:7,代码来源:SpeedOscillatorSystem.cs

示例4: Update

	void Update(IEntity entity)
	{
		var consentrationComponent = entity.GetComponent<PlayerConsentrationComponent>();
		var consentrationZone = consentrationComponent.zone.WorldCircle;
		var loseLife = entity.GetComponent<LoseLifeWhenOutOfConsentrationComponent>();
		var time = entity.GetComponent<TimeComponent>();

		if (time.DeltaTime <= 0) return;

		var zones = EntityManager.Entities.Filter(typeof(ConsentrationKeeperZone));

		bool colideWithSomething = false;
		foreach (var zone in zones.ToArray())
		{
			if (zone.GetComponent<ConsentrationKeeperZone>().zone.WorldCircle.Intersects(consentrationZone))
			{
				colideWithSomething = true;
				continue;
			}
		}

		if (colideWithSomething)
			consentrationComponent.Consentration += Time.deltaTime * loseLife.gainPerSecond;
		else
			consentrationComponent.Consentration -= Time.deltaTime * loseLife.amountPerSecond;
	}
开发者ID:Magicolo,项目名称:MarmeladeDesImpulsions,代码行数:26,代码来源:LoseLifeOnWhenOutOfConsentrationZone.cs

示例5: Init

 public override void Init(IEntity entity)
 {
     base.Init(entity);
     _characterName = entity.ID;
     _emitter.Translate = entity.GetComponent<ITranslateComponent>();
     _emitter.HasRoom = entity.GetComponent<IHasRoom>();
 }
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:7,代码来源:AGSSayBehavior.cs

示例6: Update

	void Update(IEntity entity)
	{
		var pathFollower = entity.GetComponent<PathFollower>();
		var path = pathFollower.Path.GetComponent<SimpleWaypointsPath>();
		var movementSpeed = entity.GetComponent<MouvementSpeedComponent>();
		var time = entity.GetComponent<TimeComponent>();
		if (time.DeltaTime <= 0) return;

		Transform wp = path.Waypoints[pathFollower.CurrentPathIndexTarget];

		TendTo(pathFollower, wp, movementSpeed.Speed);

		if ((pathFollower.transform.position - wp.position).magnitude <= 0.1f)
		{
			if (pathFollower.random)
			{
				pathFollower.CurrentPathIndexTarget = PRandom.Range(0, path.Waypoints.Length - 1);
			}
			else
			{
				pathFollower.CurrentPathIndexTarget++;
				if (pathFollower.CurrentPathIndexTarget >= path.Waypoints.Length)
					pathFollower.CurrentPathIndexTarget = 0;
			}
		}
	}
开发者ID:Magicolo,项目名称:MarmeladeDesImpulsions,代码行数:26,代码来源:FellowPathSystem.cs

示例7: Init

		public override void Init(IEntity entity)
		{
			base.Init(entity);
            _entity = entity;
			_enabled = entity.GetComponent<IEnabledComponent>();
			_visible = entity.GetComponent<IVisibleComponent>();
			_gameEvents.OnRepeatedlyExecute.SubscribeToAsync(onRepeatedlyExecute);
		}
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:8,代码来源:AGSUIEvents.cs

示例8: Init

		public override void Init(IEntity entity)
		{
			base.Init(entity);
			_drawableInfo = entity.GetComponent<IDrawableInfo>();
			_obj = entity.GetComponent<IAnimationContainer>();
            _scale = entity.GetComponent<IScaleComponent>();
            _pixelPerfect = entity.GetComponent<IPixelPerfectComponent>();
		}
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:8,代码来源:AGSCollider.cs

示例9: Init

		public override void Init (IEntity entity)
		{
			base.Init (entity);
            _follower = entity;
			_walk = entity.GetComponent<IWalkBehavior>();
			_hasRoom = entity.GetComponent<IHasRoom> ();
			_obj = entity.GetComponent<ITranslateComponent> ();
		}
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:8,代码来源:AGSFollowBehavior.cs

示例10: Update

	void Update(IEntity entity)
	{
		var time = entity.GetComponent<TimeComponent>();
		var colorizer = entity.GetComponent<ConcentrationColorizerComponent>();
		var value = Mathf.Clamp01(level.Concentration * (colorizer.Concentration.Max - colorizer.Concentration.Min) + colorizer.Concentration.Min);
		var color = colorizer.Color.Evaluate(value);

		colorizer.Renderer.color = Color.Lerp(colorizer.Renderer.color, color, time.DeltaTime * colorizer.FadeSpeed);
	}
开发者ID:Magicolo,项目名称:MarmeladeDesImpulsions,代码行数:9,代码来源:ConcentrationColorizerSystem.cs

示例11: Init

        public override void Init(IEntity entity)
        {
            base.Init(entity);
            _events = entity.GetComponent<IUIEvents>();
            _animation = entity.GetComponent<IAnimationContainer>();

            _events.MouseEnter.Subscribe(onMouseEnter);
            _events.MouseLeave.Subscribe(onMouseLeave);
            _events.MouseUp.Subscribe(onMouseUp);
        }
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:10,代码来源:AGSCheckboxComponent.cs

示例12: Init

		public override void Init(IEntity entity)
		{
			base.Init(entity);
			_collider = entity.GetComponent<ICollider>();
			_drawableInfo = entity.GetComponent<IDrawableInfo>();
			_tree = entity.GetComponent<IInObjectTree>();
			_visible = entity.GetComponent<IVisibleComponent>();
			_enabled = entity.GetComponent<IEnabledComponent>();
			_gameEvents.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute);
		} 
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:10,代码来源:AGSSliderComponent.cs

示例13: Update

	void Update(IEntity entity)
	{
		var colorOverTime = entity.GetComponent<TextMeshColorOverLifeTime>();
		var lifeTime = entity.GetComponent<LifeTimeComponent>();
		var player = EntityManager.Entities.Filter(typeof(PlayerConsentrationComponent))[0].GetComponent<PlayerConsentrationComponent>();
		var levelData = EntityManager.Entities.Filter(typeof(LevelDataComponent))[0].GetComponent<LevelDataComponent>();

		Color newColor = colorOverTime.ColorGradient.Evaluate(lifeTime.TimeRatio);
		Color color2 = levelData.TextColorOverConcentration.Evaluate(player.T);
		colorOverTime.TargetTextMesh.color = Color.Lerp(newColor, color2, player.T);


	}
开发者ID:Magicolo,项目名称:MarmeladeDesImpulsions,代码行数:13,代码来源:ColorOverTimeSystem.cs

示例14: OnEntityAdded

    public override void OnEntityAdded(IEntity entity)
    {
        base.OnEntityAdded(entity);

        var colorizer = entity.GetComponent<TileColorizerComponent>();
        colorizer.CurrentColor = colorizer.Normal;
    }
开发者ID:Magicolo,项目名称:Isomorphage,代码行数:7,代码来源:TileColorizerSystem.cs

示例15: Update

	void Update(IEntity entity)
	{
		var concentrate = entity.GetComponent<ConcentrateOnHoldComponent>();

		if (concentrate.Hovering && concentrate.Clicking)
			level.Concentration += concentrate.ConcentrationGain * TimeManager.World.DeltaTime * 0.1f;
	}
开发者ID:Magicolo,项目名称:MarmeladeDesImpulsions,代码行数:7,代码来源:ConcentrateOnHoldSystem.cs


注:本文中的IEntity.GetComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。