Beispiel #1
0
        /// <summary>
        /// Configures this instance.
        /// </summary>
        /// <param name="area">The area.</param>
        /// <param name="damage">The damage.</param>
        /// <param name="targets">The targets.</param>
        /// <param name="owner">The owner.</param>
        /// <exception cref="ArgumentOutOfRangeException">damage - Must be greater than 0.</exception>
        /// <exception cref="ArgumentNullException">
        /// targets
        /// or
        /// owner
        /// </exception>
        public void Setup(AreaTarget area, float damage, ITargetsProvider targets, ITeamMember owner)
        {
            if (area == null)
            {
                DestroyAsPoolableObject();
                return;
            }

            if (damage <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(damage), "Must be greater than 0.");
            }

            this.area    = area;
            this.damage  = damage;
            this.targets = targets ?? throw new ArgumentNullException(nameof(targets));
            this.owner   = owner ?? throw new ArgumentNullException(nameof(owner));

            meteorPaticles.transform.position = new Vector3(area.Position.x, DEFAULT_Y_POSITION, area.Position.z);
            meteorPaticles.transform.rotation = Quaternion.Euler(DEFAULT_ROTATION);

            var shape = meteorPaticles.shape;

            shape.angle  = 0;
            shape.radius = area.Radius;

            StartCoroutine(DealingDamage());
        }
Beispiel #2
0
 public UssdController(IOrganisationAsync organisation, ICustomer customer, ITeamMember teamMember, IReviewNotification reviewNotification, IReview review)
 {
     _organisation       = organisation;
     _customer           = customer;
     _teamMember         = teamMember;
     _reviewNotification = reviewNotification;
     _review             = review;
 }
 protected bool Deactivate(ITeamMember entity)
 {
     // Deactivate it
     TeamMembersRepository.Deactivate(entity);
     // Try to Save Changes
     TeamMembersRepository.SaveChanges();
     // Finished!
     return(true);
 }
Beispiel #4
0
        /// <summary>
        /// Applies the damage to this unit.
        /// </summary>
        /// <param name="attacker">The attacker.</param>
        /// <param name="damage">The damage value.</param>
        public override void ApplyDamage(ITeamMember attacker, float damage)
        {
            base.ApplyDamage(attacker, damage);

            if (!IsAlive && attacker is IExpCollector collector)
            {
                collector.AddExp(unitData.ExpForDie);
            }
        }
Beispiel #5
0
 public virtual bool AreEqual(ITeamMemberModel model, ITeamMember entity)
 {
     return(EntityMapper.AreEqual(model, entity)
            // TeamMember Properties
            // <None>
            // Related Objects
            && model.TeamId == entity.TeamId &&
            model.CharacterId == entity.CharacterId
            );
 }
 public virtual bool AreEqual(ITeamMemberModel model, ITeamMember entity)
 {
     return EntityMapper.AreEqual(model, entity)
         // TeamMember Properties
         // <None>
         // Related Objects
         && model.TeamId == entity.TeamId
         && model.CharacterId == entity.CharacterId
         ;
 }
Beispiel #7
0
        /// <summary>
        /// Setups this arrow.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="owner">The arrow owner.</param>
        /// <param name="speed">The speed.</param>
        /// <param name="damage">The damage.</param>
        /// <exception cref="ArgumentOutOfRangeException">damage - Must be greater than or equal to 0.</exception>
        public void ArrowSetup(ITarget target, ITeamMember owner, float speed, float damage)
        {
            BulletSetup(target, owner, speed);

            if (damage < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(damage), "Must be greater than or equal to 0.");
            }

            this.damage = damage;
        }
Beispiel #8
0
        /// <summary>
        /// Setups this bullet.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="bulletOwner">The bullet owner.</param>
        /// <param name="speed">The speed.</param>
        /// <exception cref="ArgumentOutOfRangeException">speed - Must be greater than or equal to 0.</exception>
        protected void BulletSetup(ITarget target, ITeamMember bulletOwner, float speed)
        {
            if (speed < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(speed), "Must be greater than or equal to 0.");
            }

            this.target      = target;
            this.bulletOwner = bulletOwner;
            this.speed       = speed;
        }
