示例#1
0
    /// <summary>
    /// Determines whether a specified entity is affected by this HotSpot.
    /// </summary>
    /// <param name="target">an Entity</param>
    /// <returns>'true' if this HotSpot affects the entity, 'false' otherwise</returns>
    private bool IsAffectedTarget( Entity target )
    {
        if( (null == m_TargetEntityTypes) || (0 == m_TargetEntityTypes.Length) )
        {
            //-- Affect all entity types by default
            return true;
        }

        bool valid = false;

        foreach( EntityType entityType in m_TargetEntityTypes )
        {
            switch( entityType )
            {
                case EntityType.AI:
                {
                    valid = target.IsAI();
                    break;
                }

                case EntityType.Creature:
                {
                    valid = target.IsCreature();
                    break;
                }

                case EntityType.Item:
                {
                    valid = target.IsItem();
                    break;
                }

                case EntityType.Player:
                {
                    valid = target.IsPlayer();
                    break;
                }
            }

            if( valid )
            {
                return true;
            }
        }

        return false;
    }