Inheritance: IRelationManager
Ejemplo n.º 1
0
        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();
                }
            };
        }
Ejemplo n.º 2
0
        public Creature(ICreatureInitializer initializer, CreatureFactory factory)
        {
            ID              = j++;
            Factory         = factory;
            RelationManager = new DefaultRelationManager(initializer.RelationToken, initializer.EnemiesTokens);
            Possessions     = initializer.PossessionItems.ToList();

            var loc = initializer.Location;

            if (!initializer.Location.Tile.IsInitialized)
            {
                initializer.Location.Tile.Initialized += (s, e) => InitializeTileRelated(loc);
            }
            else
            {
                InitializeTileRelated(initializer.Location);
            }

            //if (!initializer.Location.Tile.LayoutManager.TryGetSpace(this, initializer.Location.Space))
            //    throw new ArgumentException("Location is not accessible!");

            HealthProperty health;

            properties           = InitProperties(initializer.HitPoints, out health);
            health.ValueChanged += TryDie;
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 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);
 }