Beispiel #9
0
        /// <summary>
        /// Gets the unit target for the specified team member.
        /// </summary>
        /// <param name="member">The team member.</param>
        /// <returns>The unit.</returns>
        /// <exception cref="NullReferenceException">member</exception>
        public ITarget GetUnitTargetFor(ITeamMember member)
        {
            if (member.IsNullOrMissing())
            {
                throw new NullReferenceException(nameof(member));
            }

            var teamOpponents = GetOpponentsTeam(member.Team);

            return(UnitsKeeper.FindClosestUnit(teamOpponents, member.transform.position) as ITarget);
        }
Beispiel #10
0
        public IssueEstimation(IIssue issue, ITeamMember teamMember, IList <Transportation.Entities.IssueEstimation> issueEstimations)
        {
            Issue            = issue;
            TeamMember       = teamMember;
            _issueEstimation = issueEstimations.First(x => x.IsFinal);

            History = new List <IIssueEstimationHistory>();
            foreach (Transportation.Entities.IssueEstimation issueEstimation in issueEstimations)
            {
                History.Add(new IssueEstimationHistory(issueEstimation.Estimation, issueEstimation.CreatedAt));
            }
        }
 protected bool Remove(ITeamMember entity)
 {
     if (entity == null)
     {
         return(true);
     }                                    // No entity found to remove, consider it passed
     // Remove it
     TeamMembersRepository.Remove(entity);
     // Try to Save Changes
     TeamMembersRepository.SaveChanges();
     // Finished!
     return(true);
 }
Beispiel #12
0
        public static ITeamMember Create(ITeamMember entity, MySqlConnection dbConn)
        {
            string query = "INSERT INTO TeamMembers (team_id, person_id) VALUES (@team, @person)";
            Dictionary <string, string> param = new Dictionary <string, string>();

            param.Add("@team", entity.TeamId.ToString());
            param.Add("@person", entity.PersonId.ToString());

            var resultsPK = DatabaseHelper.GetNonQueryCount(query, dbConn, param);

            entity.PersonTeamId = resultsPK;
            return(entity);
        }
Beispiel #13
0
        public virtual ITeamMemberModel MapToModelListing(ITeamMember entity, int currentDepth = 1)
        {
            currentDepth++;
            var model = EntityMapper.MapToModelListing <ITeamMember, TeamMemberModel>(entity);

            // TeamMember Properties
            // <None>
            // Related Objects
            model.TeamId      = entity.TeamId;
            model.CharacterId = entity.CharacterId;
            // Return Entity
            return(model);
        }
        /// <summary>
        /// Creates the freezing effect.
        /// </summary>
        /// <param name="effectOwner">The effect owner.</param>
        /// <param name="objectsPool">The objects pool.</param>
        /// <exception cref="ArgumentNullException">
        /// effectOwner
        /// or
        /// objectsPool
        /// </exception>
        /// <returns>The effect using this effect date.</returns>
        public IEffect CreateEffect(ITeamMember effectOwner, IObjectsPool objectsPool)
        {
            if (effectOwner == null)
            {
                throw new ArgumentNullException(nameof(effectOwner));
            }

            if (objectsPool == null)
            {
                throw new ArgumentNullException(nameof(objectsPool));
            }

            return(new Effect(this, objectsPool, effectOwner));
        }
Beispiel #15
0
 public virtual void MapToEntity(ITeamMemberModel model, ref ITeamMember entity, int currentDepth = 1)
 {
     currentDepth++;
     // Assign Base properties
     EntityMapper.MapToEntity(model, ref entity);
     // TeamMember Properties
     // <None>
     // Related Objects
     entity.TeamId      = model.TeamId;
     entity.Team        = (Team)model.Team?.MapToEntity();
     entity.CharacterId = model.CharacterId;
     entity.Character   = (Character)model.Character?.MapToEntity();
     // Associated Objects
     // <None>
 }
 public virtual void MapToEntity(ITeamMemberModel model, ref ITeamMember entity, int currentDepth = 1)
 {
     currentDepth++;
     // Assign Base properties
     EntityMapper.MapToEntity(model, ref entity);
     // TeamMember Properties
     // <None>
     // Related Objects
     entity.TeamId = model.TeamId;
     entity.Team = (Team)model.Team?.MapToEntity();
     entity.CharacterId = model.CharacterId;
     entity.Character = (Character)model.Character?.MapToEntity();
     // Associated Objects
     // <None>
 }
