public void Two_entities_with_the_same_Id_should_equal_each_other()
        {
            var first = new Entity{Id = 99};
            var second = new Entity { Id = 99 };

            first.Equals(second).ShouldBeTrue();
            second.Equals(first).ShouldBeTrue();

            Equals(first, second).ShouldBeTrue();
            Equals(second, first).ShouldBeTrue();

            first.GetHashCode().ShouldEqual(second.GetHashCode());

            (first == second).ShouldBeTrue();
            (second == first).ShouldBeTrue();

            (first != second).ShouldBeFalse();
            (second != first).ShouldBeFalse();
        }
        public void Two_entities_with_different_Ids_should_not_equal_each_other()
        {
            var first = new Entity { Id = 66 };
            var second = new Entity { Id = 77 };

            first.Equals(second).ShouldBeFalse();
            second.Equals(first).ShouldBeFalse();

            Equals(first, second).ShouldBeFalse();
            Equals(second, first).ShouldBeFalse();

            first.GetHashCode().ShouldNotEqual(second.GetHashCode());

            (first == second).ShouldBeFalse();
            (second == first).ShouldBeFalse();

            (first != second).ShouldBeTrue();
            (second != first).ShouldBeTrue();
        }
        protected override void OnUpdate()
        {
            if (!SceneManager.GetActiveScene().name.Equals("Stranded"))
            {
                return;
            }

            if (agentTransformGO == null)
            {
                agentTransformGO = GameObject.Find("Player GO");
                if (agentTransformGO == null)
                {
                    return;
                }
            }

            if (cursor == null)
            {
                cursor = GameObject.Find("3D Cursor");
                if (cursor == null)
                {
                    return;
                }
            }

            if (cursorRenderer == null)
            {
                var cursorMesh = cursor.transform.GetChild(0);

                if (cursorMesh == null)
                {
                    return;
                }

                cursorRenderer = cursorMesh.GetComponent <Renderer>();

                if (cursorRenderer == null)
                {
                    return;
                }

                cursorRenderer.enabled = false;
            }

            var keyboard = Keyboard.current;

            if (keyboard == null)
            {
                return;
            }

            try
            {
                playerEntity = GetSingletonEntity <Player>();
            }
            catch
            {
                return;
            }

            if (playerEntity.Equals(Entity.Null))
            {
                return;
            }

            var agentPosition = EntityManager.GetComponentData <LocalToWorld>(playerEntity).Position;

            agentTransformGO.transform.SetPositionAndRotation(agentPosition, Quaternion.identity);

            var mouse = Mouse.current;

            var point = new Vector3(
                mouse.position.x.ReadValue(),
                mouse.position.y.ReadValue()
                );

            var pointOnNavigableSurface = NavUtil.GetPointOnNavigableSurface(
                point,
                playerEntity,
                Camera.main,
                physicsWorld,
                500,
                EntityManager,
                filter,
                out var hit
                );

            if (pointOnNavigableSurface)
            {
                cursorRenderer.enabled = true;

                var cursorPosition = hit.Position;
                cursorPosition.y += 1;

                cursor.transform.position = cursorPosition;

                cursor.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.SurfaceNormal);

                if (mouse != null && mouse.leftButton.isPressed)
                {
                    EntityManager.AddComponentData(playerEntity, new NavDestination
                    {
                        WorldPoint = hit.Position,
                        Tolerance  = 1
                    });
                }
            }
            else
            {
                cursorRenderer.enabled = false;
            }
        }
