public Champion(IChampionInitializer initializator, RelationToken relationToken, IEnumerable <RelationToken> enemiesRelationTokens) { RelationManager = new DefaultRelationManager(relationToken, enemiesRelationTokens); var enumerable = initializator.GetProperties(this); properties = enumerable.ToDictionary(p => p.Type); skills = initializator.GetSkills(this).ToDictionary(s => s.Type); bones = initializator.BonesFactory.Create(new ChampionBonesInitializer { Champion = this }); SpellManager = new SpellCastingManager(this); timeEffectStopped = new TaskCompletionSource <bool>(); timeEffectStopped.SetResult(true); var health = (HealthProperty)properties[PropertyFactory <HealthProperty> .Instance]; health.ValueChanged += (sender, value) => { if (Activated && value <= 0) { Kill(); } }; }
public Champion(RelationToken relationToken, IEnumerable <RelationToken> enemiesRelationTokens, IChampionInitializator initializator) : base(Vector3.Zero) { RelationManager = new DefaultRelationManager(relationToken, enemiesRelationTokens); var enumerable = initializator.GetProperties(this); var dictionary = enumerable.ToDictionary(p => p.Type); properties = dictionary; skills = initializator.GetSkills(this).ToDictionary(s => s.Factory); }
public DefaultRelationManager(RelationToken token, IEnumerable<RelationToken> enemies) { RelationToken = token; foreach (var enemyToken in enemies) { if(enemyToken == token) throw new InvalidOperationException("Entity cannot by enemy to itself."); enemyTokens.Add(enemyToken); } }
public DefaultRelationManager(RelationToken token, IEnumerable <RelationToken> enemies) { RelationToken = token; foreach (var enemyToken in enemies) { if (enemyToken == token) { throw new InvalidOperationException("Entity cannot by enemy to itself."); } enemyTokens.Add(enemyToken); } }
public Creature(IGroupLayout layout, ISpaceRouteElement location, RelationToken relationToken, IEnumerable <RelationToken> enemiesTokens, int moveDuration, int detectRange, int sightRange) : base(location.StayPoint) { GroupLayout = layout; MoveDuration = moveDuration; DetectRange = detectRange; SightRange = sightRange; watchAroungOrigin = location.Tile; if (!location.Tile.LayoutManager.TryGetSpace(this, location.Space)) { throw new ArgumentException("Location is not accessable!"); } ((ILocalizable <ISpaceRouteElement>) this).Location = location; RelationManager = new DefaultRelationManager(relationToken, enemiesTokens); ((CubeGraphic)Graphics).Texture = ResourceProvider.Instance.DrawRenderTarget("creature", Color.Red, Color.White); }
public virtual bool IsEnemy(RelationToken relationToken) => enemyTokens.Contains(relationToken);
public Creature(IGroupLayout layout, ISpaceRouteElement location, RelationToken relationToken, IEnumerable<RelationToken> enemiesTokens, int moveDuration, int detectRange, int sightRange) : base(location.StayPoint) { GroupLayout = layout; MoveDuration = moveDuration; DetectRange = detectRange; SightRange = sightRange; watchAroungOrigin = location.Tile; if (!location.Tile.LayoutManager.TryGetSpace(this, location.Space)) throw new ArgumentException("Location is not accessable!"); ((ILocalizable<ISpaceRouteElement>)this).Location = location; RelationManager = new DefaultRelationManager(relationToken, enemiesTokens); ((CubeGraphic) Graphics).Texture = ResourceProvider.Instance.DrawRenderTarget("creature", Color.Red, Color.White); }
public Champion(RelationToken relationToken, IEnumerable<RelationToken> enemiesRelationTokens, IChampionInitializator initializator ) : base(Vector3.Zero) { RelationManager = new DefaultRelationManager(relationToken, enemiesRelationTokens); var enumerable = initializator.GetProperties(this); var dictionary = enumerable.ToDictionary(p => p.Type); properties = dictionary; skills = initializator.GetSkills(this).ToDictionary(s => s.Factory); }