Beispiel #17
0
        public static ITeamMember Delete(ITeamMember entity, MySqlConnection dbConn)
        {
            string query = "DELETE FROM TeamMembers WHERE person_team_id = @id";
            Dictionary <string, string> param = new Dictionary <string, string>();

            param.Add("@id", entity.PersonTeamId.ToString());

            var result = DatabaseHelper.GetNonQueryCount(query, dbConn, param);

            if (result != 0)
            {
                return(entity);
            }

            return(null);
        }
 public virtual ITeamMemberModel MapToModel(ITeamMember entity, int currentDepth = 1)
 {
     currentDepth++;
     var model = EntityMapper.MapToModel<ITeamMember, TeamMemberModel>(entity);
     // TeamMember Properties
     // <None>
     // Related Objects
     model.TeamId = entity.TeamId;
     model.Team = entity.Team?.MapToModel();
     model.CharacterId = entity.CharacterId;
     model.Character = entity.Character?.MapToModel();
     // Associated Objects
     // <None>
     // Return Entity
     return model;
 }
Beispiel #19
0
        public static ITeamMember Update(ITeamMember entity, MySqlConnection dbConn)
        {
            string query = "UPDATE TeamMembers SET team_id = @team, person_id = @person WHERE person_team_id = @id";
            Dictionary <string, string> param = new Dictionary <string, string>();

            param.Add("@team", entity.TeamId.ToString());
            param.Add("@person", entity.PersonId.ToString());
            param.Add("@id", entity.PersonTeamId.ToString());

            var result = DatabaseHelper.GetNonQueryCount(query, dbConn, param);

            if (result != 0)
            {
                return(entity);
            }

            return(null);
        }
Beispiel #20
0
        /// <summary>
        /// Applies the damage to this unit.
        /// </summary>
        /// <param name="attacker">The attacker.</param>
        /// <param name="damage">The damage value.</param>
        /// <exception cref="ArgumentOutOfRangeException">damage - Must be greater than or equal to 0.</exception>
        public virtual void ApplyDamage(ITeamMember attacker, float damage)
        {
            if (damage < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(damage), "Must be greater than or equal to 0.");
            }

            if (!IsAlive)
            {
                return;
            }

            HealPoints -= GetDamageReducedByArmor(damage);

            if (!IsAlive)
            {
                Die();
            }

            UpdateShowableHealth();
        }
Beispiel #21
0
        /// <summary>
        /// Applies the damage.
        /// </summary>
        /// <param name="attacker">The attacker.</param>
        /// <param name="damage">The damage.</param>
        /// <exception cref="ArgumentOutOfRangeException">damage - Must be greater than or equal to 0.</exception>
        public void ApplyDamage(ITeamMember attacker, float damage)
        {
            if (damage < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(damage), "Must be greater than or equal to 0.");
            }

            HealPoints -= (int)damage;

            if (HealPoints <= 0)
            {
                Die();
            }

            var changedHealth = new ChangedHealthArgs(
                currentHealth: HealPoints,
                fullness: HealPoints > 0 ? (float)HealPoints / healPointsMax : 0f,
                description: GetHealthDescription()
                );

            OnHealthChanges?.Invoke(changedHealth);
        }
Beispiel #22
0
        public IEnumerable <Unit> ControllableUnits => Enumerable.Repeat(this, 1); // Make enumerable from this one unit.

        /// <summary>
        /// Determines whether this instance can be attacked by the specified attacker.
        /// </summary>
        /// <param name="attacker">The attacker.</param>
        /// <returns>
        ///   <c>true</c> if this instance can be attacked by the specified attacker; otherwise, <c>false</c>.
        /// </returns>
        public override bool CanBeAttackedBy(ITeamMember attacker) => attacker.Team == Team.Enemies;