Beispiel #4
0
 public bool Equals(HalfEdgeEntity other)
 {
     return(HalfEdge.Equals(other.HalfEdge) && Entity.Equals(other.Entity));
 }
        public Entity FindGraphicsEntityFromPhysics(Entity bodyEntity, ColliderKey leafColliderKey)
        {
            if (bodyEntity.Equals(Entity.Null))
            {
                // No Physics so no Graphics
                return(Entity.Null);
            }

            // Set the Graphics Entity to the supplied Physics Entity
            var renderEntity = bodyEntity;

            // Check if we have hit a leaf node
            if (!leafColliderKey.Equals(ColliderKey.Empty))
            {
                // Get the Physics Collider
                var rootCollider = EntityManager.GetComponentData <PhysicsCollider>(bodyEntity).Value;

                // If we hit a CompoundCollider we need to find the original Entity associated
                // the actual leaf Collider that was hit.
                if (rootCollider.Value.Type == ColliderType.Compound)
                {
                    #region Find a Leaf Entity and ColliderKey
                    var leafEntity = Entity.Null;
                    unsafe
                    {
                        var rootColliderPtr = rootCollider.AsPtr();

                        // Get the leaf Collider and check if we hit was a PolygonCollider (i.e. a Triangle or a Quad)
                        rootColliderPtr->GetLeaf(leafColliderKey, out var childCollider);
                        leafEntity = childCollider.Entity;

                        // PolygonColliders are likely to not have an original Entity associated with them
                        // So if we have a Polygon and it has no Entity then we really need to check for
                        // the higher level Mesh or Terrain Collider instead.
                        var childColliderType      = childCollider.Collider->Type;
                        var childColliderIsPolygon = childColliderType == ColliderType.Triangle || childColliderType == ColliderType.Quad;
                        if (childColliderIsPolygon && childCollider.Entity.Equals(Entity.Null))
                        {
                            // Get the ColliderKey of the Polygon's parent
                            if (TryGetParentColliderKey(rootColliderPtr, leafColliderKey, out leafColliderKey))
                            {
                                // Get the Mesh or Terrain Collider of the Polygon
                                TryGetChildInHierarchy(rootColliderPtr, leafColliderKey, out childCollider);
                                leafEntity = childCollider.Entity;
                            }
                        }
                    }
                    #endregion

                    // The Entities recorded in the leaves of a CompoundCollider may have been correct
                    // at the time of conversion. However, if the Collider blob is shared, or came up
                    // through a sub scene, we cannot assume that the baked Entities in the
                    // CompoundCollider are still valid.

                    // On conversion Entities using a CompoundCollider have an extra dynamic buffer added
                    // which holds a list of Entity/ColliderKey pairs. This buffer should be patched up
                    // automatically and be valid with each instance, at least until you start messing
                    // with the Entity hierarchy yourself e.g. by deleting Entities.

                    #region Check the Leaf Entity is valid
                    // If the leafEntity was never assigned in the first place
                    // there is no point in looking up any Buffers.
                    if (!leafEntity.Equals(Entity.Null))
                    {
                        // Check for an Key/Entity pair buffer first.
                        // This should exist if the Physics conversion pipeline was invoked.
                        var colliderKeyEntityPairBuffers = GetBufferFromEntity <PhysicsColliderKeyEntityPair>(true);
                        if (colliderKeyEntityPairBuffers.HasComponent(bodyEntity))
                        {
                            var colliderKeyEntityBuffer = colliderKeyEntityPairBuffers[bodyEntity];
                            // TODO: Faster lookup option?
                            for (int i = 0; i < colliderKeyEntityBuffer.Length; i++)
                            {
                                var bufferColliderKey = colliderKeyEntityBuffer[i].Key;
                                if (leafColliderKey.Equals(bufferColliderKey))
                                {
                                    renderEntity = colliderKeyEntityBuffer[i].Entity;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            // We haven't found a Key/Entity pair buffer so the compound collider
                            // may have been created in code.

                            // We'll assume the Entity in the CompoundCollider is valid
                            renderEntity = leafEntity;

                            // If this CompoundCollider was instanced from a prefab then the entities
                            // in the compound children would actually reference the original prefab hierarchy.
                            var rootEntityFromLeaf = leafEntity;
                            while (HasComponent <Parent>(rootEntityFromLeaf))
                            {
                                rootEntityFromLeaf = GetComponent <Parent>(rootEntityFromLeaf).Value;
                            }

                            // If the root Entity found from the leaf does not match the body Entity
                            // then we have hit an instance using the same CompoundCollider.
                            // This means we can try and remap the leaf Entity to the new hierarchy.
                            if (!rootEntityFromLeaf.Equals(bodyEntity))
                            {
                                // This assumes there is a LinkedEntityGroup Buffer on original and instance Entity.
                                // No doubt there is a more optimal way of doing this remap with more specific
                                // knowledge of the final application.
                                var linkedEntityGroupBuffers = GetBufferFromEntity <LinkedEntityGroup>(true);

                                // Only remap if the buffers exist, have been created and are of equal length.
                                bool hasBufferRootEntity = linkedEntityGroupBuffers.HasComponent(rootEntityFromLeaf);
                                bool hasBufferBodyEntity = linkedEntityGroupBuffers.HasComponent(bodyEntity);
                                if (hasBufferRootEntity && hasBufferBodyEntity)
                                {
                                    var prefabEntityGroupBuffer   = linkedEntityGroupBuffers[rootEntityFromLeaf];
                                    var instanceEntityGroupBuffer = linkedEntityGroupBuffers[bodyEntity];

                                    if (prefabEntityGroupBuffer.IsCreated && instanceEntityGroupBuffer.IsCreated &&
                                        (prefabEntityGroupBuffer.Length == instanceEntityGroupBuffer.Length))
                                    {
                                        var prefabEntityGroup   = prefabEntityGroupBuffer.AsNativeArray();
                                        var instanceEntityGroup = instanceEntityGroupBuffer.AsNativeArray();

                                        for (int i = 0; i < prefabEntityGroup.Length; i++)
                                        {
                                            // If we've found the renderEntity index in the prefab hierarchy,
                                            // set the renderEntity to the equivalent Entity in the instance
                                            if (prefabEntityGroup[i].Value.Equals(renderEntity))
                                            {
                                                renderEntity = instanceEntityGroup[i].Value;
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    #endregion
                }
            }

            // Finally check to see if we have a graphics redirection on the shape Entity.
            if (HasComponent <PhysicsRenderEntity>(renderEntity))
            {
                renderEntity = GetComponent <PhysicsRenderEntity>(renderEntity).Entity;
            }

            return(renderEntity);
        }
Beispiel #6
0
        public void EntityEqualsObject(Entity entity, object obj, bool expected)
        {
            var areEqual = entity.Equals(obj);

            Assert.Equal(expected, areEqual);
        }
Beispiel #7
0
 public override bool CanSkip(Entity targetEntity) =>
 targetEntity.Equals(base.ownerEntity) || targetEntity.IsSameGroup <TeamGroupComponent>(base.ownerEntity);
Beispiel #8
0
    public void OnObjectMouseDown(Object o)
    {
        Entity currentEntity = entities[currentEntityTurn];

        if (currentEntity.Equals(o))
        {
            NextTurn();
        }
        else if (currentEntity.CompareTag("Player"))
        {
            if (currentAction == 0)
            {
                if (!currentEntity.CanMoveTo(o.Vector2Position))
                {
                    Vector2 rotateTo = (o.Vector2Position - currentEntity.Vector2Position).normalized;

                    if (currentEntity.CanRotateTo(rotateTo))
                    {
                        currentEntity.RotateTo(rotateTo);

                        if (currentEntity is Adventurer)
                        {
                            adventurerMovedOnTurn = true;
                        }
                    }
                }
                else
                {
                    if (o.CompareTag("Walkable"))
                    {
                        if (currentEntity.CanMoveTo(o.Vector2Position))
                        {
                            currentEntity.MoveTo(o.Vector2Position);

                            if (currentEntity is Adventurer)
                            {
                                adventurerMovedOnTurn = true;
                            }
                        }
                        else
                        {
                            Vector2 rotateTo = (o.Vector2Position - currentEntity.Vector2Position).normalized;

                            if (currentEntity.CanRotateTo(rotateTo))
                            {
                                currentEntity.RotateTo(rotateTo);

                                if (currentEntity is Adventurer)
                                {
                                    adventurerMovedOnTurn = true;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                if (o is Entity)
                {
                    if (currentEntity.CanAttack(o.Vector2Position))
                    {
                        Entity enemy = o.GetComponent <Entity>();
                        currentEntity.Attack(enemy);

                        if (currentEntity is Guardian)
                        {
                            enemy.KnockBack(currentEntity.facingDirection);
                        }
                    }
                }
            }
        }
    }
Beispiel #9
0
 public void Should_consider_as_equal_same_Entity_instance()
 {
     Entity.Equals(Entity).Should().BeTrue();
 }
Beispiel #10
0
 public void Should_consider_as_equal_same_instance_of_a_casted_entity()
 {
     Entity.Equals(Entity.ActLike <IProduct>()).Should().BeTrue();
 }
 public bool Equals(BackFaceCandidate other)
 {
     return(HalfEdge.Equals(other.HalfEdge));
 }
        protected override void OnUpdate()
        {
            if (Camera.main.transform.parent == null)
            {
                Camera.main.transform.SetParent(agentTransformGameObject.transform);
            }

            if (teleportationText == null)
            {
                teleportationText = GameObject.Find("Text").GetComponent <Text>();
            }

            var keyboard = Keyboard.current;

            if (keyboard == null)
            {
                return;
            }

            if (keyboard.tKey.wasPressedThisFrame)
            {
                teleport = !teleport;

                if (teleport)
                {
                    teleportationText.text = "Press <b>T</b> to toggle teleportation. It's <b>on</b>.";
                }
                else
                {
                    teleportationText.text = "Press <b>T</b> to toggle teleportation. It's <b>off</b>.";
                }
            }

            try
            {
                entity = GetSingletonEntity <NavAgent>();
            }
            catch
            {
                return;
            }

            if (entity.Equals(Entity.Null))
            {
                return;
            }

            var agentPosition = EntityManager.GetComponentData <LocalToWorld>(entity).Position;

            agentTransformGameObject.transform.SetPositionAndRotation(agentPosition, Quaternion.identity);
            Camera.main.transform.LookAt(agentTransformGameObject.transform, Vector3.up);

            var mouse = Mouse.current;

            if (
                mouse == null ||
                !mouse.leftButton.wasPressedThisFrame ||
                !Physics.Raycast(Camera.main.ScreenPointToRay(new Vector2(mouse.position.x.ReadValue(), mouse.position.y.ReadValue())), out RaycastHit hit)
                )
            {
                return;
            }

            EntityManager.AddComponentData(entity, new NavDestination
            {
                WorldPoint = hit.point,
                Teleport   = teleport
            });
        }
Beispiel #13
0
        /// <summary>
        /// Restores the given entity and recursively its dependencies.
        /// </summary>
        /// <param name="entityName">The name of the given entity.</param>
        /// <param name="entityPrimaryKeyValues">The primary key values of the entity.</param>
        /// <param name="path">The storage path.</param>
        private void InnerLoadEntity(string entityName, List <string> entityPrimaryKeyValues, string path, bool useLock)
        {
            // Check if entity is locked, if not, lock it.
            bool locked = false;

            if (useLock)
            {
                if (IsLocked(entityName))
                {
                    logger.LogInfo("Unable to visit " + entityName + ". It's locked.");
                    return;
                }
                lockedEntities.Push(entityName);
                locked = true;
                logger.LogInfo(entityName + " is now locked.");
            }

            // Get the structure of the entity.
            EntityStructure entityStructure = entityStructures.Find(entityName);

            CheckPrimaryKeyCountsAreEqual(entityPrimaryKeyValues, entityStructure);

            // Return, if the current entity has already been updated in this batch.
            if (IsVisited(entityName, entityPrimaryKeyValues))
            {
                logger.LogIsVisited(entityName, entityPrimaryKeyValues);

                // If the entity was visited, unlock the entity and return.
                if (useLock && locked)
                {
                    logger.LogInfo(entityName + " is now unlocked.");
                    lockedEntities.Pop();
                }

                return;
            }

            // Get the searched entity from the database and from the serialized storage.
            Entity entityFromDb = dbClient.GetEntity(entityStructure, entityPrimaryKeyValues);
            Entity entityFromSerializedStorage = serializedStorageClient.GetEntity(entityStructure, entityPrimaryKeyValues, path);

            try
            {
                visitedEntities.Add(new EntityWithKey(entityName, entityPrimaryKeyValues));
                logger.LogVisited(entityName, entityPrimaryKeyValues);

                // Create the list of dependencies and restore each dependency recursively.
                var dependencies = GetDependenciesAndKeys(entityFromSerializedStorage, entityStructure);
                logger.LogDependencies(dependencies);
                logger.LogInfo("Loading dependencies.");

                foreach (var dependency in dependencies)
                {
                    InnerLoadEntity(dependency.Key, dependency.Value, path, useLock);
                }

                // Restore the current entity.
                // If the entity exists in the database, check if it's equal to the serialized entity.
                logger.LogInfo("Loading current entity.");
                if (entityFromDb != null)
                {
                    // If the entity from the database is not equal to the serialized entity, restore the serialized entity
                    // in the database.
                    if (!entityFromSerializedStorage.Equals(entityFromDb))
                    {
                        dbClient.UpdateWithTransaction(entityFromSerializedStorage, entityStructure);
                    }
                }
                else
                {
                    // The entity is missing, insert it into the database.
                    dbClient.InsertWithTransaction(entityFromSerializedStorage, entityStructure);
                }

                // Restore the associative entities if the current entity is part of a many-to-many (associative) entity.
                logger.LogInfo("Loading associative entities.");
                LoadAssociativeEntities(entityFromSerializedStorage, entityStructure, path, useLock);

                // Unlock the entity.
                if (useLock)
                {
                    string entityPop = lockedEntities.Pop();
                    logger.LogInfo(entityName + " is now unlocked.");
                    if (!entityName.Equals(entityPop))
                    {
                        throw new TdsLogicException("Entity unlock error.");
                    }
                }
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
Beispiel #14
0
        public override bool Equals(Category other)
        {
            if (!base.Equals(other))
            {
                return(false);
            }
            AlgebraicStructureCategory asc = other as AlgebraicStructureCategory;

            if (asc == null)
            {
                return(false);
            }
            return(_structure.Equals(asc._structure) && _additiveEntity.Equals(asc._additiveEntity) && _multiplicativeEntity.Equals(asc._multiplicativeEntity));
        }
Beispiel #15
0
 public bool Equals(BulletSpawnerEntity other)
 {
     return(BulletPrefab.Equals(other.BulletPrefab) && Equals(SmokePrefab, other.SmokePrefab));
 }
Beispiel #16
0
 public bool VerifyPrediction(ref PlatePredictedState state)
 {
     return(Product.Equals(state.Product) &&
            IsGenProduct.Equals(state.IsGenProduct));
 }
Beispiel #17
0
        public void EqualsDbNull()
        {
            Entity entity = new Entity(NAME);

            Assert.IsFalse(entity.Equals(DBNull.Value));
        }
Beispiel #18
0
 public bool Equals(ObstacleReference other) => Value.Equals(other.Value);
Beispiel #19
0
 public bool Equals(Path other)
 {
     return(From.Equals(other.From) && To.Equals(other.To));
 }
Beispiel #20
0
 public void Should_consider_as_equal_entities_with_same_Iri()
 {
     Entity.Equals(new Entity(Iri, Context.Object)).Should().BeTrue();
 }
Beispiel #21
0
            public void ReturnsTrueForSameEntities()
            {
                Entity target = EmptyEntity();

                Assert.True(target.Equals(target));
            }
Beispiel #22
0
 public void Should_consider_as_equal_different_entities_with_same_Iri()
 {
     Entity.Equals(AnotherEntity.Object).Should().BeTrue();
 }
 public bool DiffersFrom(ConsolidationEntry entry)
 {
     return
         (!Entity.Equals(entry.Entity, StringComparison.OrdinalIgnoreCase) ||
          !Column.Equals(entry.Column, StringComparison.OrdinalIgnoreCase));
 }
Beispiel #24
0
 public virtual bool CanSkip(Entity targetEntity) =>
 this.ExcludeSelf && targetEntity.Equals(this.ownerEntity);
 public bool Equals(HalfEdgeVertices other)
 {
     return(Prev.Equals(other.Prev) && Next.Equals(other.Next));
 }
Beispiel #26
0
 public bool Equals(CollisionTriggerData other)
 {
     return(Other.Equals(other.Other));
 }
Beispiel #27
0
 public bool Equals(NavmeshObstacleComponent other) => Navmesh.Equals(other.Navmesh);
Beispiel #28
0
 // --→ Function: Get Midas Owner Name
 private static string GetOwnerName(Entity owner)
 {
     return(owner.Equals(mHero) ? owner.Name.Replace("npc_dota_hero_", "") : "spirit_bear");
 }
Beispiel #29
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If weapon isn't being used by an entity, it shouldn't do anything
        if (owner == null)
        {
            return;
        }

        // If interactive tile
        if (((1 << other.gameObject.layer) & LayerMask.GetMask(new string[] { "InteractiveBlock", "InteractivePass" })) > 0)
        {
            Tile tile = other.GetComponentInParent <Tile> ();
            if (tile != null && tile.CanUseItem(this))
            {
                GetEntity().TriggerItemUse(tile);
            }
        }

        // If collided with opponent's hitbox (weapon)
        if (other.gameObject.tag.Equals("Hitbox"))
        {
            Weapon otherW = other.GetComponent <Weapon> ();
            if (IsAttacking() && !otherW.IsAttacking())
            {
                Entity entity = GetEntity();
                if (otherW.CanDamage(entity))
                {
                    otherW.DealDamage(entity);                     //entity.Damage (otherW.DamageToInflict ());
                    otherW.AddToDamaged(entity);
                    //print ("Damaging: " + entity.name);
                }
            }
            else if (!IsAttacking() && otherW.IsAttacking())
            {
                Entity enemy = otherW.GetEntity();
                if (!targetsHit.Contains(enemy))
                {
                    DealDamage(enemy);                     //enemy.Damage (DamageToInflict ());
                    targetsHit.Add(enemy);
                    //print ("Damaging: " + enemy.name);
                }
            }
            else if (!otherW.IsBlocking())
            {
                TradeBlows(otherW);
            }
        }
        else if (other.gameObject.tag.Equals("Character"))
        {
            // If collided with opponent
            if (IsAttacking())
            {
                Entity enemy = other.GetComponentInParent <Entity>();
                // Don't hurt ourselves
                if (enemy.Equals(GetEntity()))
                {
                    return;
                }
                if (!CanDamage(enemy))
                {
                    return;
                }
                if (!enemy.InAttack() || enemy.IsIdleAttack())
                {
                    // Enemy but they are in lingering attack state, so still hit them
                    DealDamage(enemy);
                    AddToDamaged(enemy);
                }
            }
        }
    }
Beispiel #30
0
 protected bool Equals(GeoPoint other)
 {
     return(base.Equals(other) && Entity.Equals(other.Entity));
 }
Beispiel #31
0
 public bool Equals(EntityConversionData other)
 {
     return(PrimaryEntity.Equals(other.PrimaryEntity) && Equals(AdditionalEntities, other.AdditionalEntities) && Equals(EntityManager, other.EntityManager));
 }
        /// <summary>
        ///     Draw a specified entity
        /// </summary>
        /// <param name="e">The entity to draw</param>
        private void DrawEntity(Entity e)
        {
            if (!e.IsOnScreen || e.IsOccluded) return;

            var textScale = .25f;

            //Set text color
            var c = Color.FromArgb(150, Color.White);
            if (_selectedEntity != null && e.Equals(_selectedEntity)) c = Color.Red;
            else {
                switch (GTAFuncs.GetEntityType(e)) {
                    case GTAFuncs.EntityType.Ped:
                        c = new Ped(e.Handle).IsPlayer
                            ? Color.FromArgb(150, Color.CornflowerBlue)
                            : Color.FromArgb(150, Color.Yellow);
                        break;
                    case GTAFuncs.EntityType.Vehicle:
                        c = Color.FromArgb(150, Color.DeepPink);
                        break;
                    case GTAFuncs.EntityType.Prop:
                        c = Color.FromArgb(150, Color.Green);
                        break;
                }
            }

            //Create entity info lines
            var lines = new List<string>();

            switch(GTAFuncs.GetEntityType(e)) {
                case GTAFuncs.EntityType.Ped:
                    Ped ped = new Ped(e.Handle);
                    if (ped.IsPlayer) {
                        Player pl = GTAFuncs.GetPedPlayer(ped);
                        lines.Add(pl.Name);
                        lines.Add("Player #" + pl.Handle);
                        if (GTAFuncs.GetPlayerInvincible(pl)) lines.Add("INVINCIBLE");
                    }
                    lines.Add("Ped #" + ped.Handle);
                    e = ped;
                    break;
                case GTAFuncs.EntityType.Vehicle:
                    Vehicle v = new Vehicle(e.Handle);
                    lines.Add("Vehicle #" + v.Handle);
                    lines.Add(v.FriendlyName);
                    lines.Add(v.DisplayName);
                    e = v;
                    break;
                case GTAFuncs.EntityType.Prop:
                    Prop prop = new Prop(e.Handle);
                    lines.Add("Prop #" + prop.Handle);
                    lines.Add("Model: " + prop.Model.Hash);
                    e = prop;
                    break;
                default:
                    lines.Add("Entity #" + e.Handle);
                    break;
            }

            Entities.Add(e.Handle, e);

            //Draw entity info
            var screenPos = GTAFuncs.WorldToScreen(e.Position);
            var contain =
                new Rectangle(
                    new Point((int) screenPos.X,
                        (int)screenPos.Y + (GTAFuncs.GetEntityType(e) == GTAFuncs.EntityType.Ped && new Ped(e.Handle).IsInVehicle() ? lines.Count * -10 : 0)),
                    new Size(50, (lines.Count*11) - 1));

            for (var i = 0; i < lines.Count; i++) {
                GTAFuncs.SetTextDropShadow(2, Color.FromArgb(255, 0, 0, 0));
                new UIText(lines[i], new Point(0, (i*10)), textScale, Color.FromArgb(255, c), 0, true).Draw(
                    new Size(contain.Location));
                GTAFuncs.SetTextDropShadow(0, Color.Transparent);
            }

            EntityClickBoxes.Add(e, contain);
            DrawEntBox(e, c);
        }
Beispiel #33
0
 public bool IsEntity(string entity)
 {
     return(Entity.Equals(entity, StringComparison.InvariantCultureIgnoreCase));
 }