コード例 #1
0
ファイル: EnemyLocator.cs プロジェクト: Mojopon/360Shooter
    public IEnemy GetNearestEnemyFromTheEntity(IFieldEntity entity)
    {
        IEnemy nearestEnemy = null;
        float nearestDistance = Mathf.Infinity;

        foreach(IEnemy enemy in enemies)
        {
            float distanceToTheEntity = Vector2.Distance(entity.GetPosition(), enemy.GetPosition());
            if (nearestDistance > distanceToTheEntity)
            {
                nearestDistance = distanceToTheEntity;
                nearestEnemy = enemy;
            }
        }

        return nearestEnemy;
    }
コード例 #2
0
    public IEnemy GetNearestEnemyFromTheEntity(IFieldEntity entity)
    {
        IEnemy nearestEnemy    = null;
        float  nearestDistance = Mathf.Infinity;

        foreach (IEnemy enemy in enemies)
        {
            float distanceToTheEntity = Vector2.Distance(entity.GetPosition(), enemy.GetPosition());
            if (nearestDistance > distanceToTheEntity)
            {
                nearestDistance = distanceToTheEntity;
                nearestEnemy    = enemy;
            }
        }

        return(nearestEnemy);
    }
コード例 #3
0
        private int GetStrengthForPlayerAtPositionRecursive(Vector2Int pos, Vector2Int dir, PlayerKey requestingPlayer)
        {
            pos += dir;
            if (!fieldEntities.ContainsKey(pos))
            {
                return(0);
            }
            IFieldEntity fieldEntity = fieldEntities[pos];

            if (fieldEntity.TryGetEntity <CardInstance <Monster> >(out CardInstance <Monster> monster))
            {
                if (cardInstances[monster] == requestingPlayer)
                {
                    return(GetStrengthForPlayerAtPositionRecursive(pos, dir, requestingPlayer) + monster.data.combatValue);
                }
                else
                {
                    return(0);
                }
            }
            return(0);
        }
コード例 #4
0
ファイル: BoardEntity.cs プロジェクト: PaulRdi/infopraktikum
 public void Init(FieldEntity <CardInstance <Monster> > cardInstance)
 {
     data = cardInstance;
 }
コード例 #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 bool IEquatable <IFieldEntity <Guid> > .Equals(IFieldEntity <Guid> other)
 {
     return(Equals(other));
 }
コード例 #6
0
 /// <summary>
 /// Indicates whether the current <see cref="object"/> is equal to another <see
 /// cref="object"/> of the same type.
 /// </summary>
 /// <param name="other">An <see cref="object"/> to compare with this <see cref="object"/>.</param>
 /// <returns>
 /// <c>true</c> if the current <see cref="object"/> is equal to the <paramref
 /// name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <seealso cref="M:System.IEquatable{Jaytas.Omilos.Common.Domain.Interfaces.IBaseEntity{Guid}}.Equals(IBaseEntity{Guid})"/>
 public virtual bool Equals(IFieldEntity <Guid> other)
 {
     return(null != other && other.ExposedId.Equals(ExposedId));
 }