Beispiel #23
0
 /// <summary>
 /// Setups this magic arrow.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="owner">The arrow owner.</param>
 /// <param name="speed">The speed.</param>
 /// <param name="effect">The effect.</param>
 /// <exception cref="ArgumentNullException">effect</exception>
 public void MagicArrowSetup(ITarget target, ITeamMember owner, float speed, IEffect effect)
 {
     BulletSetup(target, owner, speed);
     this.effect = effect ?? throw new ArgumentNullException(nameof(effect));
 }
 public static bool AreEqual(this ITeamMemberModel model, ITeamMember entity)
 {
     return Mapper.AreEqual(model, entity);
 }
Beispiel #25
0
 public static ITeamMemberModel MapToModelListing(this ITeamMember entity, int currentDepth = 1)
 {
     return(Mapper.MapToModelListing(entity, currentDepth));
 }
 protected bool Remove(ITeamMember entity)
 {
     if (entity == null) { return true; } // No entity found to remove, consider it passed
     // Remove it
     TeamMembersRepository.Remove(entity);
     // Try to Save Changes
     TeamMembersRepository.SaveChanges();
     // Finished!
     return true;
 }
Beispiel #27
0
 public TeamMemberController(ITeamMember teamMemberService)
 {
     _teamMemberService = teamMemberService;
 }
Beispiel #28
0
 /// <summary>
 /// Determines whether this instance can be attacked by the specified attacker.
 /// </summary>
 /// <param name="attacker">The attacker.</param>
 /// <returns>
 ///   <c>true</c> if this instance can be attacked by the specified attacker; otherwise, <c>false</c>.
 /// </returns>
 public override bool CanBeAttackedBy(ITeamMember attacker) => attacker.Team == Team.Friends;
Beispiel #29
0
 /// <summary>
 /// Determines whether this instance can be attacked by the specified attacker.
 /// </summary>
 /// <param name="attacker">The attacker.</param>
 /// <returns>
 ///   <c>true</c> if this instance can be attacked by the specified attacker; otherwise, <c>false</c>.
 /// </returns>
 public abstract bool CanBeAttackedBy(ITeamMember attacker);
Beispiel #30
0
 public TeamMemberController(ITeamMember teamMember, CrExtContext context)
 {
     _teamMember = teamMember;
     _context    = context;
 }
Beispiel #31
0
 public HomeController(ITeamMember team)
 {
     _team = team;
 }
 public void Update(ITeamMember entity)
 {
     Context.SetModified(entity);
 }
 protected bool Deactivate(ITeamMember entity)
 {
     // Deactivate it
     TeamMembersRepository.Deactivate(entity);
     // Try to Save Changes
     TeamMembersRepository.SaveChanges();
     // Finished!
     return true;
 }
 public void Deactivate(ITeamMember entity)
 {
     entity.Active = false;
     Update(entity);
 }
 public void Remove(ITeamMember entity)
 {
     Context.TeamMembers.Remove((TeamMember)entity);
 }
Beispiel #36
0
 public static void MapToEntity(this ITeamMemberModel model, ref ITeamMember entity, int currentDepth = 1)
 {
     Mapper.MapToEntity(model, ref entity, currentDepth);
 }
 public void Update(ITeamMember entity)
 {
     Context.SetModified(entity);
 }
Beispiel #38
0
 public static bool AreEqual(this ITeamMemberModel model, ITeamMember entity)
 {
     return(Mapper.AreEqual(model, entity));
 }
 public static void MapToEntity(this ITeamMemberModel model, ref ITeamMember entity, int currentDepth = 1)
 {
     Mapper.MapToEntity(model, ref entity, currentDepth);
 }
Beispiel #40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Effect"/> class.
 /// </summary>
 /// <param name="data">The effect data.</param>
 /// <param name="objectsPool">The objects pool.</param>
 /// <param name="effectOwner">The effect owner (caster).</param>
 /// <exception cref="ArgumentNullException">
 /// data
 /// or
 /// objectsPool
 /// or
 /// effectOwner
 /// </exception>
 public Effect(IEffectData data, IObjectsPool objectsPool, ITeamMember effectOwner)
 {
     this.data   = data ?? throw new ArgumentNullException(nameof(data));
     ObjectsPool = objectsPool ?? throw new ArgumentNullException(nameof(objectsPool));
     Owner       = effectOwner ?? throw new ArgumentNullException(nameof(effectOwner));
 }
 public void Add(ITeamMember entity)
 {
     Context.TeamMembers.Add((TeamMember)entity);
 }