public void UpdateReference() { if (this.parentLayer.TryGetTarget(out AAILayer parentLayer)) { StarLinkEntity starLinkEntity = parentLayer.GetEntityFromAIEntity(this) as StarLinkEntity; this.StarFrom = parentLayer.GetAIEntityFromEntity(starLinkEntity.StarFrom) as AIStarEntity; this.StarTo = parentLayer.GetAIEntityFromEntity(starLinkEntity.StarTo) as AIStarEntity; } }
public override IObject2D CreateObject2D(World2D world2D, ALayer2D layer2D, IObject obj) { if (obj is StarLinkEntity) { StarLinkEntity entity = obj as StarLinkEntity; return(new StarLinkEntity2D(layer2D, this, entity)); } return(null); }
public override IAIObject CreateObjectAI(AIWorld worldAI, AAILayer layerAI, IObject obj) { if (obj is StarLinkEntity) { StarLinkEntity entity = obj as StarLinkEntity; return(new AIStarLinkEntity(layerAI, this, entity)); } return(null); }
protected void InitializeState(StarLinkEntity entity) { this.CurrentColorFrom = this.starEntityFrom.ObjectSprite.Color; this.RatioColorFrom = 0.33f; this.CurrentColorTo = this.starEntityTo.ObjectSprite.Color; this.RatioColorTo = 0.33f; //this.FillRatio = 0; //this.FillRatioState = TargetedFillRatioState.STOP; this.IsFocused = false; this.isActive = entity.IsActive; this.StartNotActiveState(); }
public StarLinkEntity2D(ALayer2D layer2D, IObject2DFactory factory, StarLinkEntity entity) : base(layer2D, factory, entity) { this.currentColorFrom = Color.Black; this.currentColorTo = Color.Black; this.ratioColorFrom = -1; this.ratioLinkTo = -1; this.starEntityFrom = layer2D.GetEntity2DFromEntity(entity.StarFrom) as StarEntity2D; this.starEntityTo = layer2D.GetEntity2DFromEntity(entity.StarTo) as StarEntity2D; //this.fillRatio = 0; this.isFocused = true; this.ObjectSprite.Color = Color.Blue; Shader shader = new Shader(null, null, @"Assets\Graphics\Shaders\LinkSimpleFrag.frag"); Texture distortionMap = factory.GetTextureById("distorsionTexture"); this.ObjectSprite.Texture = factory.GetTextureById("distorsionTexture"); this.ObjectSprite.Texture.Repeated = true; distortionMap.Repeated = true; distortionMap.Smooth = true; shader.SetUniform("currentTexture", new Shader.CurrentTextureType()); shader.SetUniform("distTexture", distortionMap); render = new RenderStates(BlendMode.Alpha); render.Shader = shader; this.UpdateScaling(); this.Priority = 9; this.InitializeState(entity); }
public StarLinkEntity2D(ALayer2D parentLayer, StarLinkEntity entity) : base(parentLayer, null, entity) { }
protected virtual bool IsStarLinkValid(StarLinkEntity link) { return(true); }